コード例 #1
0
 private NotificationCompat.Action getNotificationAction() {
   final NotificationCompat.Action action;
   if (pomodoroMaster.isOngoing()) {
     action = buildStopAction(context);
   } else {
     ActivityType activityType = pomodoroMaster.getActivityType();
     if (activityType == ActivityType.NONE) {
       activityType = ActivityType.POMODORO;
     }
     action = buildStartAction(context, activityType);
   }
   return action;
 }
コード例 #2
0
 public String titleForActivityType(@NonNull Context context) {
   if (pomodoroMaster.isOngoing()) {
     if (pomodoroMaster.getNextPomodoro() == null) {
       return null;
     }
     final String minutesLeft =
         Utils.convertDiffToPrettyMinutesLeft(
             context, pomodoroMaster.getNextPomodoro().minus(DateTime.now().getMillis()));
     return minutesLeft
         + " | "
         + Utils.getActivityTitle(context, pomodoroMaster, /* shorten */ true);
   } else {
     if (pomodoroMaster.getActivityType() == ActivityType.NONE) {
       return context.getString(R.string.title_none);
     } else {
       return context.getString(R.string.title_finished);
     }
   }
 }