Skip to content

Commit fcd7ad4

Browse files
Romain GuyAndroid Git Automerger
authored andcommitted
am 59d73ab: 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
2 parents 081e6b7 + 59d73ab commit fcd7ad4

File tree

1 file changed

+7
-11
lines changed

1 file changed

+7
-11
lines changed

core/java/android/widget/TextClock.java

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -135,13 +135,11 @@ public void onChange(boolean selfChange, Uri uri) {
135135
private final BroadcastReceiver mIntentReceiver = new BroadcastReceiver() {
136136
@Override
137137
public void onReceive(Context context, Intent intent) {
138-
if (mTimeZone == null) {
139-
if (intent.getAction().equals(Intent.ACTION_TIMEZONE_CHANGED)) {
140-
final String timeZone = intent.getStringExtra("time-zone");
141-
createTime(timeZone);
142-
}
143-
onTimeChanged();
138+
if (mTimeZone == null && Intent.ACTION_TIMEZONE_CHANGED.equals(intent.getAction())) {
139+
final String timeZone = intent.getStringExtra("time-zone");
140+
createTime(timeZone);
144141
}
142+
onTimeChanged();
145143
}
146144
};
147145

@@ -406,11 +404,9 @@ private void chooseFormat(boolean handleTicker) {
406404
boolean hadSeconds = mHasSeconds;
407405
mHasSeconds = DateFormat.hasSeconds(mFormat);
408406

409-
if (handleTicker) {
410-
if (hadSeconds != mHasSeconds) {
411-
if (hadSeconds) getHandler().removeCallbacks(mTicker);
412-
else mTicker.run();
413-
}
407+
if (handleTicker && mAttached && hadSeconds != mHasSeconds) {
408+
if (hadSeconds) getHandler().removeCallbacks(mTicker);
409+
else mTicker.run();
414410
}
415411
}
416412

0 commit comments

Comments
 (0)