diff --git a/app/build.gradle b/app/build.gradle
index 14a21db..acdebc8 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -16,12 +16,9 @@ android {
applicationId "com.uiui.zyos"
minSdkVersion 24
targetSdkVersion 29
- /*TeclastMTK12*/
- versionCode 7
- versionName "1.6"
-// /*展锐*/
-// versionCode 1
-// versionName "1.0"
+
+ versionCode 2
+ versionName "1.1"
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d714e92..05e1f56 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -73,7 +73,7 @@
android:resumeWhilePausing="true"
android:screenOrientation="userLandscape"
android:stateNotNeeded="true"
- android:taskAffinity="com.example.taskaffinity.newtask"
+ android:configChanges="orientation|screenSize|smallestScreenSize|keyboard|keyboardHidden|navigation|touchscreen"
android:windowSoftInputMode="adjustPan">
@@ -90,9 +90,12 @@
android:excludeFromRecents="true"
android:screenOrientation="portrait"
android:theme="@style/activity_styles" />
-
-
+
+
-
-
-
+
@@ -170,7 +171,6 @@
-
-
-
+
lifecycle;
@@ -111,7 +112,9 @@ public class MainAPresenter implements MainContact.Presenter {
AppUsedTimeUtils.getInstance().sendRunningApp(new AppUsedTimeUtils.RunningAppCallback() {
@Override
public void onComplete() {
- mView.sendRunningInfoFinish();
+ if (mView != null) {
+ mView.sendRunningInfoFinish();
+ }
}
});
}
diff --git a/app/src/main/java/com/uiui/zyos/activity/main/MainActivity.java b/app/src/main/java/com/uiui/zyos/activity/main/MainActivity.java
index 77fbed0..1689d20 100644
--- a/app/src/main/java/com/uiui/zyos/activity/main/MainActivity.java
+++ b/app/src/main/java/com/uiui/zyos/activity/main/MainActivity.java
@@ -108,6 +108,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
@Override
public void initView() {
+ Log.e(TAG, "initView: ");
+
ButterKnife.bind(this);
// toggleNotificationListenerService(this);
mPresenter = new MainAPresenter(this);
@@ -146,26 +148,26 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
mSubjectFragment.setPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
- Log.e("mSubjectFragment", "onPageScrolled: position = " + position + " positionOffset = " + positionOffset + " positionOffsetPixels = " + positionOffsetPixels);
+// Log.e("mSubjectFragment", "onPageScrolled: position = " + position + " positionOffset = " + positionOffset + " positionOffsetPixels = " + positionOffsetPixels);
mMagicIndicator.onPageScrolled(position + 1, positionOffset, positionOffsetPixels);
}
@Override
public void onPageSelected(int position) {
- Log.e("mSubjectFragment", "onPageSelected: position = " + position);
+// Log.e("mSubjectFragment", "onPageSelected: position = " + position);
mMagicIndicator.onPageSelected(position + 1);
}
@Override
public void onPageScrollStateChanged(int state) {
- Log.e("mSubjectFragment", "onPageSelected: state = " + state);
+// Log.e("mSubjectFragment", "onPageSelected: state = " + state);
mMagicIndicator.onPageScrollStateChanged(state);
}
});
mViewPager.addOnPageChangeListener(new ViewPager.OnPageChangeListener() {
@Override
public void onPageScrolled(int position, float positionOffset, int positionOffsetPixels) {
- Log.e("mViewPager", "onPageScrolled: position = " + position + " positionOffset = " + positionOffset + " positionOffsetPixels = " + positionOffsetPixels);
+// Log.e("mViewPager", "onPageScrolled: position = " + position + " positionOffset = " + positionOffset + " positionOffsetPixels = " + positionOffsetPixels);
if (!(position == 1 && positionOffsetPixels == 0)) {
if (position <= 1) {
mMagicIndicator.onPageScrolled(position, positionOffset, positionOffsetPixels);
@@ -175,7 +177,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
@Override
public void onPageSelected(int position) {
- Log.e("mViewPager", "onPageSelected: position = " + position);
+// Log.e("mViewPager", "onPageSelected: position = " + position);
if (position <= 1) {
mMagicIndicator.onPageSelected(position);
}
@@ -183,7 +185,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
@Override
public void onPageScrollStateChanged(int state) {
- Log.e("mViewPager", "onPageSelected: state = " + state);
+// Log.e("mViewPager", "onPageSelected: state = " + state);
mMagicIndicator.onPageScrollStateChanged(state);
}
});
diff --git a/app/src/main/java/com/uiui/zyos/activity/more/MoreAppActivity.java b/app/src/main/java/com/uiui/zyos/activity/more/MoreAppActivity.java
new file mode 100644
index 0000000..e908ccd
--- /dev/null
+++ b/app/src/main/java/com/uiui/zyos/activity/more/MoreAppActivity.java
@@ -0,0 +1,82 @@
+package com.uiui.zyos.activity.more;
+
+import android.content.Context;
+import android.util.DisplayMetrics;
+import android.view.View;
+import android.view.WindowManager;
+import android.widget.ImageView;
+import android.widget.TextView;
+
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.uiui.zyos.R;
+import com.uiui.zyos.adapter.AppAdapter;
+import com.uiui.zyos.base.BaseActivity;
+import com.uiui.zyos.bean.DesktopIcon;
+import com.uiui.zyos.view.RecyclerViewSpacesItemDecoration;
+
+import java.util.HashMap;
+import java.util.List;
+
+import butterknife.BindView;
+import butterknife.ButterKnife;
+
+public class MoreAppActivity extends BaseActivity implements MoreContact.MoreView {
+
+ @BindView(R.id.iv_back)
+ ImageView iv_back;
+ @BindView(R.id.recyclerView)
+ RecyclerView recyclerView;
+ @BindView(R.id.tv_appsize)
+ TextView tv_appsize;
+
+ private MorePresenter mPresenter;
+ private AppAdapter mAppAdapter;
+
+
+ @Override
+ public int getLayoutId() {
+ return R.layout.activity_moreapp;
+ }
+
+ @Override
+ public void initView() {
+ ButterKnife.bind(this);
+ mPresenter = new MorePresenter(this);
+ mPresenter.attachView(this);
+ mPresenter.setLifecycle(lifecycleSubject);
+
+ iv_back.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ finish();
+ }
+ });
+ recyclerView.setLayoutManager(new GridLayoutManager(this, 6));
+ HashMap stringIntegerHashMap = new HashMap<>();
+ WindowManager wm = (WindowManager) getSystemService(Context.WINDOW_SERVICE);
+ DisplayMetrics dm = new DisplayMetrics();
+ wm.getDefaultDisplay().getRealMetrics(dm);
+ float density = dm.density; // 屏幕密度(0.75 / 1.0 / 1.5)
+ stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.TOP_DECORATION, (int) (density * 1));//top间距
+ stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.BOTTOM_DECORATION, (int) (density * 1));//底部间距
+ stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.LEFT_DECORATION, (int) (density * 20));//左间距
+ stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.RIGHT_DECORATION, (int) (density * 20));//右间距
+ recyclerView.addItemDecoration(new RecyclerViewSpacesItemDecoration(stringIntegerHashMap));
+ mAppAdapter = new AppAdapter();
+ recyclerView.setAdapter(mAppAdapter);
+
+ }
+
+ @Override
+ public void initData() {
+ mPresenter.getInstalledApp();
+ }
+
+ @Override
+ public void setDesktopIcons(List desktopIcons) {
+ mAppAdapter.setDesktopIcons(desktopIcons);
+ tv_appsize.setText(String.format(getString(R.string.app_size),desktopIcons.size()));
+ }
+}
diff --git a/app/src/main/java/com/uiui/zyos/activity/more/MoreContact.java b/app/src/main/java/com/uiui/zyos/activity/more/MoreContact.java
new file mode 100644
index 0000000..f18f60c
--- /dev/null
+++ b/app/src/main/java/com/uiui/zyos/activity/more/MoreContact.java
@@ -0,0 +1,17 @@
+package com.uiui.zyos.activity.more;
+
+import com.uiui.zyos.base.BasePresenter;
+import com.uiui.zyos.base.BaseView;
+import com.uiui.zyos.bean.DesktopIcon;
+
+import java.util.List;
+
+public class MoreContact {
+ public interface Presenter extends BasePresenter {
+ void getInstalledApp();
+ }
+
+ public interface MoreView extends BaseView {
+ void setDesktopIcons(List desktopIcons);
+ }
+}
diff --git a/app/src/main/java/com/uiui/zyos/activity/more/MorePresenter.java b/app/src/main/java/com/uiui/zyos/activity/more/MorePresenter.java
new file mode 100644
index 0000000..955103f
--- /dev/null
+++ b/app/src/main/java/com/uiui/zyos/activity/more/MorePresenter.java
@@ -0,0 +1,52 @@
+package com.uiui.zyos.activity.more;
+
+import android.content.Context;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+
+import com.trello.rxlifecycle4.android.ActivityEvent;
+import com.uiui.zyos.bean.DesktopIcon;
+import com.uiui.zyos.utils.ApkUtils;
+
+import java.util.ArrayList;
+
+import io.reactivex.rxjava3.subjects.BehaviorSubject;
+
+public class MorePresenter implements MoreContact.Presenter {
+ private static final String TAG = MorePresenter.class.getSimpleName();
+
+ private Context mContext;
+ private MoreContact.MoreView mView;
+
+ private BehaviorSubject lifecycle;
+
+ void setLifecycle(BehaviorSubject lifecycle) {
+ this.lifecycle = lifecycle;
+ }
+
+ public BehaviorSubject getLifecycle() {
+ return lifecycle;
+ }
+
+ MorePresenter(Context context) {
+ this.mContext = context;
+ Log.e(TAG, "MainAPresenter: " + context.getClass());
+ }
+
+ @Override
+ public void attachView(@NonNull MoreContact.MoreView view) {
+ this.mView = view;
+ }
+
+ @Override
+ public void detachView() {
+ this.mView = null;
+ }
+
+ @Override
+ public void getInstalledApp() {
+ ArrayList desktopIcons = ApkUtils.queryFilterAppInfo(mContext);
+ mView.setDesktopIcons(desktopIcons);
+ }
+}
diff --git a/app/src/main/java/com/uiui/zyos/bean/AppUsed.java b/app/src/main/java/com/uiui/zyos/bean/AppUsed.java
new file mode 100644
index 0000000..874a719
--- /dev/null
+++ b/app/src/main/java/com/uiui/zyos/bean/AppUsed.java
@@ -0,0 +1,45 @@
+package com.uiui.zyos.bean;
+
+import androidx.annotation.NonNull;
+
+import com.google.gson.Gson;
+import com.google.gson.JsonParser;
+
+import java.io.Serializable;
+
+public class AppUsed implements Serializable {
+ private static final long serialVersionUID = -317163343719361595L;
+ String packages;
+ long useTime;
+ String app_name;
+
+ public String getPackages() {
+ return packages;
+ }
+
+ public void setPackages(String packages) {
+ this.packages = packages;
+ }
+
+ public long getUseTime() {
+ return useTime;
+ }
+
+ public void setUseTime(long useTime) {
+ this.useTime = useTime;
+ }
+
+ public String getApp_name() {
+ return app_name;
+ }
+
+ public void setApp_name(String app_name) {
+ this.app_name = app_name;
+ }
+
+ @NonNull
+ @Override
+ public String toString() {
+ return JsonParser.parseString(new Gson().toJson(this)).getAsJsonObject().toString();
+ }
+}
diff --git a/app/src/main/java/com/uiui/zyos/fragment/user/UserContact.java b/app/src/main/java/com/uiui/zyos/fragment/user/UserContact.java
index bf4d176..3d60dea 100644
--- a/app/src/main/java/com/uiui/zyos/fragment/user/UserContact.java
+++ b/app/src/main/java/com/uiui/zyos/fragment/user/UserContact.java
@@ -16,12 +16,13 @@ public class UserContact {
void getSnInfo();
void getQrCode();
void getInstalledApp();
-
+ void getAppUsedStatistics();
}
public interface UserView extends BaseView {
void setSnInfo(BaseResponse response);
void setQrCode(Bitmap bitmap);
void setInstalledApp( ArrayList desktopIcons);
+ void setAppUsedStatistics(long time);
}
}
diff --git a/app/src/main/java/com/uiui/zyos/fragment/user/UserFragment.java b/app/src/main/java/com/uiui/zyos/fragment/user/UserFragment.java
index 951840f..7bc12fa 100644
--- a/app/src/main/java/com/uiui/zyos/fragment/user/UserFragment.java
+++ b/app/src/main/java/com/uiui/zyos/fragment/user/UserFragment.java
@@ -27,12 +27,14 @@ import com.bumptech.glide.Glide;
import com.shehuan.niv.NiceImageView;
import com.tencent.mmkv.MMKV;
import com.uiui.zyos.R;
+import com.uiui.zyos.activity.more.MoreAppActivity;
import com.uiui.zyos.adapter.AppAdapter;
import com.uiui.zyos.base.BaseFragment;
import com.uiui.zyos.bean.BaseResponse;
import com.uiui.zyos.bean.DesktopIcon;
import com.uiui.zyos.bean.SnInfo;
import com.uiui.zyos.config.CommonConfig;
+import com.uiui.zyos.manager.RemoteManager;
import com.uiui.zyos.utils.ApkUtils;
import com.uiui.zyos.utils.TimeUtils;
import com.uiui.zyos.utils.ToastUtil;
@@ -93,6 +95,7 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
@BindView(R.id.tv_activation)
TextView tv_activation;
+
private AppAdapter mAppAdapter;
private UserPresenter mPresenter;
@@ -145,7 +148,8 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
@Override
public void fetchData() {
Log.e(TAG, "fetchData: ");
- mPresenter.getSnInfo();
+// mPresenter.getInstalledApp();
+// mPresenter.getSnInfo();
}
@Override
@@ -178,6 +182,9 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
private void initView() {
Log.e(TAG, "initView: ");
+ tv_notification.requestFocus();
+ tv_activated.setOnClickListener(view -> ApkUtils.openPackage(mContext, RemoteManager.SN_PACKAGE_NAME));
+ iv_avatar.setOnClickListener(view -> ApkUtils.openPackage(mContext, RemoteManager.SN_PACKAGE_NAME));
registerOwnReceiver();
String name = mMMKV.decodeString("USERINFO_NAME", "");
if (TextUtils.isEmpty(name)) {
@@ -207,15 +214,21 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
tv_activation.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
- ApkUtils.openPackage(mContext, "com.uiui.zysn");
+ ApkUtils.openPackage(mContext, RemoteManager.SN_PACKAGE_NAME);
}
});
String avatar = mMMKV.decodeString("USERINFO_AVATAR", "");
Glide.with(iv_avatar).load(avatar).error(R.drawable.default_avatar).into(iv_avatar);
tv_date1.setText(TimeUtils.getDateAndWeek(System.currentTimeMillis()));
tv_date2.setText(TimeUtils.getDateAndWeek(System.currentTimeMillis()));
- rv_app.setLayoutManager(new GridLayoutManager(mContext, 4));
+ cl_more.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View view) {
+ startActivity(new Intent(mContext, MoreAppActivity.class));
+ }
+ });
+ rv_app.setLayoutManager(new GridLayoutManager(mContext, 4));
HashMap stringIntegerHashMap = new HashMap<>();
WindowManager wm = (WindowManager) mContext.getSystemService(Context.WINDOW_SERVICE);
DisplayMetrics dm = new DisplayMetrics();
@@ -226,7 +239,6 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.LEFT_DECORATION, (int) (density * 20));//左间距
stringIntegerHashMap.put(RecyclerViewSpacesItemDecoration.RIGHT_DECORATION, (int) (density * 20));//右间距
rv_app.addItemDecoration(new RecyclerViewSpacesItemDecoration(stringIntegerHashMap));
-
mAppAdapter = new AppAdapter();
rv_app.setAdapter(mAppAdapter);
}
@@ -321,6 +333,14 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
rv_app.setVisibility(View.VISIBLE);
mAppAdapter.setDesktopIcons(desktopIcons);
}
+ mPresenter.getAppUsedStatistics();
+ }
+
+ @Override
+ public void setAppUsedStatistics(long time) {
+ Log.e(TAG, "setAppUsedStatistics: " + time);
+ String useTime = TimeUtils.formatTime(time);
+ tv_duration.setText(String.format(getString(R.string.today_study_time), useTime));
}
private void registerOwnReceiver() {
diff --git a/app/src/main/java/com/uiui/zyos/fragment/user/UserPresenter.java b/app/src/main/java/com/uiui/zyos/fragment/user/UserPresenter.java
index afa8230..9e4c9fb 100644
--- a/app/src/main/java/com/uiui/zyos/fragment/user/UserPresenter.java
+++ b/app/src/main/java/com/uiui/zyos/fragment/user/UserPresenter.java
@@ -2,11 +2,14 @@ package com.uiui.zyos.fragment.user;
import android.content.Context;
import android.graphics.Bitmap;
+import android.text.TextUtils;
import android.util.Log;
import com.google.gson.Gson;
import com.google.gson.reflect.TypeToken;
import com.trello.rxlifecycle4.android.FragmentEvent;
+import com.uiui.zyos.BuildConfig;
+import com.uiui.zyos.bean.AppUsed;
import com.uiui.zyos.bean.BaseResponse;
import com.uiui.zyos.bean.DesktopIcon;
import com.uiui.zyos.bean.SnInfo;
@@ -21,6 +24,11 @@ import com.uiui.zyos.utils.Utils;
import java.lang.reflect.Type;
import java.util.ArrayList;
+import java.util.List;
+import java.util.function.Function;
+import java.util.function.Predicate;
+import java.util.function.ToLongFunction;
+import java.util.stream.Collectors;
import io.reactivex.rxjava3.annotations.NonNull;
import io.reactivex.rxjava3.disposables.Disposable;
@@ -102,4 +110,32 @@ public class UserPresenter implements UserContact.Presenter {
ArrayList desktopIcons = ApkUtils.queryFilterAppInfo(mContext);
mView.setInstalledApp(desktopIcons);
}
+
+ @Override
+ public void getAppUsedStatistics() {
+ String jsonString = RemoteManager.getInstance().getAppUsedStatistics();
+ if (TextUtils.isEmpty(jsonString)) {
+ mView.setAppUsedStatistics(0);
+ } else {
+ Gson gson = new Gson();
+ Type listType = new TypeToken>() {
+ }.getType();
+ try {
+ List appUseds = gson.fromJson(jsonString, listType);
+ Log.e(TAG, "getAppUsedStatistics: " + appUseds);
+ List appUseTime = appUseds.stream().filter(new Predicate() {
+ @Override
+ public boolean test(AppUsed appUsed) {
+ return !BuildConfig.APPLICATION_ID.equals(appUsed.getPackages())
+ && !"com.safe.uiui".equals(appUsed.getPackages());
+ }
+ }).collect(Collectors.toList());
+ long time = appUseTime.stream().mapToLong(AppUsed::getUseTime).sum();
+ mView.setAppUsedStatistics(time);
+ } catch (Exception e) {
+ Log.e(TAG, "getAppUsedStatistics: " + e.getMessage());
+ mView.setAppUsedStatistics(0);
+ }
+ }
+ }
}
diff --git a/app/src/main/java/com/uiui/zyos/manager/RemoteManager.java b/app/src/main/java/com/uiui/zyos/manager/RemoteManager.java
index 052a8ad..922bd44 100644
--- a/app/src/main/java/com/uiui/zyos/manager/RemoteManager.java
+++ b/app/src/main/java/com/uiui/zyos/manager/RemoteManager.java
@@ -22,7 +22,7 @@ import com.tencent.mmkv.MMKV;
import com.uiui.zyos.BuildConfig;
import com.uiui.zyos.bean.MapBean;
import com.uiui.zyos.config.CommonConfig;
-import com.uiui.zysn.IGetInfoInterface;
+import com.uiui.zy.IGetInfoInterface;
import java.lang.reflect.Type;
import java.util.ArrayList;
@@ -42,9 +42,9 @@ public class RemoteManager {
private IGetInfoInterface mGetInfoInterface;
private ServiceConnection mServiceConnection;
- private static final String SN_AIDL_NAME = "com.uiui.zysn.IGetInfoInterface";
- private static final String SN_PACKAGE_NAME = "com.uiui.zysn";
- private static final String SN_SERVICE_NAME = "com.uiui.zysn.service.RemoteService";
+ private static final String SN_AIDL_NAME = "com.uiui.zy.IGetInfoInterface";
+ public static final String SN_PACKAGE_NAME = "com.uiui.zy";
+ private static final String SN_SERVICE_NAME = "com.uiui.zy.service.RemoteService";
private RemoteManager(Context context) {
if (context == null) {
@@ -206,6 +206,20 @@ public class RemoteManager {
}
}
+ public String getAppUsedStatistics() {
+ if (mGetInfoInterface != null) {
+ try {
+ String jsonString = mGetInfoInterface.getAppUsedStatistics();
+ return jsonString;
+ } catch (Exception e) {
+ Log.e(TAG, "getAppUsedStatistics: " + e.getMessage());
+ }
+ } else {
+ bindInfoService();
+ }
+ return null;
+ }
+
public MapBean getMapBean() {
String jsonString = mMMKV.decodeString(CommonConfig.MAP_LOCATION_JSON_KEY);
if (TextUtils.isEmpty(jsonString)) {
diff --git a/app/src/main/java/com/uiui/zyos/utils/ApkUtils.java b/app/src/main/java/com/uiui/zyos/utils/ApkUtils.java
index 921685b..386b270 100644
--- a/app/src/main/java/com/uiui/zyos/utils/ApkUtils.java
+++ b/app/src/main/java/com/uiui/zyos/utils/ApkUtils.java
@@ -45,7 +45,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
public class ApkUtils {
private static HashSet excludePackageName = new HashSet() {{
this.add(BuildConfig.APPLICATION_ID);
- this.add("com.uiui.zysn");
+ this.add("com.uiui.zy");
this.add("com.uiui.zyos");
this.add("com.uiui.zybrowser");
this.add("com.uiui.zyappstore");
@@ -151,7 +151,7 @@ public class ApkUtils {
this.add("com.android.gallery3d");
this.add("com.android.camera2");
this.add("com.android.settings");
- this.add("com.uiui.zysn");
+ this.add("com.uiui.zy");
this.add("com.uiui.appstore");
}};
@@ -207,7 +207,7 @@ public class ApkUtils {
}
if (Settings.Global.getInt(context.getContentResolver(), "is_activity", 0) == 0) {
resolveInfos.removeIf(resolveInfo -> "com.uiui.city".equals(resolveInfo.activityInfo.packageName));
-// resolveInfos.removeIf(applicationInfo -> "com.uiui.zysn".equals(applicationInfo.packageName));
+// resolveInfos.removeIf(applicationInfo -> "com.uiui.zy".equals(applicationInfo.packageName));
}
resolveInfos.sort(new Comparator() {
@Override
@@ -227,8 +227,8 @@ public class ApkUtils {
}
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
+ return 0;
}
- return -1;
}
});
ArrayList desktopIcons = new ArrayList<>();
diff --git a/app/src/main/java/com/uiui/zyos/utils/OpenApkUtils.java b/app/src/main/java/com/uiui/zyos/utils/OpenApkUtils.java
index 6e2427c..d325772 100644
--- a/app/src/main/java/com/uiui/zyos/utils/OpenApkUtils.java
+++ b/app/src/main/java/com/uiui/zyos/utils/OpenApkUtils.java
@@ -55,7 +55,7 @@ public class OpenApkUtils {
private boolean checkActivation() {
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
if (is_activation != 1) {
- ApkUtils.openPackage(mContext, "com.uiui.zysn");
+ ApkUtils.openPackage(mContext, "com.uiui.zy");
ToastUtil.show("请激活设备后使用");
}
return is_activation == 1;
@@ -103,7 +103,7 @@ public class OpenApkUtils {
* @return true为能打开
*/
public boolean isCloudLessonMod(String pkg) {
- if (mLessonJson==null)
+ if (mLessonJson == null)
return true;
if (mLessonJson.getIs_lesson() == 1) {
if (mContralTime == null) {
diff --git a/app/src/main/java/com/uiui/zyos/utils/TimeUtils.java b/app/src/main/java/com/uiui/zyos/utils/TimeUtils.java
index ecaff2f..d6f43be 100644
--- a/app/src/main/java/com/uiui/zyos/utils/TimeUtils.java
+++ b/app/src/main/java/com/uiui/zyos/utils/TimeUtils.java
@@ -49,6 +49,41 @@ public class TimeUtils {
return dateString + "\t" + getWeek();
}
+ public static String formatTime(Long s) {
+ if (s == 0) {
+ return "0分钟";
+ }
+ Integer ss = 1;
+ Integer mi = ss * 60;
+ Integer hh = mi * 60;
+ Integer dd = hh * 24;
+
+ Long day = s / dd;
+ Long hour = (s - day * dd) / hh;
+ Long minute = (s - day * dd - hour * hh) / mi;
+ Long second = (s - day * dd - hour * hh - minute * mi) / ss;
+ Long milliSecond = s - day * dd - hour * hh - minute * mi - second * ss;
+
+ StringBuffer sb = new StringBuffer();
+ if (day > 0) {
+ sb.append(day + "天");
+ }
+ if (hour > 0) {
+ sb.append(hour + "小时");
+ }
+ if (minute > 0) {
+ sb.append(minute + "分");
+ }
+ if (second > 0) {
+ sb.append(second + "秒");
+ }
+// if (milliSecond > 0) {
+// sb.append(milliSecond + "毫秒");
+// }
+ return sb.toString();
+ }
+
+
/**
* 是否在管控时间内
*
diff --git a/app/src/main/res/drawable-hdpi/exit.png b/app/src/main/res/drawable-hdpi/exit.png
new file mode 100644
index 0000000..8ac4207
Binary files /dev/null and b/app/src/main/res/drawable-hdpi/exit.png differ
diff --git a/app/src/main/res/layout-land/fragment_user.xml b/app/src/main/res/layout-land/fragment_user.xml
index ada21b0..71bd5cf 100644
--- a/app/src/main/res/layout-land/fragment_user.xml
+++ b/app/src/main/res/layout-land/fragment_user.xml
@@ -79,7 +79,11 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_4"
android:layout_marginEnd="@dimen/dp_32"
- android:maxLines="1"
+ android:ellipsize="marquee"
+ android:focusable="true"
+ android:focusableInTouchMode="true"
+ android:marqueeRepeatLimit="marquee_forever"
+ android:singleLine="true"
android:text="@string/tips"
android:textColor="@color/lightGray"
android:textSize="@dimen/sp_8"
@@ -229,7 +233,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_8"
android:maxLines="1"
- android:text="今日学习时间"
+ android:text="@string/today_study_time"
android:textColor="@color/white"
android:textSize="@dimen/sp_8"
app:layout_constraintEnd_toEndOf="parent"
@@ -356,7 +360,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_16"
android:gravity="center_horizontal"
- android:text="第二步\n通过小程序扫码绑定设备"
+ android:text="第二步\n扫码绑定设备"
android:textColor="@color/white"
android:textSize="@dimen/sp_8"
app:layout_constraintEnd_toEndOf="@+id/iv_device_qrcode"
@@ -421,6 +425,8 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="@dimen/dp_8"
+ android:scrollbars="vertical"
+ android:fadeScrollbars="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_date2" />
diff --git a/app/src/main/res/layout-port/dialog_chinese.xml b/app/src/main/res/layout-port/dialog_chinese.xml
deleted file mode 100644
index 6727563..0000000
--- a/app/src/main/res/layout-port/dialog_chinese.xml
+++ /dev/null
@@ -1,115 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/dialog_english_basics.xml b/app/src/main/res/layout-port/dialog_english_basics.xml
deleted file mode 100644
index e4b5aae..0000000
--- a/app/src/main/res/layout-port/dialog_english_basics.xml
+++ /dev/null
@@ -1,357 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/dialog_foundation.xml b/app/src/main/res/layout-port/dialog_foundation.xml
deleted file mode 100644
index 1a70e82..0000000
--- a/app/src/main/res/layout-port/dialog_foundation.xml
+++ /dev/null
@@ -1,192 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_biology.xml b/app/src/main/res/layout-port/fragment_biology.xml
deleted file mode 100644
index d458f33..0000000
--- a/app/src/main/res/layout-port/fragment_biology.xml
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_chemical.xml b/app/src/main/res/layout-port/fragment_chemical.xml
deleted file mode 100644
index e9c0380..0000000
--- a/app/src/main/res/layout-port/fragment_chemical.xml
+++ /dev/null
@@ -1,136 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_chinese.xml b/app/src/main/res/layout-port/fragment_chinese.xml
deleted file mode 100644
index f5da555..0000000
--- a/app/src/main/res/layout-port/fragment_chinese.xml
+++ /dev/null
@@ -1,557 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_complex.xml b/app/src/main/res/layout-port/fragment_complex.xml
deleted file mode 100644
index 77a03a8..0000000
--- a/app/src/main/res/layout-port/fragment_complex.xml
+++ /dev/null
@@ -1,517 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_english.xml b/app/src/main/res/layout-port/fragment_english.xml
deleted file mode 100644
index 31cf328..0000000
--- a/app/src/main/res/layout-port/fragment_english.xml
+++ /dev/null
@@ -1,158 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_main.xml b/app/src/main/res/layout-port/fragment_main.xml
deleted file mode 100644
index 21fed49..0000000
--- a/app/src/main/res/layout-port/fragment_main.xml
+++ /dev/null
@@ -1,297 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_math.xml b/app/src/main/res/layout-port/fragment_math.xml
deleted file mode 100644
index a851ffd..0000000
--- a/app/src/main/res/layout-port/fragment_math.xml
+++ /dev/null
@@ -1,510 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_physics.xml b/app/src/main/res/layout-port/fragment_physics.xml
deleted file mode 100644
index f4b99df..0000000
--- a/app/src/main/res/layout-port/fragment_physics.xml
+++ /dev/null
@@ -1,135 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_precision.xml b/app/src/main/res/layout-port/fragment_precision.xml
deleted file mode 100644
index 3131f53..0000000
--- a/app/src/main/res/layout-port/fragment_precision.xml
+++ /dev/null
@@ -1,129 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_subject.xml b/app/src/main/res/layout-port/fragment_subject.xml
deleted file mode 100644
index 3f9b01f..0000000
--- a/app/src/main/res/layout-port/fragment_subject.xml
+++ /dev/null
@@ -1,38 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/fragment_user.xml b/app/src/main/res/layout-port/fragment_user.xml
deleted file mode 100644
index f11fee3..0000000
--- a/app/src/main/res/layout-port/fragment_user.xml
+++ /dev/null
@@ -1,445 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-port/activity_main.xml b/app/src/main/res/layout-sw800dp/activity_main.xml
similarity index 99%
rename from app/src/main/res/layout-port/activity_main.xml
rename to app/src/main/res/layout-sw800dp/activity_main.xml
index 1eafadc..b676c01 100644
--- a/app/src/main/res/layout-port/activity_main.xml
+++ b/app/src/main/res/layout-sw800dp/activity_main.xml
@@ -34,7 +34,7 @@
android:id="@+id/constraintLayout2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginBottom="@dimen/dp_2"
+ android:layout_marginBottom="@dimen/dp_8"
android:background="@drawable/custom_bg_ai"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
@@ -45,8 +45,8 @@
android:layout_height="match_parent"
android:layout_marginTop="@dimen/dp_4"
android:layout_marginEnd="@dimen/dp_4"
- android:layout_marginStart="@dimen/dp_4"
android:layout_marginBottom="@dimen/dp_2"
+ android:layout_marginStart="@dimen/dp_4"
android:orientation="horizontal"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
diff --git a/app/src/main/res/layout-sw800dp/fragment_biology.xml b/app/src/main/res/layout-sw800dp/fragment_biology.xml
index 900f270..61ed1d8 100644
--- a/app/src/main/res/layout-sw800dp/fragment_biology.xml
+++ b/app/src/main/res/layout-sw800dp/fragment_biology.xml
@@ -22,8 +22,8 @@
@@ -73,8 +73,8 @@
android:layout_height="match_parent">
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/app/src/main/res/layout-sw800dp/fragment_math.xml b/app/src/main/res/layout-sw800dp/fragment_math.xml
index d5de6da..1666004 100644
--- a/app/src/main/res/layout-sw800dp/fragment_math.xml
+++ b/app/src/main/res/layout-sw800dp/fragment_math.xml
@@ -21,8 +21,8 @@
-
-
@@ -219,7 +222,7 @@
android:maxLines="1"
android:text="学习时长超过同用户"
android:textColor="@color/white"
- android:textSize="@dimen/sp_8"
+ android:textSize="@dimen/sp_7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_percent" />
@@ -232,7 +235,7 @@
android:maxLines="1"
android:text="今日学习时间"
android:textColor="@color/white"
- android:textSize="@dimen/sp_8"
+ android:textSize="@dimen/sp_7"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/textView5" />
@@ -280,9 +283,9 @@
android:paddingEnd="@dimen/dp_6"
android:paddingBottom="@dimen/dp_2"
android:text="输入激活码"
- android:visibility="gone"
android:textColor="@color/white"
android:textSize="@dimen/sp_8"
+ android:visibility="gone"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -357,7 +360,7 @@
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/dp_12"
android:gravity="center_horizontal"
- android:text="第二步\n通过小程序扫码绑定设备"
+ android:text="第二步\n扫码绑定设备"
android:textColor="@color/white"
android:textSize="@dimen/sp_6"
app:layout_constraintEnd_toEndOf="@+id/iv_device_qrcode"
@@ -376,12 +379,12 @@
android:id="@+id/tv_date2"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
- android:layout_marginStart="@dimen/dp_8"
- android:layout_marginTop="@dimen/dp_8"
+ android:layout_marginStart="@dimen/dp_6"
+ android:layout_marginTop="@dimen/dp_6"
android:maxLines="1"
android:text="2月14日 星期二"
android:textColor="@color/white"
- android:textSize="@dimen/sp_12"
+ android:textSize="@dimen/sp_7"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
@@ -395,8 +398,8 @@
@@ -422,6 +425,8 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_margin="@dimen/dp_8"
+ android:scrollbars="vertical"
+ android:fadeScrollbars="false"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/tv_date2" />
diff --git a/app/src/main/res/layout/activity_moreapp.xml b/app/src/main/res/layout/activity_moreapp.xml
new file mode 100644
index 0000000..3b4ff7c
--- /dev/null
+++ b/app/src/main/res/layout/activity_moreapp.xml
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index e946bee..107736f 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -14,5 +14,7 @@
Hello blank fragment
努力不为感动谁,只为不与最好的自己失之交臂。趁着最美好的年华,继续奋斗吧。
+ %d款应用
+ 今日学习时间%s