android.R.drawable.ic_btn_speak_now, ctxt.getString(R.string.talk), pi).addRemoteInput(remoteInput).build();
android.R.drawable.ic_btn_speak_now, getString(R.string.talk), pi).addRemoteInput(remoteInput).build();
android.R.drawable.ic_btn_speak_now, getString(R.string.talk), pi).addRemoteInput(remoteInput).build();
private static NotificationCompat.Action buildStartWorkAction(Context context) { PendingIntent togglePendingIntent = PendingIntent.getService(context, 0, new IntentWithAction(context, TimerService.class, Constants.ACTION.START_WORK), 0); return new NotificationCompat.Action.Builder( R.drawable.ic_notification_resume, "START WORK", togglePendingIntent).build(); }
private static NotificationCompat.Action buildPauseAction(Context context) { PendingIntent togglePendingIntent = PendingIntent.getService(context, 0, new IntentWithAction(context, TimerService.class, Constants.ACTION.TOGGLE), 0); return new NotificationCompat.Action.Builder( R.drawable.ic_notification_pause, "PAUSE", togglePendingIntent).build(); }
private static NotificationCompat.Action buildStopAction(Context context) { PendingIntent stopPendingIntent = PendingIntent.getService(context, 0, new IntentWithAction(context, TimerService.class, Constants.ACTION.STOP), 0); return new NotificationCompat.Action.Builder( R.drawable.ic_notification_stop, "STOP", stopPendingIntent).build(); }
private static NotificationCompat.Action buildSkipBreakAction(Context context) { PendingIntent togglePendingIntent = PendingIntent.getService(context, 0, new IntentWithAction(context, TimerService.class, Constants.ACTION.SKIP_BREAK), 0); return new NotificationCompat.Action.Builder( R.drawable.ic_notification_skip, "SKIP BREAK", togglePendingIntent).build(); } }
private static NotificationCompat.Action buildStartBreakAction(Context context) { PendingIntent togglePendingIntent = PendingIntent.getService(context, 0, new IntentWithAction(context, TimerService.class, Constants.ACTION.START_BREAK), 0); return new NotificationCompat.Action.Builder( R.drawable.ic_notification_resume, "START BREAK", togglePendingIntent).build(); }
private static NotificationCompat.Action buildResumeAction(Context context) { PendingIntent togglePendingIntent = PendingIntent.getService(context, 0, new IntentWithAction(context, TimerService.class, Constants.ACTION.TOGGLE), 0); return new NotificationCompat.Action.Builder( R.drawable.ic_notification_resume, "RESUME", togglePendingIntent).build(); }
.addRemoteInput(remoteInput.build()).build());
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); NotificationManager mgr= (NotificationManager)getSystemService(NOTIFICATION_SERVICE); if (Build.VERSION.SDK_INT>=Build.VERSION_CODES.O && mgr.getNotificationChannel(CHANNEL_WHATEVER)==null) { mgr.createNotificationChannel(new NotificationChannel(CHANNEL_WHATEVER, "Whatever", NotificationManager.IMPORTANCE_DEFAULT)); } NotificationCompat.Builder normal=buildNormal(); NotificationCompat.Action.Builder wearActionBuilder= new NotificationCompat.Action.Builder(android.R.drawable.ic_media_pause, getString(R.string.pause), buildPendingIntent(Settings.ACTION_DATE_SETTINGS)); NotificationCompat.Builder extended= new NotificationCompat.WearableExtender() .addAction(wearActionBuilder.build()) .extend(normal); NotificationManagerCompat.from(this).notify(NOTIFY_ID, extended.build()); finish(); }
private void addArchiveAllAction(WearableExtender wearableExtender, NotificationData notificationData) { int icon = resourceProvider.getWearIconArchive(); String title = resourceProvider.actionArchiveAll(); Account account = notificationData.getAccount(); ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences(); int notificationId = NotificationIds.getNewMailSummaryNotificationId(account); PendingIntent action = actionCreator.createArchiveAllPendingIntent(account, messageReferences, notificationId); NotificationCompat.Action archiveAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(archiveAction); }
private void addMarkAllAsReadAction(WearableExtender wearableExtender, NotificationData notificationData) { int icon = resourceProvider.getWearIconMarkAsRead(); String title = resourceProvider.actionMarkAllAsRead(); Account account = notificationData.getAccount(); ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences(); int notificationId = NotificationIds.getNewMailSummaryNotificationId(account); PendingIntent action = actionCreator.createMarkAllAsReadPendingIntent( account, messageReferences, notificationId); NotificationCompat.Action markAsReadAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(markAsReadAction); }
private void addDeleteAction(WearableExtender wearableExtender, NotificationHolder holder) { int icon = resourceProvider.getWearIconDelete(); String title = resourceProvider.actionDelete(); MessageReference messageReference = holder.content.messageReference; int notificationId = holder.notificationId; PendingIntent action = actionCreator.createDeleteMessagePendingIntent(messageReference, notificationId); NotificationCompat.Action deleteAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(deleteAction); }
private void addArchiveAction(WearableExtender wearableExtender, NotificationHolder holder) { int icon = resourceProvider.getWearIconArchive(); String title = resourceProvider.actionArchive(); MessageReference messageReference = holder.content.messageReference; int notificationId = holder.notificationId; PendingIntent action = actionCreator.createArchiveMessagePendingIntent(messageReference, notificationId); NotificationCompat.Action archiveAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(archiveAction); }
private void addMarkAsReadAction(WearableExtender wearableExtender, NotificationHolder holder) { int icon = resourceProvider.getWearIconMarkAsRead(); String title = resourceProvider.actionMarkAsRead(); MessageReference messageReference = holder.content.messageReference; int notificationId = holder.notificationId; PendingIntent action = actionCreator.createMarkMessageAsReadPendingIntent(messageReference, notificationId); NotificationCompat.Action markAsReadAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(markAsReadAction); }
private void addDeleteAllAction(WearableExtender wearableExtender, NotificationData notificationData) { int icon = resourceProvider.getWearIconDelete(); String title = resourceProvider.actionDeleteAll(); Account account = notificationData.getAccount(); ArrayList<MessageReference> messageReferences = notificationData.getAllMessageReferences(); int notificationId = NotificationIds.getNewMailSummaryNotificationId(account); PendingIntent action = actionCreator.createDeleteAllPendingIntent(account, messageReferences, notificationId); NotificationCompat.Action deleteAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(deleteAction); }
private void addMarkAsSpamAction(WearableExtender wearableExtender, NotificationHolder holder) { int icon = resourceProvider.getWearIconMarkAsSpam(); String title = resourceProvider.actionMarkAsSpam(); MessageReference messageReference = holder.content.messageReference; int notificationId = holder.notificationId; PendingIntent action = actionCreator.createMarkMessageAsSpamPendingIntent(messageReference, notificationId); NotificationCompat.Action spamAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(spamAction); }
private void addReplyAction(WearableExtender wearableExtender, NotificationHolder holder) { int icon = resourceProvider.getWearIconReplyAll(); String title = resourceProvider.actionReply(); MessageReference messageReference = holder.content.messageReference; int notificationId = holder.notificationId; PendingIntent action = actionCreator.createReplyPendingIntent(messageReference, notificationId); NotificationCompat.Action replyAction = new NotificationCompat.Action.Builder(icon, title, action).build(); wearableExtender.addAction(replyAction); }
@Test public void addAction__shouldAddActionToNotification() { NotificationCompat.Action action = new NotificationCompat.Action.Builder(R.drawable.ic_corp_icon, "a title", null).build(); Notification notification = new NotificationCompat.Builder(RuntimeEnvironment.application) .addAction(action) .build(); assertThat(notification.actions).asList().hasSize(1); } }