version:
fix: update:跳转优化,资源替换
This commit is contained in:
@@ -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);
|
||||
|
||||
@@ -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,,,退出桌面");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user