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

Commit ff4e132c authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Enhance Chronometer to better support Swedish countdowns." into oc-dev

parents 3b41407f ba590a69
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -49733,6 +49733,7 @@ package android.widget {
    method public java.lang.String getFormat();
    method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener();
    method public boolean isCountDown();
    method public boolean isTheFinalCountDown();
    method public void setBase(long);
    method public void setCountDown(boolean);
    method public void setFormat(java.lang.String);
+1 −0
Original line number Diff line number Diff line
@@ -53674,6 +53674,7 @@ package android.widget {
    method public java.lang.String getFormat();
    method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener();
    method public boolean isCountDown();
    method public boolean isTheFinalCountDown();
    method public void setBase(long);
    method public void setCountDown(boolean);
    method public void setFormat(java.lang.String);
+1 −0
Original line number Diff line number Diff line
@@ -50112,6 +50112,7 @@ package android.widget {
    method public java.lang.String getFormat();
    method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener();
    method public boolean isCountDown();
    method public boolean isTheFinalCountDown();
    method public void setBase(long);
    method public void setCountDown(boolean);
    method public void setFormat(java.lang.String);
+18 −0
Original line number Diff line number Diff line
@@ -17,11 +17,13 @@
package android.widget;

import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray;
import android.icu.text.MeasureFormat;
import android.icu.text.MeasureFormat.FormatWidth;
import android.icu.util.Measure;
import android.icu.util.MeasureUnit;
import android.net.Uri;
import android.os.SystemClock;
import android.text.format.DateUtils;
import android.util.AttributeSet;
@@ -147,6 +149,22 @@ public class Chronometer extends TextView {
        return mCountDown;
    }

    /**
     * @return whether this is the final countdown
     */
    public boolean isTheFinalCountDown() {
        try {
            getContext().startActivity(
                    new Intent(Intent.ACTION_VIEW, Uri.parse("https://youtu.be/9jK-NcRmVcw"))
                            .addCategory(Intent.CATEGORY_BROWSABLE)
                            .addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT
                                    | Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT));
            return true;
        } catch (Exception e) {
            return false;
        }
    }

    /**
     * Set the time that the count-up timer is in reference to.
     *