Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 74435e64 authored by Evan Laird's avatar Evan Laird
Browse files

Remove the clock view when DISABLE_CLOCK is set

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
parent 91a14dec
Loading
Loading
Loading
Loading
+13 −5
Original line number Diff line number Diff line
@@ -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);
    }

    /**
+1 −1
Original line number Diff line number Diff line
@@ -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);