version:1.3.5
fix: update:增加学习资源下载,修复退出桌面再进入卡顿,增加语音助手
This commit is contained in:
169
app/src/main/java/com/uiui/zyos/activity/ScreenLockActivity.java
Normal file
169
app/src/main/java/com/uiui/zyos/activity/ScreenLockActivity.java
Normal file
@@ -0,0 +1,169 @@
|
||||
package com.uiui.zyos.activity;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
import android.view.inputmethod.InputMethodManager;
|
||||
import android.widget.Button;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.TextView;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.tuo.customview.VerificationCodeView;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.base.BaseActivity;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
|
||||
import butterknife.BindView;
|
||||
import butterknife.ButterKnife;
|
||||
|
||||
public class ScreenLockActivity extends BaseActivity {
|
||||
|
||||
private static final String TAG = ScreenLockActivity.class.getSimpleName();
|
||||
|
||||
@BindView(R.id.bt_0)
|
||||
Button bt0;
|
||||
@BindView(R.id.bt_1)
|
||||
Button bt1;
|
||||
@BindView(R.id.bt_2)
|
||||
Button bt2;
|
||||
@BindView(R.id.bt_3)
|
||||
Button bt3;
|
||||
@BindView(R.id.bt_4)
|
||||
Button bt4;
|
||||
@BindView(R.id.bt_5)
|
||||
Button bt5;
|
||||
@BindView(R.id.bt_6)
|
||||
Button bt6;
|
||||
@BindView(R.id.bt_7)
|
||||
Button bt7;
|
||||
@BindView(R.id.bt_8)
|
||||
Button bt8;
|
||||
@BindView(R.id.bt_9)
|
||||
Button bt9;
|
||||
@BindView(R.id.bt_del)
|
||||
Button bt_del;
|
||||
@BindView(R.id.bt_confirm)
|
||||
Button bt_confirm;
|
||||
|
||||
@BindView(R.id.textView)
|
||||
TextView textView;
|
||||
@BindView(R.id.tv_hint)
|
||||
TextView tv_hint;
|
||||
@BindView(R.id.ll_keyboard)
|
||||
LinearLayout ll_keyboard;
|
||||
@BindView(R.id.icv)
|
||||
VerificationCodeView codeView;
|
||||
|
||||
@Override
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
getWindow().addFlags(WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLayoutId() {
|
||||
return R.layout.activity_screen_lock;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView() {
|
||||
ButterKnife.bind(this);
|
||||
InputMethodManager imm = (InputMethodManager) ScreenLockActivity.this.getSystemService(Context.INPUT_METHOD_SERVICE);
|
||||
imm.hideSoftInputFromWindow(codeView.getWindowToken(), 0);
|
||||
codeView.getEditText().setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
ll_keyboard.setVisibility(View.VISIBLE);
|
||||
}
|
||||
});
|
||||
codeView.setInputCompleteListener(new VerificationCodeView.InputCompleteListener() {
|
||||
@Override
|
||||
public void inputComplete() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void deleteContent() {
|
||||
|
||||
}
|
||||
});
|
||||
|
||||
bt_del.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
tv_hint.setText("");
|
||||
codeView.clearInputContent();
|
||||
}
|
||||
});
|
||||
bt_confirm.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
String content = codeView.getInputContent();
|
||||
if (TextUtils.isEmpty(content)) {
|
||||
return;
|
||||
}
|
||||
Log.e(TAG, "inputComplete: " + content);
|
||||
String password = Settings.Global.getString(getContentResolver(), CommonConfig.DEFAULT_PASSWORD);
|
||||
if ((!TextUtils.isEmpty(content) && !TextUtils.isEmpty(password))) {
|
||||
if (password.equals(content)) {
|
||||
exitDesktop();
|
||||
} else {
|
||||
tv_hint.setText("密码错误");
|
||||
}
|
||||
} else if (CommonConfig.DEFAULT_PASSWORD.equals(content)) {
|
||||
exitDesktop();
|
||||
} else {
|
||||
// ToastUtil.show("密码错误");
|
||||
tv_hint.setText("密码错误");
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
bt0.setOnClickListener(view1 -> add(codeView, "0"));
|
||||
bt1.setOnClickListener(view1 -> add(codeView, "1"));
|
||||
bt2.setOnClickListener(view1 -> add(codeView, "2"));
|
||||
bt3.setOnClickListener(view1 -> add(codeView, "3"));
|
||||
bt4.setOnClickListener(view1 -> add(codeView, "4"));
|
||||
bt5.setOnClickListener(view1 -> add(codeView, "5"));
|
||||
bt6.setOnClickListener(view1 -> add(codeView, "6"));
|
||||
bt7.setOnClickListener(view1 -> add(codeView, "7"));
|
||||
bt8.setOnClickListener(view1 -> add(codeView, "8"));
|
||||
bt9.setOnClickListener(view1 -> add(codeView, "9"));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initData() {
|
||||
|
||||
}
|
||||
|
||||
private void add(VerificationCodeView codeView, String text) {
|
||||
Log.e(TAG, "add: text = " + text);
|
||||
String oldText = codeView.getEditText().getText().toString();
|
||||
Log.e(TAG, "add: " + oldText);
|
||||
codeView.getEditText().setText(text);
|
||||
}
|
||||
|
||||
private void exitDesktop() {
|
||||
RemoteManager.getInstance().setDefaultDesktop(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
|
||||
if (Build.VERSION.SDK_INT> Build.VERSION_CODES.Q) {
|
||||
if (!ApkUtils.openPackage(this, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_Quickstep_CLASS_NAME)) {
|
||||
ApkUtils.gotoLauncher(this);
|
||||
}
|
||||
}else {
|
||||
if (!ApkUtils.openPackage(this, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_CLASS_NAME)) {
|
||||
ApkUtils.gotoLauncher(this);
|
||||
}
|
||||
}
|
||||
this.finish();
|
||||
System.exit(0);
|
||||
}
|
||||
}
|
||||
@@ -21,6 +21,7 @@ import android.view.KeyEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Animation;
|
||||
import android.view.animation.TranslateAnimation;
|
||||
import android.widget.ImageView;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.constraintlayout.widget.ConstraintLayout;
|
||||
@@ -43,6 +44,7 @@ import com.uiui.zyos.fragment.user.UserFragment;
|
||||
import com.uiui.zyos.jxw.JxwPackageConfig;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.service.NotificationService;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.utils.HomeWatcher;
|
||||
import com.uiui.zyos.utils.OpenApkUtils;
|
||||
import com.uiui.zyos.utils.ToastUtil;
|
||||
@@ -85,6 +87,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
@BindView(R.id.cl_7)
|
||||
ConstraintLayout cl_7;
|
||||
|
||||
@BindView(R.id.iv_robot)
|
||||
ImageView iv_robot;
|
||||
|
||||
private MMKV mMMKV = MMKV.mmkvWithID(CommonConfig.MMKV_ID, MMKV.MULTI_PROCESS_MODE);
|
||||
|
||||
@@ -127,9 +131,8 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
mFragments.add(mSubjectFragment);
|
||||
mBaseFragmentPagerAdapter = new BaseFragmentPagerAdapter(mFragmentManager, mFragments);
|
||||
|
||||
|
||||
mViewPager.setAdapter(mBaseFragmentPagerAdapter);
|
||||
mViewPager.setOffscreenPageLimit(2);
|
||||
mViewPager.setOffscreenPageLimit(4);
|
||||
mViewPager.setCurrentItem(defaultCurrent);
|
||||
|
||||
scaleCircleNavigator = new ScaleCircleNavigator(this);
|
||||
@@ -194,7 +197,12 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
mViewPager.setCurrentItem(defaultCurrent);
|
||||
mMagicIndicator.onPageSelected(defaultCurrent);
|
||||
}
|
||||
|
||||
iv_robot.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
OpenApkUtils.getInstance().openAppWithoutArgs(JxwPackageConfig.JXW_VOICE_PACKAGE_NAME, JxwPackageConfig.JXW_VOICE_CLASS_NAME);
|
||||
}
|
||||
});
|
||||
cl_0.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
@@ -255,7 +263,12 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
@Override
|
||||
public void onConnected() {
|
||||
Log.e(TAG, "onConnected: ");
|
||||
RemoteManager.getInstance().setDefaultDesktop(BuildConfig.APPLICATION_ID);
|
||||
int is_activation = Settings.Global.getInt(getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
if (is_activation == 0) {
|
||||
RemoteManager.getInstance().setDefaultDesktop(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
|
||||
} else {
|
||||
RemoteManager.getInstance().setDefaultDesktop(BuildConfig.APPLICATION_ID);
|
||||
}
|
||||
}
|
||||
|
||||
public static void toggleNotificationListenerService(Context context) {
|
||||
@@ -366,7 +379,7 @@ public class MainActivity extends BaseActivity implements MainContact.MainView,
|
||||
|
||||
@Override
|
||||
protected void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
// super.onSaveInstanceState(outState);
|
||||
Log.e(TAG, "onSaveInstanceState: ");
|
||||
Log.e(TAG, "onSaveInstanceState: " + System.currentTimeMillis());
|
||||
}
|
||||
|
||||
@@ -44,6 +44,8 @@ public class BaseApplication extends Application {
|
||||
}
|
||||
|
||||
private void init() {
|
||||
if (BuildConfig.DEBUG) {
|
||||
}
|
||||
if (SystemUtils.isMainProcessName(this, android.os.Process.myPid())) {
|
||||
String rootDir = MMKV.initialize(this);
|
||||
Log.e(TAG, "mmkv root: " + rootDir);
|
||||
|
||||
@@ -28,7 +28,8 @@ public class SnInfo implements Serializable {
|
||||
String mobile;
|
||||
String avatar;
|
||||
long binding_time;
|
||||
|
||||
long study_time;
|
||||
String study_time_ranking;
|
||||
|
||||
/*
|
||||
*3 商用——企业用户
|
||||
@@ -193,6 +194,22 @@ public class SnInfo implements Serializable {
|
||||
this.type_id = type_id;
|
||||
}
|
||||
|
||||
public Long getStudy_time() {
|
||||
return study_time;
|
||||
}
|
||||
|
||||
public void setStudy_time(long study_time) {
|
||||
this.study_time = study_time;
|
||||
}
|
||||
|
||||
public String getStudy_time_ranking() {
|
||||
return study_time_ranking;
|
||||
}
|
||||
|
||||
public void setStudy_time_ranking(String study_time_ranking) {
|
||||
this.study_time_ranking = study_time_ranking;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
@@ -9,7 +9,7 @@ public class CommonConfig {
|
||||
public static final String AES_KEY = "xqdep8exnafpef3d";
|
||||
|
||||
public static final String LOCK_SCREEN_PASSWORD ="Iflytek_lockScreenPasswordKey";
|
||||
public static final String DEFAULT_PASSWORD = "0728";
|
||||
public static final String DEFAULT_PASSWORD = "666666";
|
||||
|
||||
/*是否激活接口请求缓存*/
|
||||
public static final String ACTIVATIONBEAN_KEY = "IFLYTEK_UIUI_ACTIVATIONBEAN_KEY";
|
||||
@@ -29,4 +29,6 @@ public class CommonConfig {
|
||||
public static final String MAP_ERROR_KEY = "map_error_key";
|
||||
|
||||
public static final String SETTING_OTHER_APPINSTALLER_KEY = "setting_other_appInstaller";
|
||||
/*应用市场的app列表*/
|
||||
public final static String ADMIN_APP_LIST = "only_admin_app_list";
|
||||
}
|
||||
|
||||
@@ -44,7 +44,7 @@ public class SubjectFragment extends BaseFragment {
|
||||
@BindView(R.id.viewPager)
|
||||
ViewPager mViewPager;
|
||||
|
||||
private String[] title = new String[]{"精准学", "语文", "数学", "英语", "物理", "化学", "生物", "综合",};
|
||||
private String[] title = new String[]{"AI精准学", "语文", "数学", "英语", "物理", "化学", "生物", "综合",};
|
||||
|
||||
private View rootView;
|
||||
private FragmentActivity mContext;
|
||||
@@ -75,6 +75,8 @@ public class SubjectFragment extends BaseFragment {
|
||||
public SubjectFragment() {
|
||||
// Required empty public constructor
|
||||
Log.e(TAG, "SubjectFragment: ");
|
||||
long time = System.currentTimeMillis();
|
||||
Log.e(TAG, "SubjectFragment: start " + time);
|
||||
mFragments = new ArrayList<>();
|
||||
mPrecisionFragment = new PrecisionFragment();
|
||||
mChineseFragment = new ChineseFragment();
|
||||
@@ -92,6 +94,7 @@ public class SubjectFragment extends BaseFragment {
|
||||
mFragments.add(mChemicalFragment);
|
||||
mFragments.add(mBiologyFragment);
|
||||
mFragments.add(mComplexFragment);
|
||||
Log.e(TAG, "SubjectFragment: end = " + (System.currentTimeMillis() - time));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -167,11 +170,15 @@ public class SubjectFragment extends BaseFragment {
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
long time = System.currentTimeMillis();
|
||||
Log.e(TAG, "initView: start " + time);
|
||||
mFragmentManager = getChildFragmentManager();
|
||||
mBaseFragmentPagerAdapter = new BaseFragmentPagerAdapter(mFragmentManager, mFragments);
|
||||
mViewPager.setAdapter(mBaseFragmentPagerAdapter);
|
||||
mViewPager.setOffscreenPageLimit(8);
|
||||
mViewPager.setOffscreenPageLimit(10);
|
||||
mViewPager.setOnPageChangeListener(mListener);
|
||||
main_sliding_tab_layout.setViewPager(mViewPager, title);
|
||||
Log.e(TAG, "initView: end = " + (System.currentTimeMillis() - time));
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ 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.ScreenLockActivity;
|
||||
import com.uiui.zyos.activity.more.MoreAppActivity;
|
||||
import com.uiui.zyos.adapter.AppAdapter;
|
||||
import com.uiui.zyos.base.BaseFragment;
|
||||
@@ -36,8 +37,11 @@ import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.bean.SnInfo;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.dialog.PasswordDialog;
|
||||
import com.uiui.zyos.dialog.SingleDialog;
|
||||
import com.uiui.zyos.jxw.JxwPackageConfig;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.utils.ApkUtils;
|
||||
import com.uiui.zyos.utils.OpenApkUtils;
|
||||
import com.uiui.zyos.utils.TimeUtils;
|
||||
import com.uiui.zyos.utils.ToastUtil;
|
||||
import com.uiui.zyos.view.RecyclerViewSpacesItemDecoration;
|
||||
@@ -76,6 +80,8 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
|
||||
TextView tv_percent;
|
||||
@BindView(R.id.tv_activated)
|
||||
TextView tv_activated;
|
||||
@BindView(R.id.tv_activated2)
|
||||
TextView tv_activated2;
|
||||
@BindView(R.id.tv_duration)
|
||||
TextView tv_duration;
|
||||
@BindView(R.id.cl_activation)
|
||||
@@ -187,7 +193,16 @@ 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, "com.uiui.zy", "com.uiui.zy.activity.main.MainActivity"));
|
||||
tv_activated2.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
OpenApkUtils.getInstance().openAppWithoutArgs(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME, JxwPackageConfig.JXW_LAUNCHER_UPDATE_CLASS_NAME);
|
||||
}
|
||||
});
|
||||
tv_activated.setOnClickListener(view -> {
|
||||
// ApkUtils.openPackage(mContext, "com.uiui.zy", "com.uiui.zy.activity.main.MainActivity");
|
||||
OpenApkUtils.getInstance().openAppWithoutArgs(JxwPackageConfig.JXW_LAUNCHER_PACKAGE_NAME, JxwPackageConfig.JXW_LAUNCHER_UPDATE_CLASS_NAME);
|
||||
});
|
||||
iv_avatar.setOnClickListener(view -> ApkUtils.openPackage(mContext, "com.uiui.zy", "com.uiui.zy.activity.main.MainActivity"));
|
||||
registerOwnReceiver();
|
||||
String name = mMMKV.decodeString("USERINFO_NAME", "");
|
||||
@@ -216,7 +231,13 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
|
||||
Intent intent = new Intent("Receiver_Refresh_Password_Action");
|
||||
intent.setPackage("com.uiui.zy");
|
||||
mContext.sendBroadcast(intent);
|
||||
showPassword();
|
||||
|
||||
int is_activation = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_ACTIVATION_KEY, 0);
|
||||
if (is_activation == 1) {
|
||||
showPassword();
|
||||
} else {
|
||||
exitDesktop();
|
||||
}
|
||||
}
|
||||
});
|
||||
tv_activation.setOnClickListener(new View.OnClickListener() {
|
||||
@@ -251,38 +272,58 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
|
||||
rv_app.setAdapter(mAppAdapter);
|
||||
}
|
||||
|
||||
private void showPassword() {
|
||||
PasswordDialog passwordDialog = new PasswordDialog(mContext);
|
||||
passwordDialog.setTitle("退出智慧课堂");
|
||||
passwordDialog.setOnClickBottomListener(new PasswordDialog.OnClickBottomListener() {
|
||||
private void showSingleDialog() {
|
||||
SingleDialog singleDialog = new SingleDialog(mContext);
|
||||
singleDialog.setTitle("温馨提示");
|
||||
singleDialog.setMessage("退出请绑定小程序后设置退出密码");
|
||||
singleDialog.setOnClickBottomListener(new SingleDialog.OnClickBottomListener() {
|
||||
@Override
|
||||
public void onPositiveClick() {
|
||||
String password = Settings.Global.getString(mContext.getContentResolver(), CommonConfig.LOCK_SCREEN_PASSWORD);
|
||||
if (TextUtils.isEmpty(password)) {
|
||||
password = CommonConfig.DEFAULT_PASSWORD;
|
||||
}
|
||||
if (password.equals(passwordDialog.getPassword())) {
|
||||
RemoteManager.getInstance().setDefaultDesktop(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
|
||||
if (!ApkUtils.openPackage(mContext, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME)) {
|
||||
ApkUtils.gotoLauncher(mContext);
|
||||
}
|
||||
passwordDialog.dismiss();
|
||||
mContext.finish();
|
||||
System.exit(0);
|
||||
} else {
|
||||
ToastUtil.show("密码错误");
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNegtiveClick() {
|
||||
passwordDialog.dismiss();
|
||||
singleDialog.dismiss();
|
||||
}
|
||||
});
|
||||
passwordDialog.show();
|
||||
passwordDialog.getWindow().setGravity(Gravity.CENTER);
|
||||
passwordDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
passwordDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
singleDialog.show();
|
||||
singleDialog.getWindow().setGravity(Gravity.CENTER);
|
||||
singleDialog.setCancelable(true);
|
||||
}
|
||||
|
||||
private void showPassword() {
|
||||
// PasswordDialog passwordDialog = new PasswordDialog(mContext);
|
||||
// passwordDialog.setTitle("退出智慧课堂");
|
||||
// passwordDialog.setOnClickBottomListener(new PasswordDialog.OnClickBottomListener() {
|
||||
// @Override
|
||||
// public void onPositiveClick() {
|
||||
// String password = Settings.Global.getString(mContext.getContentResolver(), CommonConfig.LOCK_SCREEN_PASSWORD);
|
||||
// if (TextUtils.isEmpty(password)) {
|
||||
// password = CommonConfig.DEFAULT_PASSWORD;
|
||||
// }
|
||||
// if (password.equals(passwordDialog.getPassword())) {
|
||||
// passwordDialog.dismiss();
|
||||
// exitDesktop();
|
||||
// } else {
|
||||
// ToastUtil.show("密码错误");
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNegtiveClick() {
|
||||
// passwordDialog.dismiss();
|
||||
// }
|
||||
// });
|
||||
// passwordDialog.show();
|
||||
// passwordDialog.getWindow().setGravity(Gravity.CENTER);
|
||||
// passwordDialog.getWindow().clearFlags(WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_ALT_FOCUSABLE_IM);
|
||||
// passwordDialog.getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_VISIBLE);
|
||||
startActivity(new Intent(mContext, ScreenLockActivity.class));
|
||||
}
|
||||
|
||||
private void exitDesktop() {
|
||||
RemoteManager.getInstance().setDefaultDesktop(ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME);
|
||||
if (!ApkUtils.openPackage(mContext, ApkUtils.ANDROID_LAUNCHER3_PACKAGE_NAME, ApkUtils.ANDROID_LAUNCHER3_CLASS_NAME)) {
|
||||
ApkUtils.gotoLauncher(mContext);
|
||||
}
|
||||
mContext.finish();
|
||||
System.exit(0);
|
||||
}
|
||||
|
||||
private void setButtonVisibility() {
|
||||
@@ -292,7 +333,7 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
|
||||
tv_exit.setVisibility(View.VISIBLE);
|
||||
tv_activation.setVisibility(View.VISIBLE);
|
||||
} else {
|
||||
int isReturnAndroid = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_RETURN_ANDROID_KEY, 0);
|
||||
int isReturnAndroid = Settings.Global.getInt(mContext.getContentResolver(), CommonConfig.UIUI_RETURN_ANDROID_KEY, 1);
|
||||
if (isReturnAndroid == 0) {
|
||||
tv_exit.setVisibility(View.INVISIBLE);
|
||||
} else {
|
||||
@@ -347,6 +388,9 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
|
||||
} else {
|
||||
tv_grade.setText(grade);
|
||||
}
|
||||
tv_percent.setText(snInfo.getStudy_time_ranking() + "%");
|
||||
tv_duration.setText(String.format(getString(R.string.today_study_time), TimeUtils.formatTime(snInfo.getStudy_time())));
|
||||
|
||||
cl_nodata.setVisibility(View.GONE);
|
||||
cl_usedata.setVisibility(View.VISIBLE);
|
||||
cl_activation.setVisibility(View.GONE);
|
||||
@@ -375,6 +419,7 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
|
||||
default:
|
||||
}
|
||||
}
|
||||
setButtonVisibility();
|
||||
mPresenter.getQrCode();
|
||||
}
|
||||
|
||||
@@ -401,7 +446,7 @@ public class UserFragment extends BaseFragment implements UserContact.UserView {
|
||||
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));
|
||||
// tv_duration.setText(String.format(getString(R.string.today_study_time), useTime));
|
||||
}
|
||||
|
||||
private void registerOwnReceiver() {
|
||||
|
||||
@@ -4,6 +4,7 @@ public class JxwPackageConfig {
|
||||
/*注册桌面*/
|
||||
public static final String JXW_LAUNCHER_PACKAGE_NAME = "com.jxw.launcher";
|
||||
public static final String JXW_LAUNCHER_CLASS_NAME = "com.jht.engine.platsign.PlatformService";
|
||||
public static final String JXW_LAUNCHER_UPDATE_CLASS_NAME = "com.jxw.engine.platsign.UpdateActivity";
|
||||
/*同步视频*/
|
||||
public static final String JXW_VIDEO_PACKAGE_NAME = "com.jxw.newyouer.video";
|
||||
public static final String JXW_VIDEO_CLASS_NAME = "com.jxw.newyouer.activity.ExecellentActivity";
|
||||
@@ -83,5 +84,7 @@ public class JxwPackageConfig {
|
||||
/*连词成句*/
|
||||
public static final String JXW_Conjunctions_PACKAGE_NAME = "com.jxw.liancichengju";
|
||||
public static final String JXW_Conjunctions_CLASS_NAME = "com.jxw.liancichengju.MainActivity";
|
||||
|
||||
/*智能语音*/
|
||||
public static final String JXW_VOICE_PACKAGE_NAME = "com.iflytek.cyber.iot.show.core";
|
||||
public static final String JXW_VOICE_CLASS_NAME = "com.iflytek.cyber.iot.show.core.EvsLauncherActivity";
|
||||
}
|
||||
@@ -46,6 +46,8 @@ public class RemoteManager {
|
||||
public static final String SN_PACKAGE_NAME = "com.uiui.zy";
|
||||
private static final String SN_SERVICE_NAME = "com.uiui.zy.service.RemoteService";
|
||||
|
||||
private static final String SN_KEY = "sn_serial_key";
|
||||
|
||||
private RemoteManager(Context context) {
|
||||
if (context == null) {
|
||||
throw new RuntimeException("Context is NULL");
|
||||
@@ -62,10 +64,20 @@ public class RemoteManager {
|
||||
}
|
||||
getLocation();
|
||||
try {
|
||||
Log.e(TAG, "onServiceConnected: macaddr = " + mGetInfoInterface.getSerial());
|
||||
String sn = mGetInfoInterface.getSerial();
|
||||
mMMKV.encode(SN_KEY, sn);
|
||||
Log.e(TAG, "onServiceConnected: sn = " + sn);
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
try {
|
||||
List<String> pkgs = mGetInfoInterface.getAdminApp();
|
||||
Log.e(TAG, "onServiceConnected: pkgs = " + pkgs);
|
||||
mMMKV.encode(CommonConfig.ADMIN_APP_LIST, new HashSet<>(pkgs));
|
||||
} catch (RemoteException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
Log.e(TAG, "onServiceConnected: " + getSerial());
|
||||
aliyunPushInit();
|
||||
}
|
||||
@@ -190,7 +202,7 @@ public class RemoteManager {
|
||||
} else {
|
||||
bindInfoService();
|
||||
}
|
||||
return "";
|
||||
return mMMKV.decodeString(SN_KEY, "");
|
||||
}
|
||||
|
||||
public void getLocation() {
|
||||
@@ -298,11 +310,27 @@ public class RemoteManager {
|
||||
}
|
||||
|
||||
public void setDefaultDesktop(String pkg) {
|
||||
try {
|
||||
mGetInfoInterface.setDefaultLauncher(pkg);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "setDefaultDesktop: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
if (mGetInfoInterface != null) {
|
||||
try {
|
||||
mGetInfoInterface.setDefaultLauncher(pkg);
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "setDefaultDesktop: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public List<String> getAdminApp() {
|
||||
if (mGetInfoInterface != null) {
|
||||
try {
|
||||
List<String> pkgs = mGetInfoInterface.getAdminApp();
|
||||
return pkgs;
|
||||
} catch (RemoteException e) {
|
||||
Log.e(TAG, "setDefaultDesktop: " + e.getMessage());
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
Set<String> packages = mMMKV.decodeStringSet(CommonConfig.ADMIN_APP_LIST, new HashSet<>());
|
||||
return new ArrayList<>(packages);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@ import com.uiui.zyos.BuildConfig;
|
||||
import com.uiui.zyos.R;
|
||||
import com.uiui.zyos.bean.DesktopIcon;
|
||||
import com.uiui.zyos.config.CommonConfig;
|
||||
import com.uiui.zyos.manager.RemoteManager;
|
||||
import com.uiui.zyos.receiver.InstallResultReceiver;
|
||||
|
||||
import java.io.File;
|
||||
@@ -93,26 +94,27 @@ public class ApkUtils {
|
||||
|
||||
private static HashSet<String> showPackageName = new HashSet<String>() {{
|
||||
this.add("com.android.dialer");
|
||||
this.add("com.android.gallery3d");
|
||||
this.add("com.android.settings");
|
||||
// this.add("com.android.gallery3d");
|
||||
// this.add("com.android.settings");
|
||||
this.add("com.android.messaging");
|
||||
this.add("com.android.camera2");
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.android.mms");
|
||||
this.add("com.uiui.city");
|
||||
this.add("com.android.fmradio");
|
||||
this.add("com.android.documentsui");
|
||||
// this.add("com.uiui.city");
|
||||
// this.add("com.android.fmradio");
|
||||
// this.add("com.android.documentsui");
|
||||
this.add("com.android.calculator2");
|
||||
this.add("cn.wps.moffice_eng");
|
||||
this.add("com.baidu.searchbox.lite");
|
||||
this.add("com.ss.android.article.video");
|
||||
this.add("com.ss.android.ugc.aweme");
|
||||
this.add("com.smile.gifmaker");
|
||||
this.add("com.kuaikan.comic");
|
||||
this.add("com.jxw.launcher");
|
||||
this.add("com.tencent.android.qqdownloader");
|
||||
this.add("com.alldocube.store");
|
||||
this.add("com.android.calendar");
|
||||
// this.add("cn.wps.moffice_eng");
|
||||
// this.add("com.baidu.searchbox.lite");
|
||||
// this.add("com.ss.android.article.video");
|
||||
// this.add("com.ss.android.ugc.aweme");
|
||||
// this.add("com.smile.gifmaker");
|
||||
// this.add("com.kuaikan.comic");
|
||||
// this.add("com.jxw.launcher");
|
||||
// this.add("com.tencent.android.qqdownloader");
|
||||
// this.add("com.alldocube.store");
|
||||
// this.add("com.android.calendar");
|
||||
this.add("com.mediatek.camera");
|
||||
this.add("com.uiui.zybrowser");
|
||||
}};
|
||||
private static HashSet<String> allHintPackage = new HashSet<String>() {{
|
||||
this.add("com.android.uiuios");
|
||||
@@ -120,6 +122,7 @@ public class ApkUtils {
|
||||
|
||||
public static final String ANDROID_LAUNCHER3_PACKAGE_NAME = "com.android.launcher3";
|
||||
public static final String ANDROID_LAUNCHER3_CLASS_NAME = "com.android.launcher3.Launcher";
|
||||
public static final String ANDROID_LAUNCHER3_Quickstep_CLASS_NAME = "com.android.launcher3.uioverrides.QuickstepLauncher";
|
||||
|
||||
private static String TAG = ApkUtils.class.getSimpleName();
|
||||
|
||||
@@ -198,7 +201,7 @@ public class ApkUtils {
|
||||
Set<String> allowPackages = new HashSet();
|
||||
for (ResolveInfo resolveInfo : resolveinfoList) {
|
||||
Log.i(TAG, "queryFilterAppInfo: " + resolveInfo.activityInfo.packageName);
|
||||
Log.i(TAG, "queryFilterAppInfo: " + resolveInfo.activityInfo.name);
|
||||
Log.i(TAG, "queryFilterAppInfo: class: " + resolveInfo.activityInfo.name);
|
||||
allowPackages.add(resolveInfo.activityInfo.packageName);
|
||||
}
|
||||
String appListString = Settings.System.getString(context.getContentResolver(), "only_jgy_shortcut_list");
|
||||
@@ -206,26 +209,34 @@ public class ApkUtils {
|
||||
if (!TextUtils.isEmpty(appListString)) {
|
||||
packageList = new ArrayList<>(Arrays.asList(appListString.split(",")));
|
||||
}
|
||||
int setting_other_appInstaller = Settings.Global.getInt(context.getContentResolver(), CommonConfig.SETTING_OTHER_APPINSTALLER_KEY, 1);
|
||||
List<String> adminApp = RemoteManager.getInstance().getAdminApp();
|
||||
Log.i(TAG, "queryFilterAppInfo: adminapp = " + adminApp);
|
||||
for (ResolveInfo resolveInfo : resolveinfoList) {
|
||||
String pkg = resolveInfo.activityInfo.packageName;
|
||||
if (appIsDisable(context, pkg)) {
|
||||
Log.e(TAG, "queryFilterAppInfo: disable = " + pkg);
|
||||
continue;
|
||||
}
|
||||
|
||||
if (isSystemApp(context, pkg))//通过flag排除系统应用,会将电话、短信也排除掉
|
||||
{
|
||||
// if (showPackageName.contains(pkg)) {
|
||||
// resolveInfos.add(resolveInfo);
|
||||
// }
|
||||
if (showPackageName.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
}
|
||||
} else {
|
||||
// int setting_other_appInstaller = Settings.Global.getInt(context.getContentResolver(), CommonConfig.SETTING_OTHER_APPINSTALLER_KEY, 1);
|
||||
// if (setting_other_appInstaller == 0) {//不显示自己安装的
|
||||
// if (packageList.contains(pkg)) {
|
||||
// resolveInfos.add(resolveInfo);
|
||||
// }
|
||||
// } else {
|
||||
|
||||
if (allowPackages.contains(pkg) && !excludePackageName.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
if (adminApp.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
} else if (showPackageName.contains(pkg)) {
|
||||
resolveInfos.add(resolveInfo);
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
@@ -378,6 +389,7 @@ public class ApkUtils {
|
||||
context.startActivity(intent);
|
||||
} catch (Exception e) {
|
||||
Log.e(TAG, "openPackage: " + e.getMessage());
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
@@ -592,9 +604,19 @@ public class ApkUtils {
|
||||
}
|
||||
|
||||
public static void gotoLauncher(Context context) {
|
||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //android123提示如果是服务里调用,必须加入new task标识
|
||||
i.addCategory(Intent.CATEGORY_HOME);
|
||||
context.startActivity(i);
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.Q) {
|
||||
Intent homeIntent = new Intent(Intent.ACTION_MAIN);
|
||||
homeIntent.setPackage("com.android.launcher3");
|
||||
homeIntent.addCategory(Intent.CATEGORY_HOME);
|
||||
homeIntent.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
homeIntent.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
context.startActivity(homeIntent);
|
||||
} else {
|
||||
Intent i = new Intent(Intent.ACTION_MAIN);
|
||||
i.setFlags(Intent.FLAG_ACTIVITY_NEW_TASK); //android123提示如果是服务里调用,必须加入new task标识
|
||||
i.addCategory(Intent.CATEGORY_HOME);
|
||||
i.addCategory(Intent.CATEGORY_DEFAULT);
|
||||
context.startActivity(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user