@TargetApi(Build.VERSION_CODES.M) void fixIcon(Icon icon, Context appContext, boolean installed) { if (icon == null) { return; } int type = mirror.android.graphics.drawable.Icon.mType.get(icon); if (type == mirror.android.graphics.drawable.Icon.TYPE_RESOURCE) { if (installed) { mirror.android.graphics.drawable.Icon.mObj1.set(icon, appContext.getResources()); mirror.android.graphics.drawable.Icon.mString1.set(icon, appContext.getPackageName()); } else { Drawable drawable = icon.loadDrawable(appContext); Bitmap bitmap = drawableToBitMap(drawable); mirror.android.graphics.drawable.Icon.mObj1.set(icon, bitmap); mirror.android.graphics.drawable.Icon.mString1.set(icon, null); mirror.android.graphics.drawable.Icon.mType.set(icon, mirror.android.graphics.drawable.Icon.TYPE_BITMAP); } } }
private static void fixNotificationIcon(Context context, Notification notification, Notification.Builder builder) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { //noinspection deprecation builder.setSmallIcon(notification.icon); //noinspection deprecation builder.setLargeIcon(notification.largeIcon); } else { Icon icon = notification.getSmallIcon(); if (icon != null) { Bitmap bitmap = drawableToBitMap(icon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setSmallIcon(newIcon); } } Icon largeIcon = notification.getLargeIcon(); if (largeIcon != null) { Bitmap bitmap = drawableToBitMap(largeIcon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setLargeIcon(newIcon); } } } }
void fixIconImage(Resources resources, RemoteViews remoteViews, boolean hasIconBitmap, Notification notification) { if (remoteViews == null || notification.icon == 0) return; if (!mNotificationCompat.isSystemLayout(remoteViews)) { return; } try { //noinspection deprecation int id = R_Hide.id.icon.get(); //only fake small icon if (!hasIconBitmap && notification.largeIcon == null) { Drawable drawable = resources.getDrawable(notification.icon); drawable.setLevel(notification.iconLevel); Bitmap bitmap = drawableToBitMap(drawable); remoteViews.setImageViewBitmap(id, bitmap); //emui if(OSUtils.getInstance().isEmui()) { if (notification.largeIcon == null) { notification.largeIcon = bitmap; } } } } catch (Exception e) { e.printStackTrace(); } }
drawableToBitMap(appContext.getResources().getDrawable((int) value)))); mActions.remove(action); } else if (methodName.equals("setText") && type == ReflectionActionCompat.INT) {
private static void fixNotificationIcon(Context context, Notification notification, Notification.Builder builder) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { //noinspection deprecation builder.setSmallIcon(notification.icon); //noinspection deprecation builder.setLargeIcon(notification.largeIcon); } else { Icon icon = notification.getSmallIcon(); if (icon != null) { Bitmap bitmap = drawableToBitMap(icon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setSmallIcon(newIcon); } } Icon largeIcon = notification.getLargeIcon(); if (largeIcon != null) { Bitmap bitmap = drawableToBitMap(largeIcon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setLargeIcon(newIcon); } } } }
private static void fixNotificationIcon(Context context, Notification notification, Notification.Builder builder) { if (Build.VERSION.SDK_INT < Build.VERSION_CODES.M) { //noinspection deprecation builder.setSmallIcon(notification.icon); //noinspection deprecation builder.setLargeIcon(notification.largeIcon); } else { Icon icon = notification.getSmallIcon(); if (icon != null) { Bitmap bitmap = drawableToBitMap(icon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setSmallIcon(newIcon); } } Icon largeIcon = notification.getLargeIcon(); if (largeIcon != null) { Bitmap bitmap = drawableToBitMap(largeIcon.loadDrawable(context)); if (bitmap != null) { Icon newIcon = Icon.createWithBitmap(bitmap); builder.setLargeIcon(newIcon); } } } }
@TargetApi(Build.VERSION_CODES.M) void fixIcon(Icon icon, Context appContext, boolean installed) { if (icon == null) { return; } int type = mirror.android.graphics.drawable.Icon.mType.get(icon); if (type == mirror.android.graphics.drawable.Icon.TYPE_RESOURCE) { if (installed) { mirror.android.graphics.drawable.Icon.mObj1.set(icon, appContext.getResources()); mirror.android.graphics.drawable.Icon.mString1.set(icon, appContext.getPackageName()); } else { Drawable drawable = icon.loadDrawable(appContext); Bitmap bitmap = drawableToBitMap(drawable); mirror.android.graphics.drawable.Icon.mObj1.set(icon, bitmap); mirror.android.graphics.drawable.Icon.mString1.set(icon, null); mirror.android.graphics.drawable.Icon.mType.set(icon, mirror.android.graphics.drawable.Icon.TYPE_BITMAP); } } }
@TargetApi(Build.VERSION_CODES.M) void fixIcon(Icon icon, Context appContext, boolean installed) { if (icon == null) { return; } int type = mirror.android.graphics.drawable.Icon.mType.get(icon); if (type == mirror.android.graphics.drawable.Icon.TYPE_RESOURCE) { if (installed) { mirror.android.graphics.drawable.Icon.mObj1.set(icon, appContext.getResources()); mirror.android.graphics.drawable.Icon.mString1.set(icon, appContext.getPackageName()); } else { Drawable drawable = icon.loadDrawable(appContext); Bitmap bitmap = drawableToBitMap(drawable); mirror.android.graphics.drawable.Icon.mObj1.set(icon, bitmap); mirror.android.graphics.drawable.Icon.mString1.set(icon, null); mirror.android.graphics.drawable.Icon.mType.set(icon, mirror.android.graphics.drawable.Icon.TYPE_BITMAP); } } }
void fixIconImage(Resources resources, RemoteViews remoteViews, boolean hasIconBitmap, Notification notification) { if (remoteViews == null || notification.icon == 0) return; if (!mNotificationCompat.isSystemLayout(remoteViews)) { return; } try { //noinspection deprecation int id = R_Hide.id.icon.get(); //only fake small icon if (!hasIconBitmap && notification.largeIcon == null) { Drawable drawable = resources.getDrawable(notification.icon); drawable.setLevel(notification.iconLevel); Bitmap bitmap = drawableToBitMap(drawable); remoteViews.setImageViewBitmap(id, bitmap); //emui if(OSUtils.getInstance().isEmui()) { if (notification.largeIcon == null) { notification.largeIcon = bitmap; } } } } catch (Exception e) { e.printStackTrace(); } }
void fixIconImage(Resources resources, RemoteViews remoteViews, boolean hasIconBitmap, Notification notification) { if (remoteViews == null || notification.icon == 0) return; if (!mNotificationCompat.isSystemLayout(remoteViews)) { return; } try { //noinspection deprecation int id = R_Hide.id.icon.get(); //only fake small icon if (!hasIconBitmap && notification.largeIcon == null) { Drawable drawable = resources.getDrawable(notification.icon); drawable.setLevel(notification.iconLevel); Bitmap bitmap = drawableToBitMap(drawable); remoteViews.setImageViewBitmap(id, bitmap); //emui if(OSUtils.getInstance().isEmui()) { if (notification.largeIcon == null) { notification.largeIcon = bitmap; } } } } catch (Exception e) { e.printStackTrace(); } }
drawableToBitMap(appContext.getResources().getDrawable((int) value)))); mActions.remove(action); } else if (methodName.equals("setText") && type == ReflectionActionCompat.INT) {
drawableToBitMap(appContext.getResources().getDrawable((int) value)))); mActions.remove(action); } else if (methodName.equals("setText") && type == ReflectionActionCompat.INT) {