From 74435e64865cb2f938b96ef8c32024fb8671afc3 Mon Sep 17 00:00:00 2001 From: Evan Laird Date: Fri, 4 May 2018 11:58:30 -0400 Subject: [PATCH] Remove the clock view when DISABLE_CLOCK is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Gets rid of Floating Notification Syndrome™ The easiest way to see this is launching SUW or pinned-task mode with debug.layout set to true, and see that there is no box containing the clock in these modes Test: visual; Change-Id: I518bc04d2dca2fb56f13e0cebc475929edaf2c48 Fixes: 77630482 --- .../phone/CollapsedStatusBarFragment.java | 18 +++++++++++++----- .../phone/CollapsedStatusBarFragmentTest.java | 2 +- 2 files changed, 14 insertions(+), 6 deletions(-) diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java index 9fcb0905263c2..ee83250038703 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragment.java @@ -212,7 +212,7 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue } public void hideClock(boolean animate) { - animateHide(mClockView, animate); + animateHiddenState(mClockView, View.GONE, animate); } public void showClock(boolean animate) { @@ -240,21 +240,29 @@ public class CollapsedStatusBarFragment extends Fragment implements CommandQueue } /** - * Hides a view. + * Animate a view to INVISIBLE or GONE */ - private void animateHide(final View v, boolean animate) { + private void animateHiddenState(final View v, int state, boolean animate) { v.animate().cancel(); if (!animate) { v.setAlpha(0f); - v.setVisibility(View.INVISIBLE); + v.setVisibility(state); return; } + v.animate() .alpha(0f) .setDuration(160) .setStartDelay(0) .setInterpolator(Interpolators.ALPHA_OUT) - .withEndAction(() -> v.setVisibility(View.INVISIBLE)); + .withEndAction(() -> v.setVisibility(state)); + } + + /** + * Hides a view. + */ + private void animateHide(final View v, boolean animate) { + animateHiddenState(v, View.INVISIBLE, animate); } /** diff --git a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragmentTest.java b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragmentTest.java index 9e8fa2243cccf..231cdf5e8e7da 100644 --- a/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragmentTest.java +++ b/packages/SystemUI/tests/src/com/android/systemui/statusbar/phone/CollapsedStatusBarFragmentTest.java @@ -121,7 +121,7 @@ public class CollapsedStatusBarFragmentTest extends SysuiBaseFragmentTest { fragment.initNotificationIconArea(mMockNotificiationAreaController); fragment.disable(StatusBarManager.DISABLE_CLOCK, 0, false); - assertEquals(View.INVISIBLE, mFragment.getView().findViewById(R.id.clock).getVisibility()); + assertEquals(View.GONE, mFragment.getView().findViewById(R.id.clock).getVisibility()); fragment.disable(0, 0, false);