diff options
| author | 2018-12-04 20:44:44 +0000 | |
|---|---|---|
| committer | 2018-12-04 20:44:44 +0000 | |
| commit | f3867a703bdaee7d24e70c7bed41f5ffe2f4999f (patch) | |
| tree | 6a4cff7a98bba5638f3cd7731db5ee5242d6ede4 | |
| parent | 37fc6eaaf44b416b142e6b45c62203cc7b8c40ea (diff) | |
| parent | ad4506ae090c313891baee35f0182f91e1f967a5 (diff) | |
Merge "Prevent clock becoming visible when icon disabled"
| -rw-r--r-- | packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java | 20 |
1 files changed, 17 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java index 8517d9086fc7..c2af95e66fe9 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Clock.java @@ -165,7 +165,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C mClockVisibleByUser = bundle.getBoolean(VISIBLE_BY_USER, true); mShowSeconds = bundle.getBoolean(SHOW_SECONDS, false); if (bundle.containsKey(VISIBILITY)) { - setVisibility(bundle.getInt(VISIBILITY)); + super.setVisibility(bundle.getInt(VISIBILITY)); } } @@ -203,6 +203,7 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C // Make sure we update to the current time updateClock(); + updateClockVisibility(); updateShowSeconds(); } @@ -247,6 +248,15 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C } }; + @Override + public void setVisibility(int visibility) { + if (visibility == View.VISIBLE && !shouldBeVisible()) { + return; + } + + super.setVisibility(visibility); + } + public void setClockVisibleByUser(boolean visible) { mClockVisibleByUser = visible; updateClockVisibility(); @@ -257,11 +267,15 @@ public class Clock extends TextView implements DemoMode, Tunable, CommandQueue.C updateClockVisibility(); } + private boolean shouldBeVisible() { + return mClockVisibleByPolicy && mClockVisibleByUser; + } + private void updateClockVisibility() { - boolean visible = mClockVisibleByPolicy && mClockVisibleByUser; + boolean visible = shouldBeVisible(); Dependency.get(IconLogger.class).onIconVisibility("clock", visible); int visibility = visible ? View.VISIBLE : View.GONE; - setVisibility(visibility); + super.setVisibility(visibility); } final void updateClock() { |