Merge pull request '1' (#16) from develop into master
commit
41b01adfca
@ -1,2 +1,11 @@
|
||||
# timeUse
|
||||
|
||||
<!-- 本产品用于更好的管理您的时间,提高时间的利用效率 -->
|
||||
<!-- 您可在本产品设置任务来对自己的行程进行规划 -->
|
||||
<!-- 您还可在本产品查看各个应用的使用情况,包括今日、昨日和最近一周的情况 -->
|
||||
|
||||
<!-- 以下是注意事项 -->
|
||||
<!-- 在安装本软件后, 第一次打开本软件时请根据提示赋予本软件获取其他应用使用情况的权限-->
|
||||
<!-- 赋予权限后,请先前往软件分类界面完成应用分类,再前往应用使用情况界面查看应用使用情况 -->
|
||||
<!-- 如果想在分析报告界面的今日报告中查看准确的分析信息,请在前往分析报告界面前,先前往应用使用情况界面 -->
|
||||
<!-- 在进入新的一天后,如果您想进入分析报告界面,同样请先前往应用使用情况界面 -->
|
||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
After Width: | Height: | Size: 9.5 KiB |
@ -0,0 +1,35 @@
|
||||
package com.tanshui.timeuse.adapter;
|
||||
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentPagerAdapter;
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
public class MainViewPagerAdapter extends FragmentPagerAdapter {
|
||||
|
||||
private final List<Fragment> mFragmentList = new ArrayList<>();
|
||||
|
||||
public MainViewPagerAdapter(FragmentManager manager) {
|
||||
super(manager);
|
||||
}
|
||||
|
||||
public void addFragment(Fragment fragment) {
|
||||
mFragmentList.add(fragment);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCount() {
|
||||
return mFragmentList.size();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public Fragment getItem(int position) {
|
||||
return mFragmentList.get(position);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.tanshui.timeuse.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.tanshui.timeuse.R;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link TaskListFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class TaskListFragment extends Fragment {
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
public TaskListFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
*
|
||||
* @param param1 Parameter 1.
|
||||
* @param param2 Parameter 2.
|
||||
* @return A new instance of fragment TaskListFragment.
|
||||
*/
|
||||
// TODO: Rename and change types and number of parameters
|
||||
public static TaskListFragment newInstance(String param1, String param2) {
|
||||
TaskListFragment fragment = new TaskListFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PARAM1, param1);
|
||||
args.putString(ARG_PARAM2, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_task_list, container, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.tanshui.timeuse.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.tanshui.timeuse.R;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link appUseFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class appUseFragment extends Fragment {
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
public appUseFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
*
|
||||
* @param param1 Parameter 1.
|
||||
* @param param2 Parameter 2.
|
||||
* @return A new instance of fragment appUseFragment.
|
||||
*/
|
||||
// TODO: Rename and change types and number of parameters
|
||||
public static appUseFragment newInstance(String param1, String param2) {
|
||||
appUseFragment fragment = new appUseFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PARAM1, param1);
|
||||
args.putString(ARG_PARAM2, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_app_use, container, false);
|
||||
}
|
||||
}
|
@ -0,0 +1,106 @@
|
||||
package com.tanshui.timeuse.fragment;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
import androidx.fragment.app.FragmentTransaction;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
import android.widget.ImageButton;
|
||||
import android.widget.LinearLayout;
|
||||
|
||||
import com.tanshui.timeuse.R;
|
||||
import com.tanshui.timeuse.appTimeUse;
|
||||
import com.tanshui.timeuse.task_show;
|
||||
|
||||
public class main_tabFragment extends Fragment implements View.OnClickListener{
|
||||
private Button jump_appUse;
|
||||
private Button jump_report;
|
||||
private Fragment TaskListFragment,reportFragment,appUseFragment;
|
||||
private FragmentManager fragmentManager;
|
||||
@Nullable
|
||||
@Override
|
||||
public Context getContext() {
|
||||
return super.getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
View view=inflater.inflate(R.layout.fragment_main_tab, container, false);
|
||||
initViews(view);
|
||||
setTabSelection(R.id.jump_list);
|
||||
return view;
|
||||
}
|
||||
//初始化视图对象
|
||||
private void initViews(View view){
|
||||
//主页面
|
||||
Button jump_list = (Button) view.findViewById(R.id.jump_list);
|
||||
jump_list.setOnClickListener(this);
|
||||
//分类页面
|
||||
jump_appUse=(Button)view.findViewById(R.id.jump_appUse);
|
||||
jump_appUse.setOnClickListener(this);
|
||||
//购物车页面
|
||||
jump_report=(Button) view.findViewById(R.id.jump_report);
|
||||
jump_report.setOnClickListener(this);
|
||||
fragmentManager=getFragmentManager();//获得Fragment管理类
|
||||
}
|
||||
//点击事件
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
setTabSelection(v.getId());
|
||||
}
|
||||
//设置Tab选中
|
||||
public void setTabSelection(int id) {
|
||||
//开启一个事务
|
||||
FragmentTransaction fragmentTransaction = fragmentManager.beginTransaction();
|
||||
//隐藏所有Fragment
|
||||
if (TaskListFragment != null) {
|
||||
fragmentTransaction.hide(TaskListFragment);
|
||||
}
|
||||
if (reportFragment != null) {
|
||||
fragmentTransaction.hide(reportFragment);
|
||||
}
|
||||
if (appUseFragment != null) {
|
||||
fragmentTransaction.hide(appUseFragment);
|
||||
}
|
||||
|
||||
//根据tabItem的id来执行不同的操作
|
||||
switch (id) {
|
||||
case R.id.jump_list:
|
||||
if (TaskListFragment == null) {
|
||||
TaskListFragment = new TaskListFragment();
|
||||
fragmentTransaction.add(R.id.fg_content, TaskListFragment);
|
||||
} else {
|
||||
fragmentTransaction.show(TaskListFragment);
|
||||
}
|
||||
break;
|
||||
case R.id.jump_appUse:
|
||||
if (appUseFragment == null) {
|
||||
appUseFragment = new appUseFragment();
|
||||
fragmentTransaction.add(R.id.fg_content, appUseFragment);
|
||||
} else {
|
||||
fragmentTransaction.show(appUseFragment);
|
||||
}
|
||||
break;
|
||||
case R.id.jump_report:
|
||||
if (reportFragment == null) {
|
||||
reportFragment = new reportFragment();
|
||||
fragmentTransaction.add(R.id.fg_content, reportFragment);
|
||||
} else {
|
||||
fragmentTransaction.show(reportFragment);
|
||||
}
|
||||
break;
|
||||
}
|
||||
fragmentTransaction.commit();
|
||||
|
||||
}
|
||||
}
|
@ -0,0 +1,66 @@
|
||||
package com.tanshui.timeuse.fragment;
|
||||
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import com.tanshui.timeuse.R;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
* Use the {@link reportFragment#newInstance} factory method to
|
||||
* create an instance of this fragment.
|
||||
*/
|
||||
public class reportFragment extends Fragment {
|
||||
|
||||
// TODO: Rename parameter arguments, choose names that match
|
||||
// the fragment initialization parameters, e.g. ARG_ITEM_NUMBER
|
||||
private static final String ARG_PARAM1 = "param1";
|
||||
private static final String ARG_PARAM2 = "param2";
|
||||
|
||||
// TODO: Rename and change types of parameters
|
||||
private String mParam1;
|
||||
private String mParam2;
|
||||
|
||||
public reportFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
/**
|
||||
* Use this factory method to create a new instance of
|
||||
* this fragment using the provided parameters.
|
||||
*
|
||||
* @param param1 Parameter 1.
|
||||
* @param param2 Parameter 2.
|
||||
* @return A new instance of fragment reportFragment.
|
||||
*/
|
||||
// TODO: Rename and change types and number of parameters
|
||||
public static reportFragment newInstance(String param1, String param2) {
|
||||
reportFragment fragment = new reportFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putString(ARG_PARAM1, param1);
|
||||
args.putString(ARG_PARAM2, param2);
|
||||
fragment.setArguments(args);
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
if (getArguments() != null) {
|
||||
mParam1 = getArguments().getString(ARG_PARAM1);
|
||||
mParam2 = getArguments().getString(ARG_PARAM2);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
// Inflate the layout for this fragment
|
||||
return inflater.inflate(R.layout.fragment_today, container, false);
|
||||
}
|
||||
}
|
Loading…
Reference in new issue