日历时钟动态更新
This commit is contained in:
@@ -36,6 +36,8 @@ import com.android.uiuios.ItemInfoWithIcon;
|
||||
import com.android.uiuios.LauncherFiles;
|
||||
import com.android.uiuios.LauncherModel;
|
||||
import com.android.uiuios.MainThreadExecutor;
|
||||
import com.android.uiuios.R;
|
||||
import com.android.uiuios.TTUtils.BitmapUtils;
|
||||
import com.android.uiuios.WorkspaceItemInfo;
|
||||
import com.android.uiuios.Utilities;
|
||||
import com.android.uiuios.compat.LauncherAppsCompat;
|
||||
@@ -48,6 +50,8 @@ import com.android.uiuios.model.PackageItemInfo;
|
||||
import com.android.uiuios.util.InstantAppResolver;
|
||||
import com.android.uiuios.util.Preconditions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.function.Supplier;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
@@ -226,13 +230,88 @@ public class IconCache extends BaseIconCache {
|
||||
info.contentDescription = entry.contentDescription;
|
||||
info.applyFrom((entry.icon == null) ? getDefaultIcon(info.user) : entry);
|
||||
}
|
||||
private List<String> appClassNameList = new ArrayList<String>() {
|
||||
{
|
||||
this.add("com.android.appstore");//应用市场
|
||||
this.add("com.android.browser.BrowserActivity");//浏览器
|
||||
this.add("com.android.calculator2.Calculator");//计算器
|
||||
this.add("com.android.calendar.AllInOneActivity");//日历
|
||||
this.add("com.android.camera.CameraLauncher");//相机
|
||||
this.add("com.android.contacts.activities.PeopleActivity");//通讯录
|
||||
this.add("com.android.deskclock.DeskClock");//时钟
|
||||
this.add("com.android.dialer.DialtactsActivity");//电话
|
||||
this.add("com.android.gallery3d.app.GalleryActivity");//图库
|
||||
this.add("com.android.mms.ui.BootActivity");//信息
|
||||
this.add("com.android.music.MusicBrowserActivity");//音乐
|
||||
this.add("com.android.providers.downloads.ui.DownloadList");//下载
|
||||
this.add("com.android.documentsui.LauncherActivity");//下载
|
||||
this.add("com.android.quicksearchbox.SearchActivity");//搜索
|
||||
this.add("com.android.settings.Settings");//设置
|
||||
this.add("com.android.soundrecorder.SoundRecorder");//录音机
|
||||
this.add("com.android.stk.StkMain");//sim卡
|
||||
this.add("com.android.vdieo");//视频
|
||||
this.add("com.mediatek.filemanager.FileManagerOperationActivity");//文件管理
|
||||
this.add("com.mediatek.fmradio.FmRadioActivity");//收音机
|
||||
this.add("com.android.fmradio.FmMainActivity");//收音机
|
||||
this.add("com.android.email.activity.Welcome");//电子邮件
|
||||
}
|
||||
};
|
||||
private List<String> appIconList = new ArrayList<String>() {{
|
||||
this.add("com_android_appstore");
|
||||
this.add("com_android_browser");
|
||||
this.add("com_android_calculator2");
|
||||
this.add("com_android_calendar");
|
||||
this.add("com_android_camera");
|
||||
this.add("com_android_contacts");
|
||||
this.add("com_android_deskclock");
|
||||
this.add("com_android_dialer");
|
||||
this.add("com_android_gallery3d_app");
|
||||
this.add("com_android_mms_ui");
|
||||
this.add("com_android_music");
|
||||
this.add("com_android_providers_downloads_ui");
|
||||
this.add("com_android_providers_downloads_ui");
|
||||
this.add("com_android_quicksearchbox");
|
||||
this.add("com_android_settings");
|
||||
this.add("com_android_soundrecorder");
|
||||
this.add("com_android_stk_stkmain");
|
||||
this.add("com_android_vdieo");
|
||||
this.add("com_mediatek_filemanager");
|
||||
this.add("com_android_fmradio");
|
||||
this.add("com_android_fmradio");//收音机
|
||||
this.add("com_android_email");
|
||||
}};
|
||||
|
||||
public Drawable getFullResIcon(LauncherActivityInfo info) {
|
||||
return getFullResIcon(info, true);
|
||||
}
|
||||
|
||||
public Drawable getFullResIcon(LauncherActivityInfo info, boolean flattenDrawable) {
|
||||
return mIconProvider.getIcon(info, mIconDpi, flattenDrawable);
|
||||
//此处修改根据应用包名获取图标
|
||||
Drawable icon = null;
|
||||
if (null != info) {
|
||||
if (appClassNameList.indexOf(info.getComponentName().getClassName()) == -1) {
|
||||
icon = BitmapUtils.getRoundedBitmap(mIconProvider.getIcon(info, mIconDpi, flattenDrawable), mContext);
|
||||
} else {
|
||||
String name = info.getComponentName().getClassName();
|
||||
Log.e("fht", "getDeskClockIcon:"+name);
|
||||
if (name.equals("com.android.calendar.AllInOneActivity")) {
|
||||
icon = BitmapUtils.createCalendarIconBitmap(mContext.getResources().getDrawable(R.drawable.mask), mContext);
|
||||
} else if (name.equals("com.android.deskclock.DeskClock")) {
|
||||
icon = BitmapUtils.getDeskClockIcon(mContext);
|
||||
} else {
|
||||
int i = appClassNameList.indexOf(name);
|
||||
String val = appIconList.get(i);
|
||||
int resID = mContext.getResources().getIdentifier(val, "drawable", "com.android.uiuios");
|
||||
if (resID == 0) {
|
||||
icon = mIconProvider.getIcon(info, mIconDpi, flattenDrawable);
|
||||
} else {
|
||||
icon = mContext.getResources().getDrawable(resID);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// return mIconProvider.getIcon(info, mIconDpi, flattenDrawable);
|
||||
return icon;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user