summaryrefslogtreecommitdiff
path: root/core/java
diff options
context:
space:
mode:
authorRomain Guy <romainguy@google.com>2012-11-08 15:34:12 -0800
committerAndroid Git Automerger <android-git-automerger@android.com>2012-11-08 15:34:12 -0800
commit11d43794b92e917bebc527d6e597eb6bd6581bfb (patch)
tree43b4563f266a78cf166d39faac96096e04054724 /core/java
parent69097e5041d2d99497c2d4afb33ac4bd3f46c264 (diff)
parentde60dd2d136557ff7dce52c37625c4475ef42e7d (diff)
am de60dd2d: am fcd7ad4e: am 59d73ab6: Merge "Respond to ticks when a timezone is set and it doesn\'t display seconds Bug #7489774" into jb-mr1-dev
* commit 'de60dd2d136557ff7dce52c37625c4475ef42e7d': Respond to ticks when a timezone is set and it doesn't display seconds Bug #7489774
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/TextClock.java18
1 files changed, 7 insertions, 11 deletions
diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java
index 908eb0a8fe51..290d9b5b4a52 100644
--- a/core/java/android/widget/TextClock.java
+++ b/core/java/android/widget/TextClock.java
@@ -135,13 +135,11 @@ public class TextClock extends TextView {
private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
- if (mTimeZone == null) {
- if (intent.getAction().equals(Intent.ACTION_TIMEZONE_CHANGED)) {
- final String timeZone = intent.getStringExtra("time-zone");
- createTime(timeZone);
- }
- onTimeChanged();
+ if (mTimeZone == null && Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
+ final String timeZone = intent.getStringExtra("time-zone");
+ createTime(timeZone);
}
+ onTimeChanged();
}
};
@@ -406,11 +404,9 @@ public class TextClock extends TextView {
boolean hadSeconds = mHasSeconds;
mHasSeconds = DateFormat.hasSeconds(mFormat);
- if (handleTicker) {
- if (hadSeconds != mHasSeconds) {
- if (hadSeconds) getHandler().removeCallbacks(mTicker);
- else mTicker.run();
- }
+ if (handleTicker && mAttached && hadSeconds != mHasSeconds) {
+ if (hadSeconds) getHandler().removeCallbacks(mTicker);
+ else mTicker.run();
}
}