pull/6/head
贪睡的水瓶 3 years ago
parent a1d3cfe4b3
commit 28efaa4594

@ -0,0 +1,15 @@
*.iml
.gradle
/local.properties
/.idea/caches
/.idea/libraries
/.idea/modules.xml
/.idea/workspace.xml
/.idea/navEditor.xml
/.idea/assetWizardSettings.xml
.DS_Store
/build
/captures
.externalNativeBuild
.cxx
local.properties

@ -0,0 +1,3 @@
# Default ignored files
/shelf/
/workspace.xml

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="CompilerConfiguration">
<bytecodeTargetLevel target="11" />
</component>
</project>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="GradleMigrationSettings" migrationVersion="1" />
<component name="GradleSettings">
<option name="linkedExternalProjectsSettings">
<GradleProjectSettings>
<option name="testRunner" value="GRADLE" />
<option name="distributionType" value="DEFAULT_WRAPPED" />
<option name="externalProjectPath" value="$PROJECT_DIR$" />
<option name="modules">
<set>
<option value="$PROJECT_DIR$" />
<option value="$PROJECT_DIR$/app" />
</set>
</option>
</GradleProjectSettings>
</option>
</component>
</project>

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="UTF-8"?>
<project version="4">
<component name="DesignSurface">
<option name="filePathToZoomLevelMap">
<map>
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/drawable-v24/ic_launcher_foreground.xml" value="0.171" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/drawable/btn_basic.xml" value="0.1965" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/drawable/btn_color.xml" value="0.2435" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/drawable/btn_color_enter.xml" value="0.1905" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/drawable/btn_common.xml" value="0.1965" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/drawable/ic_launcher_background.xml" value="0.171" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/drawable/list_round_btn.xml" value="0.2445" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/drawable/show_btn_color.xml" value="0.1965" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_a.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_abc.xml" value="0.6" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_add_task.xml" value="0.259375" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_add_task2.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_app_time_use.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_login.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_main.xml" value="0.264" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_registered.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_report.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_show_task.xml" value="0.2703804347826087" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_software_classification.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_task_add.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/activity_task_show.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/appitem.xml" value="0.27291666666666664" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/dialog.xml" value="0.32175925925925924" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/fragment_app_use.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/fragment_main_tab.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/fragment_report.xml" value="0.259375" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/fragment_task_list.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/main_tab.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/tab.xml" value="0.27395833333333336" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/layout/taskitem.xml" value="0.264" />
<entry key="..\:/study/Android Studio/AndroidProject/timeUse/app/src/main/res/mipmap-anydpi-v26/ic_launcher.xml" value="0.171" />
</map>
</option>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_11" default="true" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/build/classes" />
</component>
<component name="ProjectType">
<option name="id" value="Android" />
</component>
</project>

@ -0,0 +1 @@
/build

@ -0,0 +1,38 @@
plugins {
id 'com.android.application'
}
android {
compileSdk 32
defaultConfig {
applicationId "com.tanshui.timeuse"
minSdk 29
targetSdk 32
versionCode 1
versionName "1.0"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
}
buildTypes {
release {
minifyEnabled false
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
}
}
compileOptions {
sourceCompatibility JavaVersion.VERSION_1_8
targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation 'androidx.appcompat:appcompat:1.3.0'
implementation 'com.google.android.material:material:1.4.0'
implementation 'androidx.constraintlayout:constraintlayout:2.0.4'
testImplementation 'junit:junit:4.13.2'
androidTestImplementation 'androidx.test.ext:junit:1.1.3'
androidTestImplementation 'androidx.test.espresso:espresso-core:3.4.0'
}

@ -0,0 +1,21 @@
# Add project specific ProGuard rules here.
# You can control the set of applied configuration files using the
# proguardFiles setting in build.gradle.
#
# For more details, see
# http://developer.android.com/guide/developing/tools/proguard.html
# If your project uses WebView with JS, uncomment the following
# and specify the fully qualified class name to the JavaScript interface
# class:
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
# public *;
#}
# Uncomment this to preserve the line number information for
# debugging stack traces.
#-keepattributes SourceFile,LineNumberTable
# If you keep the line number information, uncomment this to
# hide the original source file name.
#-renamesourcefileattribute SourceFile

@ -0,0 +1,26 @@
package com.tanshui.timeuse;
import android.content.Context;
import androidx.test.platform.app.InstrumentationRegistry;
import androidx.test.ext.junit.runners.AndroidJUnit4;
import org.junit.Test;
import org.junit.runner.RunWith;
import static org.junit.Assert.*;
/**
* Instrumented test, which will execute on an Android device.
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
@RunWith(AndroidJUnit4.class)
public class ExampleInstrumentedTest {
@Test
public void useAppContext() {
// Context of the app under test.
Context appContext = InstrumentationRegistry.getInstrumentation().getTargetContext();
assertEquals("com.tanshui.timeuse", appContext.getPackageName());
}
}

@ -0,0 +1,58 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
package="com.tanshui.timeuse">
<uses-permission
android:name="android.permission.PACKAGE_USAGE_STATS"
tools:ignore="ProtectedPermissions" />
<application
android:allowBackup="true"
android:dataExtractionRules="@xml/data_extraction_rules"
android:fullBackupContent="@xml/backup_rules"
android:icon="@mipmap/ic_launcher"
android:label="@string/app_name"
android:roundIcon="@mipmap/ic_launcher_round"
android:supportsRtl="true"
android:theme="@style/Theme.TimeUse"
tools:targetApi="31">
<activity
android:name=".add_task"
android:exported="false" />
<activity
android:name=".software_classification"
android:exported="false" />
<activity
android:name=".login.registered"
android:exported="false" />
<activity
android:name=".login.login"
android:exported="false" />
<activity
android:name=".task_add"
android:exported="false" />
<activity
android:name=".show_task"
android:exported="false" />
<activity
android:name=".appTimeUse"
android:exported="false" />
<activity
android:name=".MainActivity"
android:exported="false" />
<activity
android:name=".report"
android:exported="false" />
<activity
android:name=".task_show"
android:exported="true">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
</activity>
</application>
</manifest>

@ -0,0 +1,53 @@
package com.tanshui.timeuse;
import android.graphics.drawable.Drawable;
import java.util.List;
public class AppInfo {
public int uid;
public String label;//应用名称
public String package_name;//应用包名
public Drawable icon;//应用icon
public List<String> times;
public AppInfo() {
uid = 0;
label = "";
package_name = "";
icon = null;
times=null;
}
public int getUid() {
return uid;
}
public void setUid(int uid) {
this.uid = uid;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
public String getPackage_name() {
return package_name;
}
public void setPackage_name(String package_name) {
this.package_name = package_name;
}
public Drawable getIcon() {
return icon;
}
public void setIcon(Drawable icon) {
this.icon = icon;
}
}

@ -0,0 +1,104 @@
package com.tanshui.timeuse;
import android.content.ContentValues;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.BaseAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.Switch;
import android.widget.TextView;
import android.widget.Toast;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class CheckboxAdapter extends BaseAdapter {
private List<HashMap<String, Object>> list;
private LayoutInflater inflater=null;
private Context context;
public CheckboxAdapter(Context context,List<HashMap<String, Object>> list) {
inflater = LayoutInflater.from(context);
this.list=list;
}
public Context getContext() {
return context;
}
public void setContext(Context context) {
this.context = context;
}
@Override
public int getCount() {
if (list == null) {
return 0;
}
return list.size();
}
@Override
public Object getItem(int position) {
return list.get(position);
}
@Override
public long getItemId(int position) {
return position;
}
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
ViewHolder viewHolder = null;
if (convertView == null) {
convertView = inflater.inflate(R.layout.taskitem, null);
viewHolder = new ViewHolder();
viewHolder.content = convertView.findViewById(R.id.content);
viewHolder.startTime = convertView.findViewById(R.id.startTime);
viewHolder.endTime = convertView.findViewById(R.id.endTime);
viewHolder.isFinished = convertView.findViewById(R.id.isFinished);
convertView.setTag(viewHolder);
} else {
viewHolder = (ViewHolder) convertView.getTag();
}
viewHolder.content.setText(list.get(position).get("ItemContent").toString());
viewHolder.startTime.setText(list.get(position).get("ItemStartTime").toString());
viewHolder.endTime.setText(list.get(position).get("ItemEndTime").toString());
// viewHolder.tv_addTokenContent.setText(list.get(position));
// viewHolder.tv_addTokenAddress.setText(list.get(position));
// viewHolder.switch_addToken.setChecked(isSelected.get(position));
// final int pos = position; //pos必须声明为final
// viewHolder.isFinished.setTag(position);
// viewHolder.isFinished.setOnCheckedChangeListener(null);
viewHolder.isFinished.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
Toast.makeText(context, "123", Toast.LENGTH_SHORT).show();
}
});
return convertView;
}
}

@ -0,0 +1,76 @@
package com.tanshui.timeuse;
import androidx.annotation.RequiresApi;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AppOpsManager;
import android.app.usage.UsageStats;
import android.app.usage.UsageStatsManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.graphics.drawable.Drawable;
import android.os.Build;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import java.lang.reflect.Field;
import java.lang.reflect.InvocationTargetException;
import java.lang.reflect.Method;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Set;
public class MainActivity extends AppCompatActivity {
private Button app_use;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
app_use = findViewById(R.id.app_use);
//如没有开启应用权限,则开启
if (!isStatAccessPermissionSet()) {
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
this.startActivity(intent);
}
app_use.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(MainActivity.this,appTimeUse.class);
startActivity(intent);
}
});
}
// 开启应用访问权限
public boolean isStatAccessPermissionSet() {
try {
PackageManager packageManager = this.getPackageManager();
ApplicationInfo info = packageManager.getApplicationInfo(this.getPackageName(), 0);
AppOpsManager appOpsManager = (AppOpsManager) this.getSystemService(APP_OPS_SERVICE);
return appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS, info.uid, info.packageName) == AppOpsManager.MODE_ALLOWED;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}

@ -0,0 +1,13 @@
package com.tanshui.timeuse;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.TextView;
public class ViewHolder {
public TextView content=null;
public TextView startTime=null;
public TextView endTime=null;
public CheckBox isFinished=null;
public Button deleteTask=null;
}

@ -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,28 @@
package com.tanshui.timeuse;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.tanshui.timeuse.database.timeUseDBHelper;
public class add_task extends AppCompatActivity {
private timeUseDBHelper dbHelper;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_add_task);
}
@Override
protected void onStart() {
super.onStart();
dbHelper = timeUseDBHelper.getInstance(this);
dbHelper.openReadLink();
}
@Override
protected void onStop() {
super.onStop();
dbHelper.closeLink();
}
}

@ -0,0 +1,229 @@
package com.tanshui.timeuse;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AppOpsManager;
import android.app.usage.UsageStats;
import android.app.usage.UsageStatsManager;
import android.content.Context;
import android.content.Intent;
import android.content.pm.ApplicationInfo;
import android.content.pm.PackageInfo;
import android.content.pm.PackageManager;
import android.graphics.drawable.Drawable;
import android.os.Bundle;
import android.provider.Settings;
import android.util.Log;
import android.view.View;
import android.widget.AdapterView;
import android.widget.Button;
import android.widget.ImageView;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.Toast;
import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
public class appTimeUse extends AppCompatActivity {
private ListView lv_app;
private ArrayList<AppInfo> mApplicationInfos;
private Button list;
private Button report;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_app_time_use);
lv_app = findViewById(R.id.lv_app);
list=findViewById(R.id.jump_app_list);
report=findViewById(R.id.jump_app_report);
// 如果第一次打开查看app使用界面打开应用权限
if (!isStatAccessPermissionSet()) {
Intent intent = new Intent(Settings.ACTION_USAGE_ACCESS_SETTINGS);
this.startActivity(intent);
}
list.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(appTimeUse.this,task_show.class);
startActivity(intent);
}
});
report.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(appTimeUse.this,report.class);
startActivity(intent);
}
});
mApplicationInfos=getAllAppInfo(this);
// 从早上8点开始监听
Calendar setBeginCal=Calendar.getInstance();
Calendar setEndCal=Calendar.getInstance();
Calendar beginCal = Calendar.getInstance();
// beginCal.set(Calendar.HOUR_OF_DAY,8);
// beginCal.set(Calendar.MINUTE,0);
// beginCal.set(Calendar.SECOND,0);
int hour = beginCal.get(Calendar.HOUR_OF_DAY);
int minute = beginCal.get(Calendar.MINUTE);
int second = beginCal.get(Calendar.SECOND);
setBeginCal.add(Calendar.SECOND, -1 * second);
setBeginCal.add(Calendar.MINUTE, -1 * minute);
setBeginCal.add(Calendar.HOUR, -1 * hour+8);
setEndCal.add(Calendar.SECOND, -1 * second);
setEndCal.add(Calendar.MINUTE, -1 * minute);
setEndCal.add(Calendar.HOUR, -1 * hour+10);
beginCal.add(Calendar.SECOND, -1 * second);
beginCal.add(Calendar.MINUTE, -1 * minute);
beginCal.add(Calendar.HOUR, -1 * hour+8);
Calendar endCal = Calendar.getInstance();
UsageStatsManager manager=(UsageStatsManager)getApplicationContext().getSystemService(USAGE_STATS_SERVICE);
List<UsageStats> stats=manager.queryUsageStats(UsageStatsManager.INTERVAL_DAILY,beginCal.getTimeInMillis(),endCal.getTimeInMillis());
Map<String, UsageStats> statsMap = manager.queryAndAggregateUsageStats(setBeginCal.getTimeInMillis(), setEndCal.getTimeInMillis());
ArrayList<HashMap<String, Object>> listItem = new ArrayList<>();
List<String> name = new ArrayList<>();
List<Drawable> icons = new ArrayList<>();
for(UsageStats us:stats){
try {
PackageManager pm=getApplicationContext().getPackageManager();
ApplicationInfo applicationInfo=pm.getApplicationInfo(us.getPackageName(),PackageManager.GET_META_DATA);
PackageInfo packageInfo = pm.getPackageInfo(applicationInfo.packageName, PackageManager.GET_CONFIGURATIONS);
int flags = packageInfo.applicationInfo.flags;
SimpleDateFormat format = new SimpleDateFormat("HH:mm:ss");
String t=format.format(new Date(us.getLastTimeUsed()));
long t1=us.getLastTimeStamp();
String t2=format.format(new Date(us.getLastTimeUsed()));
String appName = "";
Drawable icon=null;
for(AppInfo app:mApplicationInfos){
if(applicationInfo.packageName.equals(app.package_name)){
appName=app.label;
name.add(appName);
icon=app.icon;
icons.add(icon);
}
}
if(getTimeFromInt(us.getTotalTimeInForeground())!="已结束"){
UsageStats usageStats=statsMap.get(applicationInfo.packageName);
// 判断是否为系统应用系统
if((flags & ApplicationInfo.FLAG_SYSTEM) == 0){
HashMap<String,Object> map = new HashMap<>();
//加入图片
map.put("ItemImage", icon);
// 添加app名称
map.put("ItemLabel", appName);
// 添加app使用时间
map.put("ItemTime",getTimeFromInt(usageStats.getTotalTimeInForeground()));
listItem.add(map);
}
}
} catch (Exception e) {
e.printStackTrace();
}
}
SimpleAdapter adapter = new SimpleAdapter(this,
//绑定的数据
listItem,
//每一行的布局
R.layout.appitem,
//动态数组中的数据源的键映射到布局文件对应的控件中
new String[] {"ItemImage", "ItemLabel","ItemTime"},
new int[] {R.id.iv_appIcon, R.id.label,R.id.times});
lv_app.setAdapter(adapter);
// 显示app图标
adapter.setViewBinder(new SimpleAdapter.ViewBinder() {
@Override
public boolean setViewValue(View view, Object o, String s) {
if(view instanceof ImageView && o instanceof Drawable){
ImageView iv=(ImageView)view;
iv.setImageDrawable((Drawable)o);
return true;
}
else return false;
}
});
// t1.setText(sb1);
}
public static String getTimeFromInt(long time) {
if (time <= 0) { return "已结束"; }
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
// long day = time / (1 * 60 * 60 * 24);
String hour = time / (1000*60*60) % 60 +"";
String minute = time / (1000*60) % 60<10?"0"+time / (1000*60) % 60:""+time / (1000*60) % 60;
String second = time /1000 % 60<10?"0"+time / 1000 % 60:""+time / 1000 % 60;
return "今天使用时间:"+hour+"小时"+minute+"分钟"+second+"秒";
}
/**
*
* @param ctx
* isFilterSystem
* @return
*/
public ArrayList<AppInfo> getAllAppInfo(Context ctx) {
ArrayList<AppInfo> appBeanList = new ArrayList<>();
AppInfo bean = null;
PackageManager packageManager = ctx.getPackageManager();
List<PackageInfo> list = packageManager.getInstalledPackages(0);
for (PackageInfo p : list) {
bean = new AppInfo();
bean.setIcon(p.applicationInfo.loadIcon(packageManager));
bean.setLabel(packageManager.getApplicationLabel(p.applicationInfo).toString());
bean.setPackage_name(p.applicationInfo.packageName);
int flags = p.applicationInfo.flags;
// 判断是否是属于系统的apk
if ((flags & ApplicationInfo.FLAG_SYSTEM) != 0) {
// bean.setSystem(true);
} else {
appBeanList.add(bean);
}
}
return appBeanList;
}
// 打开应用权限
public boolean isStatAccessPermissionSet() {
try {
PackageManager packageManager = this.getPackageManager();
ApplicationInfo info = packageManager.getApplicationInfo(this.getPackageName(), 0);
AppOpsManager appOpsManager = (AppOpsManager) this.getSystemService(APP_OPS_SERVICE);
return appOpsManager.checkOpNoThrow(AppOpsManager.OPSTR_GET_USAGE_STATS, info.uid, info.packageName) == AppOpsManager.MODE_ALLOWED;
} catch (Exception e) {
e.printStackTrace();
return false;
}
}
}

@ -0,0 +1,117 @@
package com.tanshui.timeuse.database;
import android.content.ContentValues;
import android.content.Context;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.database.sqlite.SQLiteOpenHelper;
import android.util.Log;
import android.widget.Toast;
import com.tanshui.timeuse.taskInfo;
import java.util.ArrayList;
import java.util.List;
public class timeUseDBHelper extends SQLiteOpenHelper {
private static final String DB_NAME="timeUse.db";
private static final String TABLE_taskList="taskList";
private static final String TABLE_UserList="UserList";
private static final int DB_VERSION=1;
private static timeUseDBHelper timeUseDBHelper=null;
private SQLiteDatabase mRDB=null;
private SQLiteDatabase mWDB=null;
private timeUseDBHelper(Context context){
super(context,DB_NAME,null,DB_VERSION);
}
// 利用单例模式获取数据库帮助器的唯一实例
public synchronized static timeUseDBHelper getInstance(Context context){
if(timeUseDBHelper==null){
timeUseDBHelper=new timeUseDBHelper(context);
}
return timeUseDBHelper;
}
// 打开数据库的读连接
public SQLiteDatabase openReadLink(){
if(mRDB==null||!mRDB.isOpen()){
mRDB=timeUseDBHelper.getReadableDatabase();
}
return mRDB;
}
// 打开数据库的写连接
public SQLiteDatabase openWriteLink(){
if(mWDB==null||!mWDB.isOpen()){
mWDB=timeUseDBHelper.getWritableDatabase();
}
return mWDB;
}
// 关闭数据库连接
public void closeLink(){
if(mRDB!=null&&mRDB.isOpen()){
mRDB.close();
mRDB=null;
}
if(mWDB!=null&&mWDB.isOpen()){
mWDB.close();
mWDB=null;
}
}
// 创建数据库,执行建表语句
@Override
public void onCreate(SQLiteDatabase db) {
String sql="CREATE TABLE IF NOT EXISTS "+TABLE_taskList+
"(_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"+
"date VARCHAR NOT NULL,"+
"startTime VARCHAR NOT NULL,"+
"endTime VARCHAR NOT NULL,"+
"content VARCHAR NOT NULL,"+
"isFinished INTEGER NOT NULL);";
db.execSQL(sql);
String sql1="CREATE TABLE IF NOT EXISTS "+TABLE_UserList+
"(_id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL,"+
"username VARCHAR NOT NULL,"+
"password VARCHAR NOT NULL);";
db.execSQL(sql1);
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
}
// 获取数据库中的任务列表
public List<taskInfo> queryAllTaskInfo(){
// String sql="select * from "+TABLE_taskList;
List<taskInfo> list=new ArrayList<>();
// Cursor cursor=mRDB.rawQuery(sql,null);
Cursor cursor=mRDB.query(TABLE_taskList,null,null,null,null,null,null);
while(cursor.moveToNext()){
taskInfo task=new taskInfo();
task.id=cursor.getInt(0);
task.startTime=cursor.getString(2);
task.endTime=cursor.getString(3);
task.isFinished=cursor.getInt(5)!=0;
task.content=cursor.getString(4);
task.date=cursor.getString(1);
list.add(task);
}
cursor.close();
return list;
}
// 向数据库添加任务信息
public long insertTaskInfos(taskInfo task){
ContentValues values=new ContentValues();
values.put("date",task.date);
values.put("content",task.content);
values.put("startTime",task.startTime);
values.put("endTime",task.endTime);
values.put("isFinished",task.isFinished);
return mWDB.insert(TABLE_taskList,null,values);
}
// 删除数据库中的信息
public long deleteTaskInfos(String data){
return mWDB.delete(TABLE_taskList,"content=?",new String[]{data});
}
}

@ -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_report, container, false);
}
}

@ -0,0 +1,16 @@
package com.tanshui.timeuse.login;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.tanshui.timeuse.R;
public class login extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_login);
}
}

@ -0,0 +1,16 @@
package com.tanshui.timeuse.login;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import com.tanshui.timeuse.R;
public class registered extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_registered);
}
}

@ -0,0 +1,44 @@
package com.tanshui.timeuse;
import androidx.appcompat.app.AppCompatActivity;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
public class report extends AppCompatActivity {
private TextView title;
private Button jump_appUse;
private Button jump_list;
private Button jump_report;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_report);
title=findViewById(R.id.title);
jump_appUse = findViewById(R.id.jump_appUse2);
jump_list=findViewById(R.id.jump_list2);
jump_report=findViewById(R.id.jump_report2);
jump_appUse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(report.this,appTimeUse.class);
startActivity(intent);
}
});
jump_list.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(report.this,task_show.class);
startActivity(intent);
}
});
}
}

@ -0,0 +1,94 @@
package com.tanshui.timeuse;
import androidx.appcompat.app.AppCompatActivity;
import android.app.DatePickerDialog;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.DatePicker;
import android.widget.ListView;
import android.widget.TextView;
import com.tanshui.timeuse.database.timeUseDBHelper;
import java.util.Calendar;
import java.util.List;
public class show_task extends AppCompatActivity {
private TextView textView;
private Button changeDate;
private Button addTask;
private String decs;
private DatePicker picker;
private DatePickerDialog.OnDateSetListener listener;
private int nowYear;
private int nowMonth;
private int nowDay;
private timeUseDBHelper dbHelper;
private List<taskInfo> task;
private ListView lv_task;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_show_task);
textView = findViewById(R.id.tv);
lv_task=findViewById(R.id.lv_task);
changeDate = findViewById(R.id.changeDate);
addTask=findViewById(R.id.addTask);
// 获取当前日期
Calendar now=Calendar.getInstance();
nowYear=now.get(Calendar.YEAR);
nowMonth=now.get(Calendar.MONTH);//实际月份需要加1
nowDay=now.get(Calendar.DATE);
decs=String.format("%s-%s-%s", nowYear, nowMonth, nowDay);
textView.setText(decs);
// List<taskInfo> list=dbHelper.queryAllTaskInfo();
// 点击按钮更改日期
changeDate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar calendar = Calendar.getInstance();
DatePickerDialog dateDialog = new DatePickerDialog(show_task.this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
decs = String.format("%s-%s-%s", year, month, dayOfMonth);
textView.setText(decs);
}
},
calendar.get(Calendar.YEAR),
calendar.get(Calendar.MONTH),
calendar.get(Calendar.DAY_OF_MONTH));
dateDialog.show();
}
});
// 点击按钮添加任务
addTask.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(show_task.this, task_add.class);
intent.putExtra("date",decs);
startActivity(intent);
}
});
}
@Override
protected void onStart() {
super.onStart();
dbHelper = timeUseDBHelper.getInstance(this);
dbHelper.openReadLink();
}
@Override
protected void onStop() {
super.onStop();
dbHelper.closeLink();
}
}

@ -0,0 +1,22 @@
package com.tanshui.timeuse;
import androidx.appcompat.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Spinner;
import android.widget.Toast;
public class software_classification extends AppCompatActivity {
private Spinner classify;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_software_classification);
classify=findViewById(R.id.classify1);
}
}

@ -0,0 +1,33 @@
package com.tanshui.timeuse;
import java.util.ArrayList;
public class taskInfo {
public String date;
public int id;
public String content;
public boolean isFinished;
public String startTime;
public String endTime;
public taskInfo(String content,boolean isFinished,String startTime,String endTime,int id,String date){
this.content=content;
this.isFinished=isFinished;
this.endTime=endTime;
this.startTime=startTime;
this.date=date;
this.id=id;
}
public taskInfo(){}
public boolean isFinished() {
return isFinished;
}
public void setChecked(boolean isFinished) {
this.isFinished = isFinished;
}
}

@ -0,0 +1,7 @@
package com.tanshui.timeuse;
public class taskManager {
public void addTask(){
}
}

@ -0,0 +1,150 @@
package com.tanshui.timeuse;
import androidx.appcompat.app.AppCompatActivity;
import android.app.AlertDialog;
import android.app.Dialog;
import android.app.TimePickerDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.os.Handler;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.TextView;
import android.widget.TimePicker;
import android.widget.Toast;
import com.tanshui.timeuse.database.timeUseDBHelper;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
public class task_add extends AppCompatActivity {
private EditText task_content;
private Button StartTime;
private Button EndTime;
private Button btn_down;
private Button btn_del;
private TextView tv_startTime;
private TextView tv_endTime;
private String decs;
private timeUseDBHelper dbHelper;
private String date;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_task_add);
taskInfo task=new taskInfo();
task_content=findViewById(R.id.task_content);
StartTime=findViewById(R.id.StartTime);
EndTime=findViewById(R.id.EndTime);
btn_down=findViewById(R.id.btn_down);
tv_startTime=findViewById(R.id.tv_startTime);
tv_endTime=findViewById(R.id.tv_endTime);
Intent intent=getIntent();
date=intent.getStringExtra("date");
// 默认task属性
task.isFinished=false;
task.date=date;
StartTime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Dialog dia=new Dialog(task_add.this);
dia.create();
Calendar time=Calendar.getInstance();
// 显示时间选择器
TimePickerDialog timeDialog=new TimePickerDialog(task_add.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
String min= Integer.toString(minute);
min=minute>=10?min:"0"+min;
decs = String.format("%s点%s分", hourOfDay, min);
task.startTime=decs;
tv_startTime.setText("任务开始时间:"+decs);
}
},time.get(Calendar.HOUR_OF_DAY),time.get(Calendar.MINUTE),true);
timeDialog.show();
}
});
EndTime.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Dialog dia=new Dialog(task_add.this);
dia.create();
Calendar time=Calendar.getInstance();
// 显示时间选择器
TimePickerDialog timeDialog=new TimePickerDialog(task_add.this, new TimePickerDialog.OnTimeSetListener() {
@Override
public void onTimeSet(TimePicker view, int hourOfDay, int minute) {
String min= Integer.toString(minute);
min=minute>=10?min:"0"+min;
decs = String.format("%s点%s分", hourOfDay, min);
task.endTime=decs;
tv_endTime.setText("任务结束时间:"+decs);
}
},time.get(Calendar.HOUR_OF_DAY),time.get(Calendar.MINUTE),true);
timeDialog.show();
}
});
btn_down.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if(!task_content.getText().toString().isEmpty()){
task.content=task_content.getText().toString();
}else{
// list为空弹出提示
AlertDialog.Builder builder = new AlertDialog.Builder(task_add.this);
builder.setTitle("标题");
builder.setMessage("内容11111");
builder.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(task_add.this, "确定", Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton("取消", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
Toast.makeText(task_add.this, "取消", Toast.LENGTH_SHORT).show();
}
});
AlertDialog alertDialog = builder.create();
alertDialog.show();
return;
}
// 将新增的任务添加到数据库
if(dbHelper.insertTaskInfos(task)>0)
Toast.makeText(task_add.this,"添加任务成功",Toast.LENGTH_SHORT).show();
// 延时1秒跳转页面
new Handler().postDelayed(new Runnable() {
@Override
public void run() {
Intent intent=new Intent(task_add.this,task_show.class);
startActivity(intent);
}
},1000);
}
});
}
@Override
protected void onStart() {
super.onStart();
dbHelper = timeUseDBHelper.getInstance(this);
dbHelper.openWriteLink();
dbHelper.openReadLink();
}
}

@ -0,0 +1,296 @@
package com.tanshui.timeuse;
import androidx.annotation.NonNull;
import androidx.appcompat.app.AppCompatActivity;
import androidx.viewpager.widget.ViewPager;
import android.app.Activity;
import android.app.AlertDialog;
import android.app.DatePickerDialog;
import android.app.FragmentTransaction;
import android.app.Person;
import android.content.ContentValues;
import android.content.DialogInterface;
import android.content.Intent;
import android.database.Cursor;
import android.database.sqlite.SQLiteDatabase;
import android.os.Bundle;
import android.text.method.DigitsKeyListener;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.ArrayAdapter;
import android.widget.Button;
import android.widget.CheckBox;
import android.widget.CompoundButton;
import android.widget.DatePicker;
import android.widget.EditText;
import android.widget.LinearLayout;
import android.widget.ListView;
import android.widget.RadioGroup;
import android.widget.SimpleAdapter;
import android.widget.TextView;
import android.widget.Toast;
import com.google.android.material.bottomnavigation.BottomNavigationView;
import com.tanshui.timeuse.adapter.MainViewPagerAdapter;
import com.tanshui.timeuse.database.timeUseDBHelper;
import com.tanshui.timeuse.fragment.main_tabFragment;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.List;
public class task_show extends Activity {
private TextView textView;
private Button changeDate;
private Button addTask;
private Button jump_list;
private Button jump_appUse;
private Button jump_report;
private String decs;
private int nowYear;
private int nowMonth;
private int nowDay;
private timeUseDBHelper dbHelper;
private ListView lv_task;
private List<taskInfo> taskInfos;
private ArrayList<HashMap<String, Object>> listItem;
private SimpleAdapter adapter;
private SQLiteDatabase write;
private LayoutInflater mlayoutInflater;
private View dialogView;
private Button dialog_delete;
private EditText dialog_edit;
private CheckBox dialog_check;
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_task_show);
// main_tabFragment main_tabFragment=new main_tabFragment();
// getSupportFragmentManager().beginTransaction().add(R.id.main_frame, main_tabFragment).show(main_tabFragment).commitAllowingStateLoss();
textView = findViewById(R.id.tv);
lv_task=findViewById(R.id.lv_task);
changeDate = findViewById(R.id.changeDate);
addTask=findViewById(R.id.addTask);
jump_appUse=findViewById(R.id.jump_appUse);
jump_list=findViewById(R.id.jump_list);
jump_report=findViewById(R.id.jump_report);
// 获取当前日期
Calendar now=Calendar.getInstance();
nowYear=now.get(Calendar.YEAR);
nowMonth=now.get(Calendar.MONTH);//实际月份需要加1
nowDay=now.get(Calendar.DATE);
decs=String.format("%s-%s-%s", nowYear, nowMonth, nowDay);
textView.setText(decs);
listItem= new ArrayList<>();
// 点击按钮更改日期
changeDate.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Calendar calendar = Calendar.getInstance();
DatePickerDialog dateDialog = new DatePickerDialog(task_show.this,
new DatePickerDialog.OnDateSetListener() {
@Override
public void onDateSet(DatePicker view, int year, int month, int dayOfMonth) {
// 更新日期选择器为新选的日期
nowYear=year;
nowMonth=month;
nowDay=dayOfMonth;
decs = String.format("%s-%s-%s", year, month, dayOfMonth);
setList();
textView.setText(decs);
}
},
nowYear,
nowMonth,
nowDay);
dateDialog.show();
}
});
// 点击按钮添加任务
addTask.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent();
intent.setClass(task_show.this, task_add.class);
intent.putExtra("date",decs);
startActivity(intent);
}
});
// 点击按钮跳转
jump_appUse.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(task_show.this,appTimeUse.class);
startActivity(intent);
}
});
jump_report.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
Intent intent=new Intent(task_show.this,report.class);
startActivity(intent);
}
});
// CheckboxAdapter checkboxAdapter=new CheckboxAdapter(task_show.this,listItem);
// lv_task.setAdapter(checkboxAdapter);
lv_task.setOnItemClickListener(new AdapterView.OnItemClickListener() {
@Override
public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
// CheckboxAdapter checkboxAdapter=new CheckboxAdapter(task_show.this,listItem);
// checkboxAdapter.getViews(position,view,parent,lv_task,task_show.this);
// 修改任务弹窗
showCustomInputDialog(position);
LinearLayout ll = (LinearLayout)lv_task.getChildAt(position);// 获得子级
// 从子级中获得控件
CheckBox isFinished = ll.findViewById(R.id.isFinished);
TextView content = ll.findViewById(R.id.content);
// if(isFinished ==null){
// Toast.makeText(task_show.this, "error", Toast.LENGTH_SHORT).show();
// }
// 改变任务状态
// isFinished.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
// @Override
// public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
// ContentValues values = new ContentValues();
// values.put("isFinished" , isChecked);
// write.update("taskList",values,"content=?",new String[]{content.getText().toString()});
// taskInfos=dbHelper.queryAllTaskInfo();
// setList();
// Toast.makeText(task_show.this, isChecked+"("+position+")", Toast.LENGTH_SHORT).show();
// }
// });
//
// Toast.makeText(task_show.this, position+"", Toast.LENGTH_SHORT).show();
}
});
}
@Override
protected void onStart() {
super.onStart();
dbHelper = timeUseDBHelper.getInstance(task_show.this);
dbHelper.openReadLink();
write=dbHelper.openWriteLink();
// 从数据库获取任务列表
taskInfos=dbHelper.queryAllTaskInfo();
setList();
}
// 生成任务列表
public void setList(){
if(!taskInfos.isEmpty()){
listItem.clear();
for(taskInfo item:taskInfos){
// 根据日期获取任务
if(item.date.equals(decs)){
HashMap<String,Object> map = new HashMap<>();
// 添加任务内容
map.put("ItemContent", item.content);
// 添加任务开始时间
map.put("ItemStartTime", item.startTime+"-");
// 添加任务结束时间
map.put("ItemEndTime",item.endTime);
// 添加任务完成状态
map.put("ItemISFinished",item.isFinished);
listItem.add(map);
}
}
adapter = new SimpleAdapter(this,
//绑定的数据
listItem,
//每一行的布局
R.layout.taskitem,
//动态数组中的数据源的键映射到布局文件对应的控件中
new String[] {"ItemContent", "ItemStartTime","ItemEndTime","ItemISFinished"},
new int[] {R.id.content, R.id.startTime,R.id.endTime,R.id.isFinished});
lv_task.setAdapter(adapter);
}
}
//显示修改任务的dialog
public void showCustomInputDialog(final int position) {
// 设置任务修改弹窗
mlayoutInflater=LayoutInflater.from(this);
dialogView=mlayoutInflater.inflate(R.layout.dialog, null);
// 注意MainActivity如有自己的布局文件这个dialog是view的布局文件一定要把View写上
dialog_delete =(Button) dialogView.findViewById(R.id.dialog_delete);
dialog_edit =(EditText) dialogView.findViewById(R.id.dialog_edit);
dialog_check =(CheckBox) dialogView.findViewById(R.id.dialog_check);
dialog_delete.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
AlertDialog.Builder builder1=new AlertDialog.Builder(task_show.this);
builder1.setMessage("确定删除?");
builder1.setPositiveButton("确定", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ContentValues values = new ContentValues();
values.put("content" , dialog_edit.getText().toString());
write.delete("taskList","content=?",new String[]{listItem.get(position).get("ItemContent").toString()});
// 重新从数据库获取修改的数据
taskInfos=dbHelper.queryAllTaskInfo();
setList();
Toast.makeText(task_show.this, "删除成功", Toast.LENGTH_SHORT).show();
}
});
builder1.setNegativeButton("取消", null);
builder1.show();
}
});
/*Dialog dialog = new MyDialog(PublishActivity.this,R.style.MyDialog);
dialog.show();*/
AlertDialog.Builder builder=new AlertDialog.Builder(task_show.this);
builder.setView(dialogView);
dialog_edit.setText(listItem.get(position).get("ItemContent").toString());
boolean b=Boolean.parseBoolean(listItem.get(position).get("ItemISFinished").toString());
dialog_check.setChecked(b);
builder.setPositiveButton("保存", new DialogInterface.OnClickListener() {
@Override
public void onClick(DialogInterface dialog, int which) {
ContentValues values = new ContentValues();
values.put("content" , dialog_edit.getText().toString());
values.put("isFinished",dialog_check.isChecked());
write.update("taskList",values,"content=?",new String[]{listItem.get(position).get("ItemContent").toString()});
// 重新从数据库获取修改的数据
taskInfos=dbHelper.queryAllTaskInfo();
setList();
Toast.makeText(task_show.this, "修改成功", Toast.LENGTH_SHORT).show();
}
});
builder.setNegativeButton("取消", null);
builder.show();
}
}

@ -0,0 +1,30 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:aapt="http://schemas.android.com/aapt"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path android:pathData="M31,63.928c0,0 6.4,-11 12.1,-13.1c7.2,-2.6 26,-1.4 26,-1.4l38.1,38.1L107,108.928l-32,-1L31,63.928z">
<aapt:attr name="android:fillColor">
<gradient
android:endX="85.84757"
android:endY="92.4963"
android:startX="42.9492"
android:startY="49.59793"
android:type="linear">
<item
android:color="#44000000"
android:offset="0.0" />
<item
android:color="#00000000"
android:offset="1.0" />
</gradient>
</aapt:attr>
</path>
<path
android:fillColor="#FFFFFF"
android:fillType="nonZero"
android:pathData="M65.3,45.828l3.8,-6.6c0.2,-0.4 0.1,-0.9 -0.3,-1.1c-0.4,-0.2 -0.9,-0.1 -1.1,0.3l-3.9,6.7c-6.3,-2.8 -13.4,-2.8 -19.7,0l-3.9,-6.7c-0.2,-0.4 -0.7,-0.5 -1.1,-0.3C38.8,38.328 38.7,38.828 38.9,39.228l3.8,6.6C36.2,49.428 31.7,56.028 31,63.928h46C76.3,56.028 71.8,49.428 65.3,45.828zM43.4,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2c-0.3,-0.7 -0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C45.3,56.528 44.5,57.328 43.4,57.328L43.4,57.328zM64.6,57.328c-0.8,0 -1.5,-0.5 -1.8,-1.2s-0.1,-1.5 0.4,-2.1c0.5,-0.5 1.4,-0.7 2.1,-0.4c0.7,0.3 1.2,1 1.2,1.8C66.5,56.528 65.6,57.328 64.6,57.328L64.6,57.328z"
android:strokeWidth="1"
android:strokeColor="#00000000" />
</vector>

@ -0,0 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_color_enter" android:state_pressed="true"></item>
</selector>

@ -0,0 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/titleColor" />
<!-- 设置圆角 -->
<corners android:radius="10dp" />
<!-- 设置边框 -->
<stroke
android:width="1px"
android:color="@color/titleColor" />
<!--left to right-->
<!-- <gradient-->
<!-- android:angle="45"-->
<!-- android:endColor="@color/endColor"-->
<!-- android:startColor="@color/startColor" />-->
</shape>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="#b1b1b1" />
<!-- 设置圆角 -->
<corners android:radius="10dp" />
<!-- 设置边框 -->
<stroke
android:width="1px"
android:color="#efefef" />
<!--left to right-->
</shape>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/btn_color" android:state_pressed="false"></item>
<item android:drawable="@drawable/btn_color_enter" android:state_pressed="true"></item>
</selector>

@ -0,0 +1,170 @@
<?xml version="1.0" encoding="utf-8"?>
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="108dp"
android:height="108dp"
android:viewportWidth="108"
android:viewportHeight="108">
<path
android:fillColor="#3DDC84"
android:pathData="M0,0h108v108h-108z" />
<path
android:fillColor="#00000000"
android:pathData="M9,0L9,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,0L19,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,0L29,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,0L39,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,0L49,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,0L59,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,0L69,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,0L79,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M89,0L89,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M99,0L99,108"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,9L108,9"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,19L108,19"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,29L108,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,39L108,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,49L108,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,59L108,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,69L108,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,79L108,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,89L108,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M0,99L108,99"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,29L89,29"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,39L89,39"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,49L89,49"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,59L89,59"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,69L89,69"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M19,79L89,79"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M29,19L29,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M39,19L39,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M49,19L49,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M59,19L59,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M69,19L69,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
<path
android:fillColor="#00000000"
android:pathData="M79,19L79,89"
android:strokeWidth="0.8"
android:strokeColor="#33FFFFFF" />
</vector>

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
<solid android:color="#00c3e1" />
<!-- 设置圆角 -->
<corners android:radius="10dp" />
</shape>

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".add_task">
</androidx.constraintlayout.widget.ConstraintLayout>

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".appTimeUse">
<ListView
android:id="@+id/lv_app"
android:layout_width="wrap_content"
android:layout_height="0dp"
android:layout_weight="1"
></ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp">
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_app_list"
android:text="查看任务清单">
</Button>
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_app_appUse"
android:text="查看应用使用情况">
</Button>
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_app_report"
android:text="查看分析报告">
</Button>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,83 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".login.login"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:layout_marginTop="20dp">
<TextView
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="用户名:"
android:gravity="center"
android:textSize="17sp">
</TextView>
<EditText
android:id="@+id/et_phone"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:hint="请输入用户名"
android:inputType="number"
android:maxLength="11"
>
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_password"
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="密码:"
android:gravity="center"
android:textSize="17sp">
</TextView>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<EditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:hint="请输入密码"
android:inputType="numberPassword"
android:maxLength="8">
</EditText>
<Button
android:id="@+id/btn_forget"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:layout_alignParentEnd="true"
android:layout_marginBottom="2dp"
android:text="忘记密码"
android:textSize="17sp"></Button>
</RelativeLayout>
</LinearLayout>
<CheckBox
android:id="@+id/ck_remember"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="记住密码">
</CheckBox>
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="登录"
android:textSize="20dp"></Button>
</LinearLayout>

@ -0,0 +1,46 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".MainActivity">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="145px"
android:id="@+id/ActionBarList3"
android:orientation="horizontal"
android:layout_alignParentBottom="true"
android:layout_alignParentStart="true"
>
<Button
android:text="Pie"
android:layout_width="0dp"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:background="@drawable/btn_common"
android:id="@+id/PieButton3" />
<Button
android:text="查看应用使用情况"
android:layout_width="0dp"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:textColor="@color/white"
android:background="@drawable/btn_common"
android:id="@+id/app_use"/>
<Button
android:text="List"
android:layout_width="0dp"
android:layout_weight="1.0"
android:layout_height="wrap_content"
android:background="@drawable/btn_common"
android:textColor="@color/white"
android:id="@+id/ListButton3"/>
</LinearLayout>
</RelativeLayout>

@ -0,0 +1,70 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".login.registered"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal"
android:layout_marginTop="20dp">
<TextView
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="用户名:"
android:gravity="center"
android:textSize="17sp">
</TextView>
<EditText
android:id="@+id/et_phone"
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1"
android:hint="请输入用户名"
android:inputType="number"
android:maxLength="11"
>
</EditText>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="60dp"
android:orientation="horizontal">
<TextView
android:id="@+id/tv_password"
android:layout_width="90dp"
android:layout_height="match_parent"
android:text="密码:"
android:gravity="center"
android:textSize="17sp">
</TextView>
<RelativeLayout
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_weight="1">
<EditText
android:id="@+id/et_password"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_weight="1"
android:hint="请输入密码"
android:inputType="numberPassword"
android:maxLength="8">
</EditText>
</RelativeLayout>
</LinearLayout>
<Button
android:id="@+id/btn_login"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="注册"
android:textSize="20dp"></Button>
</LinearLayout>

@ -0,0 +1,87 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".report"
android:orientation="vertical"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp"
>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/title"
android:text="查看分析报告"
android:textSize="20dp">
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="任务数量:"
android:textSize="20dp">
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="任务完成率:"
android:textSize="20dp">
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="任务量趋势:"
android:textSize="20dp">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp">
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_list2"
android:text="查看任务清单">
</Button>
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_appUse2"
android:text="查看应用使用情况">
</Button>
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_report2"
android:text="查看分析报告">
</Button>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".show_task"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:gravity="center"
android:id="@+id/tv"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<ListView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="@+id/lv_task">
</ListView>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/changeDate"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/changeDate"
android:layout_weight="1"
/>
<Button
android:id="@+id/addTask"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="@string/addTask"
android:layout_weight="1"
/>
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,61 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".software_classification">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="30dp"
android:layout_marginTop="30dp">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="软件选择:"
android:gravity="center"
android:textSize="19sp">
</TextView>
<Spinner
android:layout_width="100dp"
android:layout_height="wrap_content"
android:id="@+id/classify1"
android:entries="@array/app"
>
</Spinner>
</LinearLayout>
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginBottom="50dp">
<TextView
android:layout_width="150dp"
android:layout_height="wrap_content"
android:text="软件分类选择:"
android:textSize="19sp"
android:gravity="center">
</TextView>
<Spinner
android:layout_width="100dp"
android:layout_height="wrap_content"
android:id="@+id/classify2"
android:entries="@array/app"
>
</Spinner>
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="确认">
</Button>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,66 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".task_add"
android:orientation="vertical"
android:gravity="center">
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:hint="请输入任务内容"
android:id="@+id/task_content"
>
</EditText>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginTop="10dp"
android:layout_marginBottom="10dp">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_startTime">
</TextView>
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/tv_endTime">
</TextView>
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/StartTime"
android:text="@string/setStartTime"
android:layout_weight="1">
</Button>
<Button
android:layout_width="0dp"
android:layout_height="wrap_content"
android:id="@+id/EndTime"
android:text="@string/setEndTime"
android:layout_weight="1">
</Button>
</LinearLayout>
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="设置完成"
android:layout_marginTop="50dp"
android:id="@+id/btn_down">
</Button>
</LinearLayout>

@ -0,0 +1,89 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:gravity="center_horizontal"
tools:context=".task_show"
android:orientation="vertical"
android:background="@color/basicColor">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:gravity="center"
android:id="@+id/tv"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="15dp"
/>
<ListView
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
android:id="@+id/lv_task">
</ListView>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/changeDate"
android:layout_width="64dp"
android:layout_height="64dp"
android:background="@drawable/btn_common"
android:text="@string/changeDate"
/>
<Button
android:id="@+id/addTask"
android:layout_width="64dp"
android:layout_height="64dp"
android:text="@string/addTask"
android:layout_alignParentEnd="true"
android:background="@drawable/btn_common"
/>
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp"
android:layout_alignParentBottom="true">
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_list"
android:text="查看任务清单">
</Button>
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_appUse"
android:text="查看应用使用情况">
</Button>
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_report"
android:text="查看分析报告">
</Button>
</LinearLayout>
</LinearLayout>
</LinearLayout>

@ -0,0 +1,34 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<ImageView
android:id="@+id/iv_appIcon"
android:layout_width="75dp"
android:layout_height="75dp"
android:layout_margin="5px"
/>
<LinearLayout android:orientation="vertical"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:gravity="center_vertical"
android:layout_alignRight="@+id/iv_appIcon">
<TextView android:id="@+id/label"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:textStyle="bold"
android:textSize="50px"
/>
<TextView android:id="@+id/times"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5px"
android:textSize="45px" />
</LinearLayout>
</LinearLayout>

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="4dp"
android:id="@+id/dialog_check"
>
</CheckBox>
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/dialog_edit">
</EditText>
</LinearLayout>
<Button
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="删除任务"
android:layout_gravity="center"
android:id="@+id/dialog_delete">
</Button>
</LinearLayout>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".appTimeUse">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="123123">
</TextView>
</LinearLayout>

@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/main_activity"
android:orientation="vertical" android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/fg_content"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_weight="1"
>
</FrameLayout>
<RelativeLayout
android:id="@+id/main_tab_bottom"
android:layout_width="match_parent"
android:layout_height="48dp"
android:layout_alignParentBottom="true">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:layout_marginBottom="10dp"
android:layout_marginTop="5dp"
android:layout_alignParentBottom="true">
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_list"
android:text="查看任务清单">
</Button>
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_appUse"
android:text="查看应用使用情况">
</Button>
<Button
android:layout_width="120dp"
android:layout_height="30dp"
android:layout_weight="1"
android:background="@drawable/btn_basic"
android:id="@+id/jump_report"
android:text="查看分析报告">
</Button>
</LinearLayout>
</RelativeLayout>
</LinearLayout>

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".report"
android:orientation="vertical"
android:layout_marginTop="20dp"
android:layout_marginLeft="10dp">
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/title"
android:text="查看分析报告"
android:textSize="20dp">
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="任务数量:"
android:textSize="20dp">
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="任务完成率:"
android:textSize="20dp">
</TextView>
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="任务量趋势:"
android:textSize="20dp">
</TextView>
</LinearLayout>

@ -0,0 +1,44 @@
<?xml version="1.0" encoding="utf-8"?>
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context=".fragment.TaskListFragment">
<!-- TODO: Update blank fragment layout -->
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<TextView
android:gravity="center"
android:id="@+id/tv"
android:textSize="18sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
/>
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:id="@+id/changeDate"
android:layout_width="64dp"
android:layout_height="64dp"
android:background="@drawable/btn_common"
android:text="@string/changeDate"
/>
<Button
android:id="@+id/addTask"
android:layout_width="64dp"
android:layout_height="64dp"
android:text="@string/addTask"
android:layout_alignParentEnd="true"
android:background="@drawable/btn_common"
/>
</RelativeLayout>
</LinearLayout>
</FrameLayout>

@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView android:id="@+id/content"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginRight="50dp"
android:layout_marginTop="5dp"
android:layout_marginLeft="5dp"
android:textSize="18dp"
android:layout_weight="2"
android:textIsSelectable="false"
/>
<TextView android:id="@+id/startTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:textSize="15dp"
android:textIsSelectable="false"
/>
<TextView android:id="@+id/endTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:layout_marginRight="20dp"
android:textSize="15dp"
android:textIsSelectable="false"
/>
<CheckBox
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="3dp"
android:focusable="false"
android:clickable="false"
android:id="@+id/isFinished"
>
</CheckBox>
</LinearLayout>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

@ -0,0 +1,5 @@
<?xml version="1.0" encoding="utf-8"?>
<adaptive-icon xmlns:android="http://schemas.android.com/apk/res/android">
<background android:drawable="@drawable/ic_launcher_background" />
<foreground android:drawable="@drawable/ic_launcher_foreground" />
</adaptive-icon>

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 982 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.8 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 7.6 KiB

@ -0,0 +1,16 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.TimeUse" parent="Theme.MaterialComponents.DayNight.DarkActionBar">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/purple_200</item>
<item name="colorPrimaryVariant">@color/purple_700</item>
<item name="colorOnPrimary">@color/black</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_200</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
</resources>

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string-array name="app">
<item>娱乐</item>
<item>生活</item>
<item>学习</item>
</string-array>
</resources>

@ -0,0 +1,14 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<color name="purple_200">#FFBB86FC</color>
<color name="purple_500">#FF6200EE</color>
<color name="purple_700">#FF3700B3</color>
<color name="teal_200">#FF03DAC5</color>
<color name="teal_700">#FF018786</color>
<color name="black">#FF000000</color>
<color name="white">#FFFFFFFF</color>
<color name="endColor">#5489e7</color>
<color name="startColor">#2cc9df</color>
<color name="basicColor">#ebebeb</color>
<color name="titleColor">#00c3e1</color>
</resources>

@ -0,0 +1,9 @@
<resources>
<string name="app_name">timeUse</string>
<string name="addTask">添加任务</string>
<string name="changeDate">更改日期</string>
<string name="setStartTime">设置任务开始时间</string>
<string name="setEndTime">设置任务结束时间</string>
<!-- TODO: Remove or change this placeholder text -->
<string name="hello_blank_fragment">Hello blank fragment</string>
</resources>

@ -0,0 +1,23 @@
<resources xmlns:tools="http://schemas.android.com/tools">
<!-- Base application theme. -->
<style name="Theme.TimeUse" parent="Theme.MaterialComponents.DayNight.DarkActionBar.Bridge">
<!-- Primary brand color. -->
<item name="colorPrimary">@color/titleColor</item>
<item name="colorPrimaryVariant">@color/endColor</item>
<item name="colorOnPrimary">@color/basicColor</item>
<!-- Secondary brand color. -->
<item name="colorSecondary">@color/teal_200</item>
<item name="colorSecondaryVariant">@color/teal_700</item>
<item name="colorOnSecondary">@color/black</item>
<!-- Status bar color. -->
<item name="android:statusBarColor" tools:targetApi="l">?attr/colorPrimaryVariant</item>
<!-- Customize your theme here. -->
</style>
<style name="AppTheme" parent="Theme.AppCompat.DayNight.DarkActionBar">
<!-- Customize your theme here. -->
<item name="android:windowActionBar">false</item>
<item name="android:windowNoTitle">true</item>
</style>
</resources>

@ -0,0 +1,13 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample backup rules file; uncomment and customize as necessary.
See https://developer.android.com/guide/topics/data/autobackup
for details.
Note: This file is ignored for devices older that API 31
See https://developer.android.com/about/versions/12/backup-restore
-->
<full-backup-content>
<!--
<include domain="sharedpref" path="."/>
<exclude domain="sharedpref" path="device.xml"/>
-->
</full-backup-content>

@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?><!--
Sample data extraction rules file; uncomment and customize as necessary.
See https://developer.android.com/about/versions/12/backup-restore#xml-changes
for details.
-->
<data-extraction-rules>
<cloud-backup>
<!-- TODO: Use <include> and <exclude> to control what is backed up.
<include .../>
<exclude .../>
-->
</cloud-backup>
<!--
<device-transfer>
<include .../>
<exclude .../>
</device-transfer>
-->
</data-extraction-rules>

@ -0,0 +1,17 @@
package com.tanshui.timeuse;
import org.junit.Test;
import static org.junit.Assert.*;
/**
* Example local unit test, which will execute on the development machine (host).
*
* @see <a href="http://d.android.com/tools/testing">Testing documentation</a>
*/
public class ExampleUnitTest {
@Test
public void addition_isCorrect() {
assertEquals(4, 2 + 2);
}
}

@ -0,0 +1,9 @@
// Top-level build file where you can add configuration options common to all sub-projects/modules.
plugins {
id 'com.android.application' version '7.2.2' apply false
id 'com.android.library' version '7.2.2' apply false
}
task clean(type: Delete) {
delete rootProject.buildDir
}

@ -0,0 +1,21 @@
# Project-wide Gradle settings.
# IDE (e.g. Android Studio) users:
# Gradle settings configured through the IDE *will override*
# any settings specified in this file.
# For more details on how to configure your build environment visit
# http://www.gradle.org/docs/current/userguide/build_environment.html
# Specifies the JVM arguments used for the daemon process.
# The setting is particularly useful for tweaking memory settings.
org.gradle.jvmargs=-Xmx2048m -Dfile.encoding=UTF-8
# When configured, Gradle will run in incubating parallel mode.
# This option should only be used with decoupled projects. More details, visit
# http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
# org.gradle.parallel=true
# AndroidX package structure to make it clearer which packages are bundled with the
# Android operating system, and which are packaged with your app"s APK
# https://developer.android.com/topic/libraries/support-library/androidx-rn
android.useAndroidX=true
# Enables namespacing of each library's R class so that its R class includes only the
# resources declared in the library itself and none from the library's dependencies,
# thereby reducing the size of the R class for that library
android.nonTransitiveRClass=true

Binary file not shown.

@ -0,0 +1,6 @@
#Fri Sep 16 13:30:37 CST 2022
distributionBase=GRADLE_USER_HOME
distributionUrl=https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
distributionPath=wrapper/dists
zipStorePath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME

185
src/timeUse/gradlew vendored

@ -0,0 +1,185 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"

@ -0,0 +1,89 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega

@ -0,0 +1,16 @@
pluginManagement {
repositories {
gradlePluginPortal()
google()
mavenCentral()
}
}
dependencyResolutionManagement {
repositoriesMode.set(RepositoriesMode.FAIL_ON_PROJECT_REPOS)
repositories {
google()
mavenCentral()
}
}
rootProject.name = "timeUse"
include ':app'
Loading…
Cancel
Save