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

Commit e5011a3a authored by Daniel Sandler's avatar Daniel Sandler
Browse files

Suppress header flash when collapsing notifications panel.

LayoutTransition is poking through and it shouldn't be.

This change also fixes a few related animation glitches
around the carrier label and fling velocity.

Bug: 6628429
Change-Id: I6655c9f9a8c95c7abd9c6d7099957cb229b86d5a
parent 913bf804
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -87,6 +87,8 @@
    <dimen name="fling_collapse_min_velocity">200dp</dimen>
    <!-- Cap on contribution of x dimension of gesture to overall velocity -->
    <dimen name="fling_gesture_max_x_velocity">200dp</dimen>
    <!-- Cap on overall resulting fling speed (s^-1) -->
    <dimen name="fling_gesture_max_output_velocity">3000dp</dimen>

    <!-- Minimum fraction of the display a gesture must travel, at any velocity, to qualify as a
         collapse request -->
+17 −6
Original line number Diff line number Diff line
@@ -134,6 +134,9 @@ public class PhoneStatusBar extends BaseStatusBar {
    private float mExpandAccelPx; // classic value: 2000px/s/s
    private float mCollapseAccelPx; // classic value: 2000px/s/s (will be negated to collapse "up")

    private float mFlingGestureMaxOutputVelocityPx; // how fast can it really go? (should be a little 
                                                    // faster than mSelfCollapseVelocityPx)

    PhoneStatusBarPolicy mIconPolicy;

    // These are no longer handled by the policy, because we need custom strategies for them
@@ -392,12 +395,13 @@ public class PhoneStatusBar extends BaseStatusBar {
        mTickerView = mStatusBarView.findViewById(R.id.ticker);

        mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems);
        mPile.setLayoutTransitionsEnabled(false);
        mPile.setLongPressListener(getNotificationLongClicker());
        if (SHOW_CARRIER_LABEL) {
            mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
                @Override
                public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
                    updateCarrierLabelVisibility();
                    updateCarrierLabelVisibility(false);
                }
            });
        }
@@ -889,7 +893,7 @@ public class PhoneStatusBar extends BaseStatusBar {
        }
    }

    protected void updateCarrierLabelVisibility() {
    protected void updateCarrierLabelVisibility(boolean force) {
        if (!SHOW_CARRIER_LABEL) return;
        // The idea here is to only show the carrier label when there is enough room to see it, 
        // i.e. when there aren't enough notifications to fill the panel.
@@ -901,7 +905,7 @@ public class PhoneStatusBar extends BaseStatusBar {
        final boolean makeVisible = 
            mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
        
        if (mCarrierLabelVisible != makeVisible) {
        if (force || mCarrierLabelVisible != makeVisible) {
            mCarrierLabelVisible = makeVisible;
            if (DEBUG) {
                Slog.d(TAG, "making carrier label " + (makeVisible?"visible":"invisible"));
@@ -986,7 +990,7 @@ public class PhoneStatusBar extends BaseStatusBar {
                .start();
        }

        updateCarrierLabelVisibility();
        updateCarrierLabelVisibility(false);
    }

    public void showClock(boolean show) {
@@ -1159,9 +1163,10 @@ public class PhoneStatusBar extends BaseStatusBar {
        }

        mExpandedVisible = true;
        mPile.setLayoutTransitionsEnabled(true);
        makeSlippery(mNavigationBarView, true);

        updateCarrierLabelVisibility();
        updateCarrierLabelVisibility(true);

        updateExpandedViewPos(EXPANDED_LEAVE_ALONE);

@@ -1279,6 +1284,7 @@ public class PhoneStatusBar extends BaseStatusBar {
            return;
        }
        mExpandedVisible = false;
        mPile.setLayoutTransitionsEnabled(false);
        visibilityChanged(false);
        makeSlippery(mNavigationBarView, false);

@@ -1562,6 +1568,9 @@ public class PhoneStatusBar extends BaseStatusBar {
                }

                float vel = (float)Math.hypot(yVel, xVel);
                if (vel > mFlingGestureMaxOutputVelocityPx) {
                    vel = mFlingGestureMaxOutputVelocityPx;
                }
                if (negative) {
                    vel = -vel;
                }
@@ -2041,7 +2050,7 @@ public class PhoneStatusBar extends BaseStatusBar {
            mStatusBarWindow.setBackgroundColor(color);
        }
        
        updateCarrierLabelVisibility();
        updateCarrierLabelVisibility(false);
    }

    void updateDisplaySize() {
@@ -2268,6 +2277,8 @@ public class PhoneStatusBar extends BaseStatusBar {

        mFlingGestureMaxXVelocityPx = res.getDimension(R.dimen.fling_gesture_max_x_velocity);

        mFlingGestureMaxOutputVelocityPx = res.getDimension(R.dimen.fling_gesture_max_output_velocity);

        mNotificationPanelMarginBottomPx
            = (int) res.getDimension(R.dimen.notification_panel_margin_bottom);
        mNotificationPanelMarginLeftPx
+18 −3
Original line number Diff line number Diff line
@@ -68,6 +68,8 @@ public class NotificationRowLayout
    // animation is done
    boolean mRemoveViews = true;

    private LayoutTransition mRealLayoutTransition;

    public NotificationRowLayout(Context context, AttributeSet attrs) {
        this(context, attrs, 0);
    }
@@ -75,7 +77,8 @@ public class NotificationRowLayout
    public NotificationRowLayout(Context context, AttributeSet attrs, int defStyle) {
        super(context, attrs, defStyle);

        setLayoutTransition(new LayoutTransition());
        mRealLayoutTransition = new LayoutTransition();
        setLayoutTransitionsEnabled(true);
        
        setOrientation(LinearLayout.VERTICAL);

@@ -121,9 +124,9 @@ public class NotificationRowLayout

    private void logLayoutTransition() {
        Log.v(TAG, "layout " +
              (getLayoutTransition().isChangingLayout() ? "is " : "is not ") +
              (mRealLayoutTransition.isChangingLayout() ? "is " : "is not ") +
              "in transition and animations " +
              (getLayoutTransition().isRunning() ? "are " : "are not ") +
              (mRealLayoutTransition.isRunning() ? "are " : "are not ") +
              "running.");
    }

@@ -225,6 +228,18 @@ public class NotificationRowLayout
        mRemoveViews = removeViews;
    }

    // Suppress layout transitions for a little while.
    public void setLayoutTransitionsEnabled(boolean b) {
        if (b) {
            setLayoutTransition(mRealLayoutTransition);
        } else {
            if (mRealLayoutTransition.isRunning()) {
                mRealLayoutTransition.cancel();
            }
            setLayoutTransition(null);
        }
    }

    public void dismissRowAnimated(View child) {
        dismissRowAnimated(child, 0);
    }