public boolean onLongClick(float x, float y) { // TODO Auto-generated method stub ShortcutInfo info = (ShortcutInfo) this.getItemInfo(); if (info.itemType != LauncherSettings.Favorites.ITEM_TYPE_VIRTURE_VIEW) { if (info.intent != null && info.intent.getAction().equals(Intent.ACTION_PACKAGE_INSTALL)) { SendMsgToAndroid.sendOurToastMsg(R3D.getString(RR.string.download_to_install)); return true; } } return super.onLongClick(x, y); }
public static WidgetIcon createWidgetIcon(ShortcutInfo info, boolean ifShadow) { WidgetIcon widgetIcon = null; InputStream is = null; String imagePath = DefaultLayout.getDefaultVirtureImage(info.intent.getComponent().getPackageName()); boolean scale = false; if (imagePath == null) { scale = true; imagePath = DefaultLayout.GetVirtureImageWithPkgClassName( info.intent.getComponent().getPackageName(), info.intent.getComponent().getClassName()); if (imagePath == null) return null; if (DefaultLayout.useCustomVirtual) { try { is = new FileInputStream(imagePath); } catch (FileNotFoundException e) { e.printStackTrace(); } } else { is = ThemeManager.getInstance().getInputStream(imagePath); } if (info.intent.getComponent().getPackageName().equals("coco.desktopsettings")) { InputStream dtis = ThemeManager.getInstance().getCurrThemeInput("theme/icon/80/desksettings.png"); if (dtis != null) { scale = false; try { dtis.close(); } catch (IOException e) { } } } } else { is = ThemeManager.getInstance().getInputStream(imagePath); scale = !(ThemeManager.getInstance().loadFromTheme(imagePath)); } Bitmap origBmp = ThemeManager.getInstance().getBitmap(is); try { if (is != null) { is.close(); } } catch (IOException e) { // TODO Auto-generated catch block e.printStackTrace(); } int iconSize = DefaultLayout.app_icon_size; if (DefaultLayout.thirdapk_icon_scaleFactor != 1.0f && !R3D.doNotNeedScale( info.intent.getComponent().getPackageName(), info.intent.getComponent().getClassName()) && scale) { iconSize *= DefaultLayout.thirdapk_icon_scaleFactor; } if (origBmp == null) return null; BitmapDrawable drawable = new BitmapDrawable(origBmp); drawable.setTargetDensity(iLoongLauncher.getInstance().getResources().getDisplayMetrics()); Bitmap bmp = Utilities.createIconBitmap(drawable, iLoongLauncher.getInstance(), iconSize); origBmp.recycle(); // teapotXu add start: Bitmap bg = null; if (iconSize != DefaultLayout.app_icon_size) bg = Icon3D.getIconBg(); widgetIcon = new WidgetIcon((String) info.title, bmp, (String) info.title, bg, ifShadow); // teapotXu add end widgetIcon.setItemInfo(info); bmp.recycle(); bmp = null; /** ********************** added by diaosixu begin ************************** */ AppReminder.Info aInfo = iLoongLauncher.getInstance().appReminder.new Info(); boolean r = iLoongLauncher .getInstance() .appReminder .isRemindApp(info.intent.getComponent().getPackageName(), aInfo); if (r) { Gdx.app.log("diaosixu", "show red point"); widgetIcon.setAppRemind(true); iLoongLauncher .getInstance() .appReminder .startReminding(aInfo.packageName, widgetIcon, aInfo.remindNo); } /** ********************** added by diaosixu end ************************** */ return widgetIcon; }