version:1.0.0
fix: update:修改样式图标
This commit is contained in:
@@ -32,13 +32,6 @@ public class AppManager {
|
||||
private static final String SHOW_PACKAGE_KEY = "SHOW_PACKAGE_KEY";
|
||||
private static final String ADD_PACKAGE_KEY = "ADD_PACKAGE_KEY";
|
||||
|
||||
/*客服中心 自定义包名*/
|
||||
public static final String SERVICE_PACKAGE = "xxpatx.os.service";
|
||||
/*联系人 自定义包名*/
|
||||
public static final String CONTACT_PACKAGE = "xxpatx.os.contact";
|
||||
/*退出 自定义包名*/
|
||||
public static final String EXIT_DESKTOP = "xxpatx.os.exit";
|
||||
|
||||
@SuppressLint("StaticFieldLeak")
|
||||
private static AppManager sInstance;
|
||||
private Context mContext;
|
||||
|
||||
@@ -134,15 +134,15 @@ public class AppStatusManager {
|
||||
dailyAppBeanList.add(appSelectBean);
|
||||
}
|
||||
}
|
||||
if (hidedAppSet.contains(AppManager.CONTACT_PACKAGE)) {
|
||||
DailyAppBean contactIcon = new DailyAppBean("联系人", AppManager.CONTACT_PACKAGE);
|
||||
dailyAppBeanList.add(0, contactIcon);
|
||||
}
|
||||
// if (hidedAppSet.contains(PackagesName.VSCOOL_CONTACTS)) {
|
||||
// DailyAppBean contactIcon = new DailyAppBean("联系人", PackagesName.VSCOOL_CONTACTS);
|
||||
// dailyAppBeanList.add(0, contactIcon);
|
||||
// }
|
||||
|
||||
if (hidedAppSet.contains(AppManager.SERVICE_PACKAGE)) {
|
||||
DailyAppBean serviceIcon = new DailyAppBean("客服中心", AppManager.SERVICE_PACKAGE);
|
||||
dailyAppBeanList.add(0, serviceIcon);
|
||||
}
|
||||
// if (hidedAppSet.contains(PackagesName.VSCOOL_SERVICE)) {
|
||||
// DailyAppBean serviceIcon = new DailyAppBean("客服中心", PackagesName.VSCOOL_SERVICE);
|
||||
// dailyAppBeanList.add(0, serviceIcon);
|
||||
// }
|
||||
|
||||
return dailyAppBeanList;
|
||||
}
|
||||
|
||||
@@ -3,13 +3,20 @@ package com.vscool.os.manager;
|
||||
import android.annotation.SuppressLint;
|
||||
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.graphics.drawable.Drawable;
|
||||
import android.provider.MediaStore;
|
||||
import android.util.Log;
|
||||
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.vscool.os.BuildConfig;
|
||||
import com.vscool.os.R;
|
||||
import com.vscool.os.bean.DockApp;
|
||||
import com.vscool.os.config.CommonConfig;
|
||||
import com.vscool.os.config.PackagesName;
|
||||
import com.vscool.os.utils.IconUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -65,5 +72,33 @@ public class DesktopIconManager {
|
||||
return "com.android.camera2"; // 没有找到相机应用
|
||||
}
|
||||
|
||||
|
||||
public Drawable getPackageIcon(String pkg) {
|
||||
switch (pkg) {
|
||||
case PackagesName.VSCOOL_SERVICE:
|
||||
return mContext.getDrawable(R.drawable.icon_wechat_service);
|
||||
case PackagesName.VSCOOL_EXIT_DESKTOP:
|
||||
return mContext.getDrawable(R.drawable.exit_icon);
|
||||
default:
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
ApplicationInfo info = null;
|
||||
try {
|
||||
info = pm.getApplicationInfo(pkg, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (info == null) {
|
||||
return null;
|
||||
} else {
|
||||
int i = IconUtils.appClassNameList.indexOf(pkg);
|
||||
if (i != -1) {
|
||||
String val = IconUtils.appIconList.get(i);
|
||||
int resID = mContext.getResources().getIdentifier(val, "drawable", BuildConfig.APPLICATION_ID);
|
||||
if (resID != 0) {
|
||||
return mContext.getResources().getDrawable(resID);
|
||||
}
|
||||
}
|
||||
return info.loadIcon(pm);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user