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

This commit is contained in:
TreeHugger Robot
2017-04-17 20:15:16 +00:00
committed by Android (Google) Code Review
4 changed files with 21 additions and 0 deletions

View File

@@ -49733,6 +49733,7 @@ package android.widget {
method public java.lang.String getFormat(); method public java.lang.String getFormat();
method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener(); method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener();
method public boolean isCountDown(); method public boolean isCountDown();
method public boolean isTheFinalCountDown();
method public void setBase(long); method public void setBase(long);
method public void setCountDown(boolean); method public void setCountDown(boolean);
method public void setFormat(java.lang.String); method public void setFormat(java.lang.String);

View File

@@ -53674,6 +53674,7 @@ package android.widget {
method public java.lang.String getFormat(); method public java.lang.String getFormat();
method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener(); method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener();
method public boolean isCountDown(); method public boolean isCountDown();
method public boolean isTheFinalCountDown();
method public void setBase(long); method public void setBase(long);
method public void setCountDown(boolean); method public void setCountDown(boolean);
method public void setFormat(java.lang.String); method public void setFormat(java.lang.String);

View File

@@ -50112,6 +50112,7 @@ package android.widget {
method public java.lang.String getFormat(); method public java.lang.String getFormat();
method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener(); method public android.widget.Chronometer.OnChronometerTickListener getOnChronometerTickListener();
method public boolean isCountDown(); method public boolean isCountDown();
method public boolean isTheFinalCountDown();
method public void setBase(long); method public void setBase(long);
method public void setCountDown(boolean); method public void setCountDown(boolean);
method public void setFormat(java.lang.String); method public void setFormat(java.lang.String);

View File

@@ -17,11 +17,13 @@
package android.widget; package android.widget;
import android.content.Context; import android.content.Context;
import android.content.Intent;
import android.content.res.TypedArray; import android.content.res.TypedArray;
import android.icu.text.MeasureFormat; import android.icu.text.MeasureFormat;
import android.icu.text.MeasureFormat.FormatWidth; import android.icu.text.MeasureFormat.FormatWidth;
import android.icu.util.Measure; import android.icu.util.Measure;
import android.icu.util.MeasureUnit; import android.icu.util.MeasureUnit;
import android.net.Uri;
import android.os.SystemClock; import android.os.SystemClock;
import android.text.format.DateUtils; import android.text.format.DateUtils;
import android.util.AttributeSet; import android.util.AttributeSet;
@@ -147,6 +149,22 @@ public class Chronometer extends TextView {
return mCountDown; 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. * Set the time that the count-up timer is in reference to.
* *