version:1.7.3
fix: update:样式修改,目录调整
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
package com.xxpatx.os.adapter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.content.pm.PackageManager;
|
||||
import android.graphics.drawable.Drawable;
|
||||
import android.util.Log;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
@@ -14,12 +17,13 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.hjq.toast.Toaster;
|
||||
import com.tencent.mmkv.MMKV;
|
||||
import com.xxpatx.os.BuildConfig;
|
||||
import com.xxpatx.os.R;
|
||||
import com.xxpatx.os.activity.dock.DockActivity;
|
||||
import com.xxpatx.os.activity.settings.dock.DockActivity;
|
||||
import com.xxpatx.os.bean.DockApp;
|
||||
import com.xxpatx.os.config.CommonConfig;
|
||||
import com.xxpatx.os.gson.GsonUtils;
|
||||
import com.xxpatx.os.utils.ApkUtils;
|
||||
import com.xxpatx.os.utils.IconUtils;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
@@ -66,7 +70,7 @@ public class DockAppSelectedAdapter extends RecyclerView.Adapter<DockAppSelected
|
||||
holder.iv_icon.setImageDrawable(mContext.getDrawable(R.drawable.com_android_mms_ui));
|
||||
break;
|
||||
default:
|
||||
holder.iv_icon.setImageDrawable(ApkUtils.getAppDrawable(mContext, dockApp.getPackageName()));
|
||||
holder.iv_icon.setImageDrawable(getIcon(dockApp.getPackageName()));
|
||||
}
|
||||
holder.tv_name.setText(dockApp.getAppName());
|
||||
if (mSelectedPkgList.contains(dockApp)) {
|
||||
@@ -91,6 +95,28 @@ public class DockAppSelectedAdapter extends RecyclerView.Adapter<DockAppSelected
|
||||
});
|
||||
}
|
||||
|
||||
public Drawable getIcon(String packageName) {
|
||||
PackageManager pm = mContext.getPackageManager();
|
||||
ApplicationInfo info = null;
|
||||
try {
|
||||
info = pm.getApplicationInfo(packageName, 0);
|
||||
} catch (PackageManager.NameNotFoundException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
if (info == null) {
|
||||
return null;
|
||||
} else {
|
||||
int i = IconUtils.appClassNameList.indexOf(packageName);
|
||||
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);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
|
||||
Reference in New Issue
Block a user