version:1.0.5
fix: update:资源替换,跳转优化
This commit is contained in:
@@ -1,12 +1,16 @@
|
||||
package com.xwad.os.fragment.mine;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.ComponentName;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Build;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.provider.Settings;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
@@ -15,6 +19,7 @@ import androidx.fragment.app.Fragment;
|
||||
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.activation.ActivationActivity;
|
||||
import com.xwad.os.activity.home.HomeActivity;
|
||||
@@ -44,6 +49,9 @@ import java.io.FileReader;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Function;
|
||||
import java.util.function.Predicate;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
@@ -326,6 +334,30 @@ public class MineFragment extends BaseMvvmFragment<MineViewModel, FragmentMineBi
|
||||
}
|
||||
}
|
||||
|
||||
private List<ComponentName> getAllLauncherApps(Context context) {
|
||||
PackageManager packageManager = context.getPackageManager();
|
||||
|
||||
// 构建用于查询桌面应用的Intent
|
||||
Intent intent = new Intent(Intent.ACTION_MAIN);
|
||||
intent.addCategory(Intent.CATEGORY_HOME);
|
||||
|
||||
// 查询所有可以处理该Intent的Activity
|
||||
List<ResolveInfo> resolveInfoList = packageManager.queryIntentActivities(intent, PackageManager.MATCH_ALL);
|
||||
|
||||
List<ComponentName> launcherPackageList = resolveInfoList.stream().filter(new Predicate<ResolveInfo>() {
|
||||
@Override
|
||||
public boolean test(ResolveInfo resolveInfo) {
|
||||
return !BuildConfig.APPLICATION_ID.equals(resolveInfo.activityInfo.packageName);
|
||||
}
|
||||
}).map(new Function<ResolveInfo, ComponentName>() {
|
||||
@Override
|
||||
public ComponentName apply(ResolveInfo resolveInfo) {
|
||||
return resolveInfo.getComponentInfo().getComponentName();
|
||||
}
|
||||
}).collect(Collectors.toList());
|
||||
|
||||
return launcherPackageList;
|
||||
}
|
||||
|
||||
public class BtnClick {
|
||||
public void toLigin(View view) {
|
||||
@@ -342,5 +374,24 @@ 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);
|
||||
|
||||
// OpenApkUtils.getInstance().openJxwApp(mContext, "com.hihonor.android.launcher,com.hihonor.android.launcher.unihome.UniHomeLauncher,,,退出桌面");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class ReadFragment extends BaseMvvmFragment<ReadViewModel, FragmentReadBi
|
||||
@Override
|
||||
public void onPageSelected(int i) {
|
||||
if (i == 0) {
|
||||
mViewDataBinding.tvTitle.setText("最近阅读");
|
||||
mViewDataBinding.tvTitle.setText("阅读报告");
|
||||
} else {
|
||||
mViewDataBinding.tvTitle.setText("我的书架");
|
||||
}
|
||||
|
||||
@@ -278,24 +278,24 @@ 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 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 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();
|
||||
mlistAppInfo.add(build);
|
||||
mlistAppInfo.add(build2);
|
||||
// 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();
|
||||
// mlistAppInfo.add(build);
|
||||
// mlistAppInfo.add(build2);
|
||||
mlistAppInfo.add(build3);
|
||||
mlistAppInfo.add(build4);
|
||||
mlistAppInfo.add(build5);
|
||||
mlistAppInfo.add(build6);
|
||||
mlistAppInfo.add(build7);
|
||||
mlistAppInfo.add(build8);
|
||||
mlistAppInfo.add(build9);
|
||||
// mlistAppInfo.add(build4);
|
||||
// mlistAppInfo.add(build5);
|
||||
// mlistAppInfo.add(build6);
|
||||
// mlistAppInfo.add(build7);
|
||||
// mlistAppInfo.add(build8);
|
||||
// mlistAppInfo.add(build9);
|
||||
getAppData();
|
||||
mHandler.post(new Runnable() {
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user