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

Commit d7d2da83 authored by Daria Evdokimova's avatar Daria Evdokimova Committed by Android (Google) Code Review
Browse files

Merge "Adjust invalid time input for 24h format" into ub-deskclock-business

parents 1c6f6b04 1ffcbb87
Loading
Loading
Loading
Loading
+3 −2
Original line number Diff line number Diff line
@@ -915,10 +915,11 @@

    <!-- String that represents that invalid time for an alarm was specified, e.g. 23:00am
     or 27:68pm.
    First %d represents hour, second %d represents minutes,
    First %d represents hour, second %d represents minutes, %s represents am/pm,
    If no am/pm is passed in (e.g. the locale uses 24h time) only hour and minute are printed.
    [CHAR LIMIT=NONE]
    -->
    <string name="invalid_time">Invalid time <xliff:g id="invalid_hour" example="25">%d</xliff:g>:<xliff:g id="invalid_minutes" example="63">%d</xliff:g> <xliff:g id="invalid_pmam" example="PM">%s</xliff:g></string>
    <string name="invalid_time">Invalid time <xliff:g id="invalid_hour" example="25">%d</xliff:g>:<xliff:g id="invalid_minutes" example="63">%d</xliff:g> <xliff:g id="invalid_ampm" example="PM">%s</xliff:g></string>

    <!-- String that represents that no alarm has been specified for a requested hour:minutes.
    This happens when a user sends a voice command 'dismiss my alarm at 3:00pm' but they have no
+3 −1
Original line number Diff line number Diff line
@@ -27,6 +27,7 @@ import com.android.deskclock.alarms.AlarmStateManager;
import com.android.deskclock.provider.Alarm;
import com.android.deskclock.provider.AlarmInstance;

import java.text.DateFormatSymbols;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.List;
@@ -81,7 +82,8 @@ class FetchMatchingAlarmsAction implements Runnable {
                badInput |= minutes < 0 || minutes > 59;

                if (badInput) {
                    final String amPm = isPm == null ? "null" : (isPm ? "pm" : "am");
                    final String[] ampm = new DateFormatSymbols().getAmPmStrings();
                    final String amPm = isPm == null ? "" : (isPm ? ampm[1] : ampm[0]);
                    final String reason = mContext.getString(R.string.invalid_time, hour, minutes,
                            amPm);
                    notifyFailureAndLog(reason, mActivity);