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
diff --git a/core/java/android/widget/TextClock.java b/core/java/android/widget/TextClock.java
index 908eb0a..290d9b5 100644
--- a/core/java/android/widget/TextClock.java
+++ b/core/java/android/widget/TextClock.java
@@ -135,13 +135,11 @@
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 @@
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();
}
}