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

Commit 6857ffc9 authored by Selim Cinek's avatar Selim Cinek Committed by Android (Google) Code Review
Browse files

Merge "Fixed a jump with the panel scrim" into mnc-dev

parents f5820276 3d395c69
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -110,6 +110,8 @@ public class HeadsUpTouchHelper implements Gefingerpoken {
                    mInitialTouchX = x;
                    mInitialTouchY = y;
                    int expandedHeight = mPickedChild.getActualHeight();
                    mPanel.setPanelScrimMinFraction((float) expandedHeight
                            / mPanel.getMaxPanelHeight());
                    mPanel.startExpandMotion(x, y, true /* startTracking */, expandedHeight
                            + mNotificationsTopPadding);
                    mHeadsUpManager.unpinAll();
+6 −1
Original line number Diff line number Diff line
@@ -1767,6 +1767,7 @@ public class NotificationPanelView extends PanelView implements
        mIsExpansionFromHeadsUp = false;
        mNotificationStackScroller.setTrackingHeadsUp(false);
        mExpandingFromHeadsUp = false;
        setPanelScrimMinFraction(0.0f);
    }

    private void setListening(boolean listening) {
@@ -2334,4 +2335,8 @@ public class NotificationPanelView extends PanelView implements
        mNotificationStackScroller.setStackHeight(stackHeight);
        updateKeyguardBottomAreaAlpha();
    }

    public void setPanelScrimMinFraction(float minFraction) {
        mBar.panelScrimMinFractionChanged(minFraction);
    }
}
+3 −1
Original line number Diff line number Diff line
@@ -25,7 +25,7 @@ import android.widget.FrameLayout;

import java.util.ArrayList;

public class PanelBar extends FrameLayout {
public abstract class PanelBar extends FrameLayout {
    public static final boolean DEBUG = false;
    public static final String TAG = PanelBar.class.getSimpleName();
    public static final void LOG(String fmt, Object... args) {
@@ -156,6 +156,8 @@ public class PanelBar extends FrameLayout {
        }
    }

    public abstract void panelScrimMinFractionChanged(float minFraction);

    /**
     * @param panel the panel which changed its expansion state
     * @param frac the fraction from the expansion in [0, 1]
+17 −1
Original line number Diff line number Diff line
@@ -40,6 +40,8 @@ public class PhoneStatusBarView extends PanelBar {
    PanelView mNotificationPanel;
    private final PhoneStatusBarTransitions mBarTransitions;
    private ScrimController mScrimController;
    private float mMinFraction;
    private float mPanelFraction;

    public PhoneStatusBarView(Context context, AttributeSet attrs) {
        super(context, attrs);
@@ -179,9 +181,23 @@ public class PhoneStatusBarView extends PanelBar {
        return mBar.interceptTouchEvent(event) || super.onInterceptTouchEvent(event);
    }

    @Override
    public void panelScrimMinFractionChanged(float minFraction) {
        if (mMinFraction != minFraction) {
            mMinFraction = minFraction;
            updateScrimFraction();
        }
    }

    @Override
    public void panelExpansionChanged(PanelView panel, float frac, boolean expanded) {
        super.panelExpansionChanged(panel, frac, expanded);
        mScrimController.setPanelExpansion(frac);
        mPanelFraction = frac;
        updateScrimFraction();
    }

    private void updateScrimFraction() {
        float scrimFraction = Math.max(mPanelFraction - mMinFraction / (1.0f - mMinFraction), 0);
        mScrimController.setPanelExpansion(scrimFraction);
    }
}