summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Romain Guy <romainguy@google.com> 2012-11-07 11:18:55 -0800
committer Android Git Automerger <android-git-automerger@android.com> 2012-11-07 11:18:55 -0800
commitfcd7ad4e28df6a408e84c6d2b2f425b029efbfbe (patch)
treec73a005f0b8f5c77ed24260952593f09ff147bc8
parent081e6b7daf8cbdaec7ae0ad626880a4576031e38 (diff)
parent59d73ab6fcc80b9e08ff06cfc13617a2f65af60e (diff)
am 59d73ab6: Merge "Respond to ticks when a timezone is set and it doesn\'t display seconds Bug #7489774" into jb-mr1-dev
* commit '59d73ab6fcc80b9e08ff06cfc13617a2f65af60e': Respond to ticks when a timezone is set and it doesn't display seconds Bug #7489774
-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();
}
}