com.oasisfeng.nevo.sdk.MutableStatusBarNotification Java Examples
The following examples show how to use
com.oasisfeng.nevo.sdk.MutableStatusBarNotification.
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 |
ScreenshotProcessor(Context context, MutableStatusBarNotification evolving) { this.context = context; this.evolving = evolving; this.n = evolving.getNotification(); grantedPermission = PermissionRequestActivity .checkIfPermissionTypeGranted(context, PermissionRequestActivity.TYPE_STORAGE); }
Example #4
Source File: MessagingBuilder.java From decorator-wechat with Apache License 2.0 | 5 votes |
/** Intercept the PendingIntent in RemoteInput to update the notification with replied message upon success. */ private PendingIntent proxyDirectReply(final int cid, final MutableStatusBarNotification sbn, final PendingIntent on_reply, final RemoteInput remote_input, final @Nullable CharSequence[] input_history, final @Nullable String mention_prefix) { final Intent proxy = new Intent(mention_prefix != null ? ACTION_MENTION : ACTION_REPLY) // Separate action to avoid PendingIntent overwrite. .setData(Uri.fromParts(SCHEME_KEY, sbn.getKey(), null)) .putExtra(EXTRA_REPLY_ACTION, on_reply).putExtra(EXTRA_RESULT_KEY, remote_input.getResultKey()) .putExtra(EXTRA_ORIGINAL_KEY, sbn.getOriginalKey()).putExtra(EXTRA_CONVERSATION_ID, cid); if (mention_prefix != null) proxy.putExtra(EXTRA_REPLY_PREFIX, mention_prefix); if (SDK_INT >= N && input_history != null) proxy.putCharSequenceArrayListExtra(EXTRA_REMOTE_INPUT_HISTORY, new ArrayList<>(Arrays.asList(input_history))); return PendingIntent.getBroadcast(mContext, 0, proxy.setPackage(mContext.getPackageName()), FLAG_UPDATE_CURRENT); }
Example #5
Source File: ScreenshotDecorator.java From EnhancedScreenshotNotification with GNU General Public License v3.0 | 4 votes |
@Override protected void apply(MutableStatusBarNotification evolving) { final ScreenshotProcessor processor = new ScreenshotProcessor(this, evolving); processor.process(); }