public static NotificationCompat create() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return new NotificationCompatCompatV21(); } else { return new NotificationCompatCompatV14(); } }
@Override public boolean dealNotification(int id, Notification notification, final String packageName) { Context appContext = getAppContext(packageName); if (appContext == null) { return false; getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, false, notification); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getNotificationFixer().fixIconImage(appContext.getResources(), notification.bigContentView, false, notification); notification.icon = getHostContext().getApplicationInfo().icon; if (isSystemLayout(notification.tickerView)) { getNotificationFixer().fixRemoteViewActions(appContext, false, notification.tickerView); } else { notification.tickerView = getRemoteViewsFixer().makeRemoteViews(id + ":tickerView", appContext, notification.tickerView, false, false); if (isSystemLayout(notification.contentView)) { boolean hasIconBitmap = getNotificationFixer().fixRemoteViewActions(appContext, false, notification.contentView); getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, hasIconBitmap, notification); } else { notification.contentView = getRemoteViewsFixer().makeRemoteViews(id + ":contentView", appContext, notification.contentView, false, true); if (isSystemLayout(notification.bigContentView)) { getNotificationFixer().fixRemoteViewActions(appContext, false, notification.bigContentView); } else { notification.bigContentView = getRemoteViewsFixer().makeRemoteViews(id + ":bigContentView", appContext, notification.bigContentView, true, true);
Context getAppContext(final String packageName) { Context context = null; try { context = getHostContext().createPackageContext(packageName, Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return context; }
Context getAppContext(final String packageName) { Context context = null; try { context = getHostContext().createPackageContext(packageName, Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return context; }
@Override public boolean dealNotification(int id, Notification notification, final String packageName) { Context appContext = getAppContext(packageName); if (appContext == null) { return false; getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, false, notification); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getNotificationFixer().fixIconImage(appContext.getResources(), notification.bigContentView, false, notification); notification.icon = getHostContext().getApplicationInfo().icon; if (isSystemLayout(notification.tickerView)) { getNotificationFixer().fixRemoteViewActions(appContext, false, notification.tickerView); } else { notification.tickerView = getRemoteViewsFixer().makeRemoteViews(id + ":tickerView", appContext, notification.tickerView, false, false); if (isSystemLayout(notification.contentView)) { boolean hasIconBitmap = getNotificationFixer().fixRemoteViewActions(appContext, false, notification.contentView); getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, hasIconBitmap, notification); } else { notification.contentView = getRemoteViewsFixer().makeRemoteViews(id + ":contentView", appContext, notification.contentView, false, true); if (isSystemLayout(notification.bigContentView)) { getNotificationFixer().fixRemoteViewActions(appContext, false, notification.bigContentView); } else { notification.bigContentView = getRemoteViewsFixer().makeRemoteViews(id + ":bigContentView", appContext, notification.bigContentView, true, true);
public static NotificationCompat create() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return new NotificationCompatCompatV21(); } else { return new NotificationCompatCompatV14(); } }
Context getAppContext(final String packageName) { Context context = null; try { context = getHostContext().createPackageContext(packageName, Context.CONTEXT_IGNORE_SECURITY | Context.CONTEXT_INCLUDE_CODE); } catch (PackageManager.NameNotFoundException e) { e.printStackTrace(); } return context; }
@Override public boolean dealNotification(int id, Notification notification, final String packageName) { Context appContext = getAppContext(packageName); if (appContext == null) { return false; getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, false, notification); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN) { getNotificationFixer().fixIconImage(appContext.getResources(), notification.bigContentView, false, notification); notification.icon = getHostContext().getApplicationInfo().icon; if (isSystemLayout(notification.tickerView)) { getNotificationFixer().fixRemoteViewActions(appContext, false, notification.tickerView); } else { notification.tickerView = getRemoteViewsFixer().makeRemoteViews(id + ":tickerView", appContext, notification.tickerView, false, false); if (isSystemLayout(notification.contentView)) { boolean hasIconBitmap = getNotificationFixer().fixRemoteViewActions(appContext, false, notification.contentView); getNotificationFixer().fixIconImage(appContext.getResources(), notification.contentView, hasIconBitmap, notification); } else { notification.contentView = getRemoteViewsFixer().makeRemoteViews(id + ":contentView", appContext, notification.contentView, false, true); if (isSystemLayout(notification.bigContentView)) { getNotificationFixer().fixRemoteViewActions(appContext, false, notification.bigContentView); } else { notification.bigContentView = getRemoteViewsFixer().makeRemoteViews(id + ":bigContentView", appContext, notification.bigContentView, true, true);
public static NotificationCompat create() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { return new NotificationCompatCompatV21(); } else { return new NotificationCompatCompatV14(); } }