com.oasisfeng.nevo.sdk.MutableNotification Java Examples
The following examples show how to use
com.oasisfeng.nevo.sdk.MutableNotification.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SubscribeDecoratorService.java From nevo-decorators-sms-captchas with GNU General Public License v3.0 | 6 votes |
@Override protected void apply(MutableStatusBarNotification evolving) { MutableNotification notification = evolving.getNotification(); Bundle extras = notification.extras; CharSequence message = extras.getCharSequence(Notification.EXTRA_TEXT); if (message == null || extras.getBoolean(Global.NOTIFICATION_EXTRA_APPLIED, false) || !message.toString().matches(mSettings.getSubscribeIdentifyPattern())) return; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) notification.setChannelId(NOTIFICATION_CHANNEL_SUBSCRIBE_DEFAULT); else notification.priority = mSettings.getSubscribePriority(); appendActions(notification ,evolving.getKey() ,new Notification.Action[0]); extras.putBoolean(Global.NOTIFICATION_EXTRA_APPLIED, true); Log.i(TAG, "Applied " + evolving.getKey()); }
Example #2
Source File: CaptchaDecoratorService.java From nevo-decorators-sms-captchas with GNU General Public License v3.0 | 5 votes |
@Override protected void apply(MutableStatusBarNotification evolving) { MutableNotification notification = evolving.getNotification(); Bundle extras = notification.extras; boolean recast = extras.getBoolean(NOTIFICATION_EXTRA_RECAST, false); NotificationUtils.Messages messages = NotificationUtils.parseMessages(notification); String[] captchas = mCaptchaUtils.findSmsCaptchas(messages.texts); if (captchas.length == 0) return; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) notification.setChannelId(recast ? NOTIFICATION_CHANNEL_CAPTCHA_SILENT : NOTIFICATION_CHANNEL_CAPTCHA_NORMAL); else notification.priority = recast ? Notification.PRIORITY_LOW : Notification.PRIORITY_HIGH; KeyguardManager keyguardManager = (KeyguardManager) getSystemService(Context.KEYGUARD_SERVICE); if (mSettings.isCaptchaHideOnLocked() && keyguardManager != null && keyguardManager.isKeyguardLocked()) applyKeyguardLocked(notification, evolving.getKey(), messages, captchas); else applyKeyguardUnlocked(notification, evolving.getKey(), messages, captchas); notification.flags |= Notification.FLAG_ONLY_ALERT_ONCE; notification.visibility = Notification.VISIBILITY_PUBLIC; extras.putBoolean(Global.NOTIFICATION_EXTRA_APPLIED, true); mAppliedKeys.add(evolving.getKey()); Log.i(TAG, "Applied " + evolving.getKey()); }
Example #3
Source File: ScreenshotDecorator.java From EnhancedScreenshotNotification with GNU General Public License v3.0 | 5 votes |
private static boolean isScreenshotNotification(@Nullable MutableNotification n) { if (n == null) { return false; } if (n.extras == null || !n.extras.containsKey(Notification.EXTRA_TEMPLATE)) { return false; } if (!TEMPLATE_BIG_PICTURE.equals(n.extras.getString(Notification.EXTRA_TEMPLATE))) { return false; } if (n.actions == null || n.actions.length < 1) { return false; } return true; }