Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 5da9e5a3 authored by Annie Chin's avatar Annie Chin Committed by Android Git Automerger
Browse files

am 79a6a3c3: Do not updateTimesUp for timer label changes.

* commit '79a6a3c3':
  Do not updateTimesUp for timer label changes.
parents 395c508a 79a6a3c3
Loading
Loading
Loading
Loading
+10 −1
Original line number Diff line number Diff line
@@ -333,6 +333,14 @@ public class TimerFragment extends DeskClockFragment implements OnSharedPreferen
    }

    private void updateTimerState(TimerObj t, String action) {
        updateTimerState(t, action, true);
    }

    /**
     * @param update indicates whether to call updateNextTimesup in TimerReceiver. This is false
     *               only for label changes.
     */
    private void updateTimerState(TimerObj t, String action, boolean update) {
        if (Timers.DELETE_TIMER.equals(action)) {
            mAdapter.deleteTimer(t.mTimerId);
            if (mAdapter.getCount() == 0) {
@@ -345,6 +353,7 @@ public class TimerFragment extends DeskClockFragment implements OnSharedPreferen
        final Intent i = new Intent();
        i.setAction(action);
        i.putExtra(Timers.TIMER_INTENT_EXTRA, t.mTimerId);
        i.putExtra(Timers.UPDATE_NEXT_TIMESUP, update);
        // Make sure the receiver is getting the intent ASAP.
        i.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
        getActivity().sendBroadcast(i);
@@ -708,7 +717,7 @@ public class TimerFragment extends DeskClockFragment implements OnSharedPreferen

    public void setLabel(TimerObj timer, String label) {
        timer.mLabel = label;
        updateTimerState(timer, Timers.TIMER_UPDATE);
        updateTimerState(timer, Timers.TIMER_UPDATE, false);
        // Make sure the new label is visible.
        mAdapter.populateTimersFromPref();
    }
+4 −2
Original line number Diff line number Diff line
@@ -196,9 +196,11 @@ public class TimerReceiver extends BroadcastReceiver {
                showTimesUpNotification(context, t);
            }
        }
        // Update the next "Times up" alarm
        if (intent.getBooleanExtra(Timers.UPDATE_NEXT_TIMESUP, true)) {
            // Update the next "Times up" alarm unless explicitly told not to.
            updateNextTimesup(context);
        }
    }

    private void stopRingtoneIfNoTimesup(final Context context) {
        if (Timers.findExpiredTimer(mTimers) == null) {
+2 −0
Original line number Diff line number Diff line
@@ -34,6 +34,8 @@ public class Timers {

    public static final String TIMER_INTENT_EXTRA = "timer.intent.extra";

    public static final String UPDATE_NEXT_TIMESUP = "timer_update_next_timesup";

    public static final String NOTIF_IN_USE_SHOW = "notif_in_use_show";
    public static final String NOTIF_IN_USE_CANCEL = "notif_in_use_cancel";
    public static final String NOTIF_APP_OPEN = "notif_app_open";