Merge "Enhance Chronometer to better support Swedish countdowns." into oc-dev am: ff4e132cff
am: a49fb70e5f
Change-Id: Idf8a195e9abfa74289f6c6978382fad62f93d87b
diff --git a/api/current.txt b/api/current.txt
index c24eff8..2421f98 100644
--- a/api/current.txt
+++ b/api/current.txt
@@ -49756,6 +49756,7 @@
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);
diff --git a/api/system-current.txt b/api/system-current.txt
index 41f14ce..fbd15aa 100644
--- a/api/system-current.txt
+++ b/api/system-current.txt
@@ -53699,6 +53699,7 @@
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);
diff --git a/api/test-current.txt b/api/test-current.txt
index 1477725..e7ee6b4 100644
--- a/api/test-current.txt
+++ b/api/test-current.txt
@@ -50151,6 +50151,7 @@
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);
diff --git a/core/java/android/widget/Chronometer.java b/core/java/android/widget/Chronometer.java
index 6c6079f..d11c03a 100644
--- a/core/java/android/widget/Chronometer.java
+++ b/core/java/android/widget/Chronometer.java
@@ -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;
@@ -148,6 +150,22 @@
}
/**
+ * @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.
*
* @param base Use the {@link SystemClock#elapsedRealtime} time base.