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

Commit a94742c7 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Added convenience methods to use chronometer countdown methods" into nyc-dev

parents 77ca74d9 81c23aac
Loading
Loading
Loading
Loading
+3 −0
Original line number Diff line number Diff line
@@ -4907,6 +4907,7 @@ package android.app {
    field public static final int DEFAULT_VIBRATE = 2; // 0x2
    field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
    field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText";
    field public static final java.lang.String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown";
    field public static final java.lang.String EXTRA_COMPACT_ACTIONS = "android.compactActions";
    field public static final java.lang.String EXTRA_INFO_TEXT = "android.infoText";
    field public static final java.lang.String EXTRA_LARGE_ICON = "android.largeIcon";
@@ -5058,6 +5059,7 @@ package android.app {
    method public android.app.Notification.Builder setActions(android.app.Notification.Action...);
    method public android.app.Notification.Builder setAutoCancel(boolean);
    method public android.app.Notification.Builder setCategory(java.lang.String);
    method public android.app.Notification.Builder setChronometerCountsDown(boolean);
    method public android.app.Notification.Builder setColor(int);
    method public deprecated android.app.Notification.Builder setContent(android.widget.RemoteViews);
    method public android.app.Notification.Builder setContentInfo(java.lang.CharSequence);
@@ -47216,6 +47218,7 @@ package android.widget {
    method public void setChar(int, java.lang.String, char);
    method public void setCharSequence(int, java.lang.String, java.lang.CharSequence);
    method public void setChronometer(int, long, java.lang.String, boolean);
    method public void setChronometerCountsDown(int, boolean);
    method public void setContentDescription(int, java.lang.CharSequence);
    method public void setDisplayedChild(int, int);
    method public void setDouble(int, java.lang.String, double);
+3 −0
Original line number Diff line number Diff line
@@ -5039,6 +5039,7 @@ package android.app {
    field public static final int DEFAULT_VIBRATE = 2; // 0x2
    field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
    field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText";
    field public static final java.lang.String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown";
    field public static final java.lang.String EXTRA_COMPACT_ACTIONS = "android.compactActions";
    field public static final java.lang.String EXTRA_INFO_TEXT = "android.infoText";
    field public static final java.lang.String EXTRA_LARGE_ICON = "android.largeIcon";
@@ -5190,6 +5191,7 @@ package android.app {
    method public android.app.Notification.Builder setActions(android.app.Notification.Action...);
    method public android.app.Notification.Builder setAutoCancel(boolean);
    method public android.app.Notification.Builder setCategory(java.lang.String);
    method public android.app.Notification.Builder setChronometerCountsDown(boolean);
    method public android.app.Notification.Builder setColor(int);
    method public deprecated android.app.Notification.Builder setContent(android.widget.RemoteViews);
    method public android.app.Notification.Builder setContentInfo(java.lang.CharSequence);
@@ -50334,6 +50336,7 @@ package android.widget {
    method public void setChar(int, java.lang.String, char);
    method public void setCharSequence(int, java.lang.String, java.lang.CharSequence);
    method public void setChronometer(int, long, java.lang.String, boolean);
    method public void setChronometerCountsDown(int, boolean);
    method public void setContentDescription(int, java.lang.CharSequence);
    method public void setDisplayedChild(int, int);
    method public void setDouble(int, java.lang.String, double);
+3 −0
Original line number Diff line number Diff line
@@ -4907,6 +4907,7 @@ package android.app {
    field public static final int DEFAULT_VIBRATE = 2; // 0x2
    field public static final java.lang.String EXTRA_BACKGROUND_IMAGE_URI = "android.backgroundImageUri";
    field public static final java.lang.String EXTRA_BIG_TEXT = "android.bigText";
    field public static final java.lang.String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown";
    field public static final java.lang.String EXTRA_COMPACT_ACTIONS = "android.compactActions";
    field public static final java.lang.String EXTRA_INFO_TEXT = "android.infoText";
    field public static final java.lang.String EXTRA_LARGE_ICON = "android.largeIcon";
@@ -5058,6 +5059,7 @@ package android.app {
    method public android.app.Notification.Builder setActions(android.app.Notification.Action...);
    method public android.app.Notification.Builder setAutoCancel(boolean);
    method public android.app.Notification.Builder setCategory(java.lang.String);
    method public android.app.Notification.Builder setChronometerCountsDown(boolean);
    method public android.app.Notification.Builder setColor(int);
    method public deprecated android.app.Notification.Builder setContent(android.widget.RemoteViews);
    method public android.app.Notification.Builder setContentInfo(java.lang.CharSequence);
@@ -47233,6 +47235,7 @@ package android.widget {
    method public void setChar(int, java.lang.String, char);
    method public void setCharSequence(int, java.lang.String, java.lang.CharSequence);
    method public void setChronometer(int, long, java.lang.String, boolean);
    method public void setChronometerCountsDown(int, boolean);
    method public void setContentDescription(int, java.lang.CharSequence);
    method public void setDisplayedChild(int, int);
    method public void setDouble(int, java.lang.String, double);
+27 −0
Original line number Diff line number Diff line
@@ -822,6 +822,12 @@ public class Notification implements Parcelable
     */
    public static final String EXTRA_SHOW_CHRONOMETER = "android.showChronometer";

    /**
     * {@link #extras} key: whether the chronometer set on the notification should count down
     * instead of counting up. Is only relevant if key {@link #EXTRA_SHOW_CHRONOMETER} is present.
     */
    public static final String EXTRA_CHRONOMETER_COUNTS_DOWN = "android.chronometerCountsDown";

    /**
     * {@link #extras} key: whether {@link #when} should be shown,
     * as supplied to {@link Builder#setShowWhen(boolean)}.
@@ -2158,14 +2164,31 @@ public class Notification implements Parcelable
         *
         * Useful when showing an elapsed time (like an ongoing phone call).
         *
         * The counter can also be set to count down to <code>when</code> when using
         * {@link #setChronometerCountsDown(boolean)}.
         *
         * @see android.widget.Chronometer
         * @see Notification#when
         * @see #setChronometerCountsDown(boolean)
         */
        public Builder setUsesChronometer(boolean b) {
            mN.extras.putBoolean(EXTRA_SHOW_CHRONOMETER, b);
            return this;
        }

        /**
         * Sets the Chronometer to count down instead of counting up.
         *
         * <p>This is only relevant if {@link #setUsesChronometer(boolean)} has been set to true.
         * If it isn't set the chronometer will count up.
         *
         * @see #setUsesChronometer(boolean)
         */
        public Builder setChronometerCountsDown(boolean countsDown) {
            mN.extras.putBoolean(EXTRA_CHRONOMETER_COUNTS_DOWN, countsDown);
            return this;
        }

        /**
         * Set the small icon resource, which will be used to represent the notification in the
         * status bar.
@@ -3097,6 +3120,8 @@ public class Notification implements Parcelable
                    contentView.setLong(R.id.chronometer, "setBase",
                            mN.when + (SystemClock.elapsedRealtime() - System.currentTimeMillis()));
                    contentView.setBoolean(R.id.chronometer, "setStarted", true);
                    boolean countsDown = mN.extras.getBoolean(EXTRA_CHRONOMETER_COUNTS_DOWN);
                    contentView.setChronometerCountsDown(R.id.chronometer, countsDown);
                } else {
                    contentView.setViewVisibility(R.id.time, View.VISIBLE);
                    contentView.setLong(R.id.time, "setTime", mN.when);
@@ -3328,6 +3353,8 @@ public class Notification implements Parcelable
                    savedBundle.getBoolean(EXTRA_SHOW_WHEN));
            publicExtras.putBoolean(EXTRA_SHOW_CHRONOMETER,
                    savedBundle.getBoolean(EXTRA_SHOW_CHRONOMETER));
            publicExtras.putBoolean(EXTRA_CHRONOMETER_COUNTS_DOWN,
                    savedBundle.getBoolean(EXTRA_CHRONOMETER_COUNTS_DOWN));
            publicExtras.putCharSequence(EXTRA_TITLE,
                    mContext.getString(R.string.notification_hidden_text));
            mN.extras = publicExtras;
+14 −0
Original line number Diff line number Diff line
@@ -2563,6 +2563,8 @@ public class RemoteViews implements Parcelable, Filter {
     * @param format The Chronometer format string, or null to
     *               simply display the timer value.
     * @param started True if you want the clock to be started, false if not.
     *
     * @see #setChronometerCountsDown(int, boolean)
     */
    public void setChronometer(int viewId, long base, String format, boolean started) {
        setLong(viewId, "setBase", base);
@@ -2570,6 +2572,18 @@ public class RemoteViews implements Parcelable, Filter {
        setBoolean(viewId, "setStarted", started);
    }

    /**
     * Equivalent to calling {@link Chronometer#setCountDown(boolean) Chronometer.setCountDown} on
     * the chronometer with the given viewId.
     *
     * @param viewId The id of the {@link Chronometer} to change
     * @param isCountDown True if you want the chronometer to count down to base instead of
     *                    counting up.
     */
    public void setChronometerCountsDown(int viewId, boolean isCountDown) {
        setBoolean(viewId, "setCountDown", isCountDown);
    }

    /**
     * Equivalent to calling {@link ProgressBar#setMax ProgressBar.setMax},
     * {@link ProgressBar#setProgress ProgressBar.setProgress}, and