version:1.1
fix: update:优化
This commit is contained in:
@@ -22,8 +22,9 @@ import io.reactivex.rxjava3.subjects.BehaviorSubject;
|
||||
|
||||
public class MainAPresenter implements MainContact.Presenter {
|
||||
private static final String TAG = MainAPresenter.class.getSimpleName();
|
||||
private MainContact.MainView mView;
|
||||
|
||||
private Context mContext;
|
||||
private MainContact.MainView mView;
|
||||
|
||||
private BehaviorSubject<ActivityEvent> 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();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -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<String, Integer> 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<DesktopIcon> desktopIcons) {
|
||||
mAppAdapter.setDesktopIcons(desktopIcons);
|
||||
tv_appsize.setText(String.format(getString(R.string.app_size),desktopIcons.size()));
|
||||
}
|
||||
}
|
||||
@@ -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<MoreView> {
|
||||
void getInstalledApp();
|
||||
}
|
||||
|
||||
public interface MoreView extends BaseView {
|
||||
void setDesktopIcons(List<DesktopIcon> desktopIcons);
|
||||
}
|
||||
}
|
||||
@@ -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<ActivityEvent> lifecycle;
|
||||
|
||||
void setLifecycle(BehaviorSubject<ActivityEvent> lifecycle) {
|
||||
this.lifecycle = lifecycle;
|
||||
}
|
||||
|
||||
public BehaviorSubject<ActivityEvent> 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<DesktopIcon> desktopIcons = ApkUtils.queryFilterAppInfo(mContext);
|
||||
mView.setDesktopIcons(desktopIcons);
|
||||
}
|
||||
}
|
||||
45
app/src/main/java/com/uiui/zyos/bean/AppUsed.java
Normal file
45
app/src/main/java/com/uiui/zyos/bean/AppUsed.java
Normal file
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -16,12 +16,13 @@ public class UserContact {
|
||||
void getSnInfo();
|
||||
void getQrCode();
|
||||
void getInstalledApp();
|
||||
|
||||
void getAppUsedStatistics();
|
||||
}
|
||||
|
||||
public interface UserView extends BaseView {
|
||||
void setSnInfo(BaseResponse<SnInfo> response);
|
||||
void setQrCode(Bitmap bitmap);
|
||||
void setInstalledApp( ArrayList<DesktopIcon> desktopIcons);
|
||||
void setAppUsedStatistics(long time);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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<String, Integer> 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() {
|
||||
|
||||
@@ -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<DesktopIcon> 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<List<AppUsed>>() {
|
||||
}.getType();
|
||||
try {
|
||||
List<AppUsed> appUseds = gson.fromJson(jsonString, listType);
|
||||
Log.e(TAG, "getAppUsedStatistics: " + appUseds);
|
||||
List<AppUsed> appUseTime = appUseds.stream().filter(new Predicate<AppUsed>() {
|
||||
@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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
@@ -45,7 +45,7 @@ import io.reactivex.rxjava3.schedulers.Schedulers;
|
||||
public class ApkUtils {
|
||||
private static HashSet<String> excludePackageName = new HashSet<String>() {{
|
||||
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<ResolveInfo>() {
|
||||
@Override
|
||||
@@ -227,8 +227,8 @@ public class ApkUtils {
|
||||
}
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
return 0;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
});
|
||||
ArrayList<DesktopIcon> desktopIcons = new ArrayList<>();
|
||||
|
||||
@@ -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) {
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 是否在管控时间内
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user