fix:
update:跳转优化,资源替换
This commit is contained in:
2025-12-16 14:37:15 +08:00
parent 8a6bd705dc
commit ed285c05ee
54 changed files with 123 additions and 46 deletions

View File

@@ -1,8 +1,11 @@
package com.xwad.os.activity;
import android.content.ComponentName;
import android.content.Context;
import android.content.Intent;
import android.media.AudioAttributes;
import android.media.SoundPool;
import android.os.Build;
import android.os.Handler;
import android.provider.Settings;
import android.text.TextUtils;
@@ -109,19 +112,37 @@ public class ExitActivity extends BaseDataBindingActivity {
String password = Settings.Global.getString(getContentResolver(), CommonConfig.LOCK_SCREEN_PASSWORD);
if ((!TextUtils.isEmpty(content) && !TextUtils.isEmpty(password))) {
if (password.equals(content)) {
Utils.exitDesktop(this);
// Utils.exitDesktop(this);
exitDesktop();
} else {
setEmpty();
mBinding.tvHint.setText("密码错误");
}
} else if (CommonConfig.DEFAULT_PASSWORD.equals(content)) {
Utils.exitDesktop(this);
// Utils.exitDesktop(this);
exitDesktop();
} else {
setEmpty();
mBinding.tvHint.setText("密码错误");
}
}
private void exitDesktop() {
ComponentName componentName = new ComponentName("com.hihonor.android.launcher", "com.hihonor.android.launcher.unihome.UniHomeLauncher");
Intent intent = new Intent();
intent.setComponent(componentName);
startActivity(intent);
startActivity(new Intent(Settings.ACTION_HOME_SETTINGS));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
finishAndRemoveTask();
} else {
finishAffinity();
}
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
}
private void setEmpty() {
Handler.getMain().postDelayed(new Runnable() {
@Override

View File

@@ -209,6 +209,7 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
private void initDatas() {
Log.e(TAG, "initDatas: ");
long time = System.currentTimeMillis();
mViewDataBinding.tvTime.setText(DataUtil.formatDateHour());
fragments.clear();
@@ -242,6 +243,7 @@ public class HomeActivity extends BaseMvvmActivity<HomeViewModel, ActivityHomeBi
mViewDataBinding.subjectViewPager.setAdapter(new TabFragmentAdapter(getSupportFragmentManager()));
mViewDataBinding.subjectViewPager.setCurrentItem(defaultCurrent);
Log.e(this.getClass().getSimpleName(), "initDatas: " + (System.currentTimeMillis() - time) + "ms");
}

View File

@@ -116,6 +116,22 @@ public class UserActivity extends BaseMvvmActivity<UserViewModel, ActivityUserBi
@Override
protected void initData() {
Intent intent = getIntent();
int index = intent.getIntExtra("index", 0);
switch (index) {
default:
case 0:
mViewDataBinding.rbCenter.setChecked(true);
break;
case 1:
mViewDataBinding.rbParents.setChecked(true);
break;
case 2:
mViewDataBinding.rbDevice.setChecked(true);
break;
}
switchContent(index);
mViewModel.mUserAvatarInfoData.observe(this, new Observer<UserAvatarInfo>() {
@Override
public void onChanged(UserAvatarInfo userAvatarInfo) {

View File

@@ -72,6 +72,7 @@ public class BaseApplication extends Application {
private void init() {
Log.e(TAG, "init: ");
long time = System.currentTimeMillis();
if (!BuildConfig.DEBUG) {
catchException();
}
@@ -106,6 +107,7 @@ public class BaseApplication extends Application {
aliyunPushInit();
}
Log.e(this.getClass().getSimpleName(), "init: " + (System.currentTimeMillis() - time) + "ms");
}
public void aliyunPushInit() {

View File

@@ -108,9 +108,13 @@ public abstract class BaseMvvmFragment<VM extends ViewModel, VDB extends ViewDat
// fitsLayoutOverlap();
initDataBinding();
long time = System.currentTimeMillis();
initView(bundle = getArguments());
Log.e(this.getClass().getSimpleName(), "onViewCreated: initView " + (System.currentTimeMillis() - time) + "ms");
//
long time2 = System.currentTimeMillis();
initData(this.savedInstanceState = savedInstanceState);
Log.e(this.getClass().getSimpleName(), "onViewCreated: initData " + (System.currentTimeMillis() - time2) + "ms");
//
if (mIsVisible) {
onEnter();

View File

@@ -24,8 +24,14 @@ import com.xwad.os.databinding.FragmentComplexBinding;
import com.xwad.os.jxw.AssertUtils;
import com.xwad.os.jxw.LearnStageBean;
import com.xwad.os.jxw.SPUtils;
import com.xwad.os.jxw.event.UpdateGradeEvent;
import com.xwad.os.jxw.util.Util;
import org.greenrobot.eventbus.EventBus;
import org.greenrobot.eventbus.Subscribe;
import org.greenrobot.eventbus.ThreadMode;
import org.jetbrains.annotations.NotNull;
import java.lang.reflect.Type;
import java.util.ArrayList;
import java.util.List;
@@ -42,8 +48,8 @@ public class ComplexFragment extends BaseMvvmFragment<ComplexViewModel, Fragment
private MyAdapter adapter;
private TabTbxAdapter tabTbxAdapter;
private List<TabBean> tabBeanList = new ArrayList();
private List<Fragment> mFragment = new ArrayList();
private List<TabBean> tabBeanList = new ArrayList<>();
private List<Fragment> mFragment = new ArrayList<>();
// TODO: Rename parameter arguments, choose names that match
@@ -105,12 +111,39 @@ public class ComplexFragment extends BaseMvvmFragment<ComplexViewModel, Fragment
@Override
protected void initView(Bundle savedInstanceState) {
if (!EventBus.getDefault().isRegistered(this)) {
EventBus.getDefault().register(this);
}
mViewDataBinding.subjectViewPager.setOffscreenPageLimit(10);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getContext());
linearLayoutManager.setOrientation(RecyclerView.VERTICAL);
mViewDataBinding.rvTitle.setLayoutManager(linearLayoutManager);
tabTbxAdapter = new TabTbxAdapter(tabBeanList);
adapter = new MyAdapter(getChildFragmentManager());
initViews();
}
@Override
protected void initData(Bundle savedInstanceState) {
}
@Override
public void fetchData() {
Log.e(TAG, "fetchData: ");
// initViews();
}
@Override
public void onDestroy() {
super.onDestroy();
EventBus.getDefault().unregister(this);
}
private void initViews() {
if ("小学".equals(Util.checkGrade(SPUtils.getGrade()))) {
mViewDataBinding.rlXx.setVisibility(View.VISIBLE);
mViewDataBinding.subjectViewPager.setVisibility(View.GONE);
@@ -143,36 +176,26 @@ public class ComplexFragment extends BaseMvvmFragment<ComplexViewModel, Fragment
}
}
tabTbxAdapter = new TabTbxAdapter(tabBeanList);
mViewDataBinding.rvTitle.setAdapter(tabTbxAdapter);
adapter = new MyAdapter(getChildFragmentManager());
mViewDataBinding.subjectViewPager.setAdapter(adapter);
if (tabBeanList.isEmpty()) {
return;
if (!tabBeanList.isEmpty()) {
tabTbxAdapter.setChoosePosition(0);
mViewDataBinding.subjectViewPager.setCurrentItem(0);
}
tabTbxAdapter.setChoosePosition(0);
mViewDataBinding.subjectViewPager.setCurrentItem(0);
}
@Override
protected void initData(Bundle savedInstanceState) {
@Subscribe(threadMode = ThreadMode.MAIN)
public void onGkNoticeEvent(UpdateGradeEvent updateGradeEvent) {
initViews();
if (isAdded()) {
// getNjId();
}
}
@Override
public void fetchData() {
Log.e(TAG, "fetchData: ");
}
@Override
public void onDestroyView() {
super.onDestroyView();
}
private List<LearnStageBean> getLearnStage() {
String grade = "一年级";
String grade = SPUtils.getGrade();
Log.e(TAG, "getLearnStage: grade = " + grade);
String jsonString = AssertUtils.getFromAssets(mContext, "script/fragment_tbx.json");
Type type = new TypeToken<List<LearnStageBean>>() {
}.getType();
@@ -188,15 +211,16 @@ public class ComplexFragment extends BaseMvvmFragment<ComplexViewModel, Fragment
resultList.add(learnStageBean);
}
}
return arrayList;
return resultList;
}
public class MyAdapter extends FragmentPagerAdapter {
public MyAdapter(FragmentManager fragmentManager) {
MyAdapter(FragmentManager fragmentManager) {
super(fragmentManager);
}
@NotNull
@Override
public Fragment getItem(int i) {
return mFragment.get(i);

View File

@@ -21,6 +21,7 @@ import androidx.recyclerview.widget.GridLayoutManager;
import com.chad.library.adapter.base.BaseQuickAdapter;
import com.xwad.os.BuildConfig;
import com.xwad.os.R;
import com.xwad.os.activity.ExitActivity;
import com.xwad.os.activity.activation.ActivationActivity;
import com.xwad.os.activity.home.HomeActivity;
import com.xwad.os.activity.user.UserActivity;
@@ -377,20 +378,7 @@ public class MineFragment extends BaseMvvmFragment<MineViewModel, FragmentMineBi
public void exit(View view) {
Log.e(TAG, "exit: " + getAllLauncherApps(mContext));
ComponentName componentName = new ComponentName("com.hihonor.android.launcher", "com.hihonor.android.launcher.unihome.UniHomeLauncher");
Intent intent = new Intent();
intent.setComponent(componentName);
mContext.startActivity(intent);
startActivity(new Intent(Settings.ACTION_HOME_SETTINGS));
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
mContext.finishAndRemoveTask();
} else {
mContext.finishAffinity();
}
android.os.Process.killProcess(android.os.Process.myPid());
System.exit(0);
startActivity(new Intent(mContext, ExitActivity.class));
// OpenApkUtils.getInstance().openJxwApp(mContext, "com.hihonor.android.launcher,com.hihonor.android.launcher.unihome.UniHomeLauncher,,,退出桌面");
}
}

View File

@@ -280,22 +280,31 @@ public class SafeFragment extends BaseMvvmFragment<SafeViewModel, FragmentSafeBi
public void initAppData() {
// AppInfo build = new AppInfo.Builder().appLabel("课程表").appStargs(getResources().getString(R.string.tag_args_new_kcb)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_kcb)).build();
// AppInfo build2 = new AppInfo.Builder().appLabel("语音翻译").appStargs(getResources().getString(R.string.tag_args_new_zyhy)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_yyfy)).build();
AppInfo build3 = new AppInfo.Builder().appLabel("使用助手").appStargs(getResources().getString(R.string.tag_args_new_sysmx)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_syzs)).build();
// AppInfo build3 = new AppInfo.Builder().appLabel("使用助手").appStargs(getResources().getString(R.string.tag_args_new_sysmx)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_syzs)).build();
// AppInfo build4 = new AppInfo.Builder().appLabel("应用更新").appStargs(getResources().getString(R.string.tag_args_updae)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_yygx)).build();
// AppInfo build5 = new AppInfo.Builder().appLabel("一键加速").appStargs(getResources().getString(R.string.tag_args_new_yjjs)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_yjjs)).build();
// AppInfo build6 = new AppInfo.Builder().appLabel("下载中心").appStargs(getResources().getString(R.string.tag_args_new_download)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_xzzx)).build();
// AppInfo build7 = new AppInfo.Builder().appLabel("切换壁纸").appStargs(getResources().getString(R.string.tag_args_launcher)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_qhbz)).build();
// AppInfo build8 = new AppInfo.Builder().appLabel("安卓平台").appStargs(getResources().getString(R.string.tag_args_launcher)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_azpt)).build();
// AppInfo build9 = new AppInfo.Builder().appLabel("设置").appStargs(getResources().getString(R.string.tag_args_new_jxwSettings)).appIcon(mContext.getResources().getDrawable(R.drawable.icon_bbx_sz)).build();
AppInfo build10 = new AppInfo.Builder().appLabel("时钟").appStargs(getResources().getString(R.string.tag_args_new_sz)).appIcon(mContext.getResources().getDrawable(R.drawable.com_android_deskclock)).build();
AppInfo build11 = new AppInfo.Builder().appLabel("计算器").appStargs(getResources().getString(R.string.tag_args_new_calc)).appIcon(mContext.getResources().getDrawable(R.drawable.com_android_calculator2)).build();
AppInfo build12 = new AppInfo.Builder().appLabel("相机").appStargs(getResources().getString(R.string.tag_args_new_camera)).appIcon(mContext.getResources().getDrawable(R.drawable.com_android_camera)).build();
AppInfo build13 = new AppInfo.Builder().appLabel("图库").appStargs(getResources().getString(R.string.tag_args_new_tk)).appIcon(mContext.getResources().getDrawable(R.drawable.com_android_gallery3d_app)).build();
// mlistAppInfo.add(build);
// mlistAppInfo.add(build2);
mlistAppInfo.add(build3);
// mlistAppInfo.add(build3);
// mlistAppInfo.add(build4);
// mlistAppInfo.add(build5);
// mlistAppInfo.add(build6);
// mlistAppInfo.add(build7);
// mlistAppInfo.add(build8);
// mlistAppInfo.add(build9);
mlistAppInfo.add(build10);
mlistAppInfo.add(build11);
mlistAppInfo.add(build12);
mlistAppInfo.add(build13);
getAppData();
mHandler.post(new Runnable() {
@Override

View File

@@ -681,6 +681,11 @@ public class OpenApkUtils {
return;
}
if (TextUtils.isEmpty(className)) {
openApp(packageName);
return;
}
// 2. 构建Intent并设置Component包名+类名)
Intent intent = new Intent();
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);

Binary file not shown.

After

Width:  |  Height:  |  Size: 5.3 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 39 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 68 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 78 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 40 KiB

After

Width:  |  Height:  |  Size: 70 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 37 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 28 KiB

After

Width:  |  Height:  |  Size: 63 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 49 KiB

After

Width:  |  Height:  |  Size: 71 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 35 KiB

After

Width:  |  Height:  |  Size: 82 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 38 KiB

After

Width:  |  Height:  |  Size: 62 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 171 KiB

After

Width:  |  Height:  |  Size: 171 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 116 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 198 KiB

After

Width:  |  Height:  |  Size: 198 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 301 KiB

After

Width:  |  Height:  |  Size: 301 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 245 KiB

After

Width:  |  Height:  |  Size: 246 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 298 KiB

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 226 KiB

After

Width:  |  Height:  |  Size: 528 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 748 KiB

After

Width:  |  Height:  |  Size: 415 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 540 KiB

After

Width:  |  Height:  |  Size: 540 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 92 KiB

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 476 KiB

After

Width:  |  Height:  |  Size: 748 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 109 KiB

After

Width:  |  Height:  |  Size: 298 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 64 KiB

After

Width:  |  Height:  |  Size: 155 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 57 KiB

After

Width:  |  Height:  |  Size: 144 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 110 KiB

After

Width:  |  Height:  |  Size: 293 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 753 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.4 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.5 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 401 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 878 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.1 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.8 MiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.7 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 512 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 MiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 1.9 MiB

View File

@@ -429,7 +429,7 @@
android:layout_width="@dimen/mine_icon_width"
android:layout_height="match_parent"
android:onClick="onClick"
android:tag="@string/tag_args_new_yjjs">
android:tag="@string/tag_args_new_jzgk">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
@@ -640,7 +640,7 @@
android:layout_width="@dimen/mine_icon_width"
android:layout_height="match_parent"
android:onClick="onClick"
android:tag="@string/tag_args_new_jxwSettings">
android:tag="@string/tag_args_new_settings">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="wrap_content"
@@ -667,7 +667,7 @@
android:layout_gravity="center_horizontal"
android:layout_marginTop="2dp"
android:singleLine="true"
android:text="设置"
android:text="系统设置"
android:textColor="@color/white"
android:textSize="@dimen/mine_app_name_size"
app:layout_constraintEnd_toEndOf="@+id/app_icon8"

View File

@@ -317,8 +317,13 @@
<string name="tag_args_new_jpkc_wdxz">com.jxw.jpkc,com.jxw.jpkc.ui.downloadsCollections.activity.main.DownloadsCollectionsMainActivity,String:key_model_type:MY_DOWNLOAD,,精品课</string>
<string name="tag_args_new_jsb">com.sprd.sprdnote,com.sprd.sprdnote.NoteActivity,,,记事本</string>
<string name="tag_args_new_jsq">com.android.calculator2,com.android.calculator2.Calculator,,,计算器</string>
<string name="tag_args_new_settings">com.android.settings,,,,系统设置</string>
<string name="tag_args_new_jxwSettings">com.jxw.launcher,com.jxw.launcher.user.SettingsActivity,,,便捷设置</string>
<string name="tag_args_new_jzgl">com.jxw.pushservice,com.jxw.pushservice.MainActivity,,,家长管理</string>
<string name="tag_args_new_sz">com.hihonor.deskclock,,,,时钟</string>
<string name="tag_args_new_calc">com.hihonor.calculator,,,,计算器</string>
<string name="tag_args_new_camera">com.hihonor.camera,,,,相机</string>
<string name="tag_args_new_tk">com.hihonor.photos,,,,图库</string>
<string name="tag_args_new_jzx_dl">地理</string>
<string name="tag_args_new_jzx_hx">化学</string>
<string name="tag_args_new_jzx_kx">科学</string>
@@ -427,6 +432,7 @@
<string name="tag_args_new_yearhd">com.jxw.huiben,com.jxw.huiben.activity.SplashActivity,huiben,,,学王指读</string>
<string name="tag_args_new_yinyue">com.android.music,com.android.music.MusicBrowserActivity,,,音乐</string>
<string name="tag_args_new_yjjs">com.jxw.clean,com.jxw.clean.MainActivity,,,一键加速</string>
<string name="tag_args_new_jzgk">com.xwad.os,com.xwad.os.activity.user.UserActivity,int:index:1,,家长管控</string>
<string name="tag_args_new_ykyl_dd">com.jxw.tbfd,com.jxw.tbfd.ui.activity.HomeActivity,String:subject:政治,,一课一练</string>
<string name="tag_args_new_ykyl_ddyfz">com.jxw.tbfd,com.jxw.tbfd.ui.activity.HomeActivity,String:subject:政治,,一课一练</string>
<string name="tag_args_new_ykyl_dl">com.jxw.tbfd,com.jxw.tbfd.ui.activity.HomeActivity,String:subject:地理,,一课一练</string>