Fixed a jump with the panel scrim
Bug: 21764980 Change-Id: Ib09aa025143025178a9e21390f3a06b37a067e3e
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -1759,6 +1759,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
mIsExpansionFromHeadsUp = false;
|
||||
mNotificationStackScroller.setTrackingHeadsUp(false);
|
||||
mExpandingFromHeadsUp = false;
|
||||
setPanelScrimMinFraction(0.0f);
|
||||
}
|
||||
|
||||
private void setListening(boolean listening) {
|
||||
@@ -2309,7 +2310,7 @@ public class NotificationPanelView extends PanelView implements
|
||||
}
|
||||
x = Math.min(rightMost, Math.max(leftMost, x));
|
||||
setVerticalPanelTranslation(x -
|
||||
(mNotificationStackScroller.getLeft() + mNotificationStackScroller.getWidth()/2));
|
||||
(mNotificationStackScroller.getLeft() + mNotificationStackScroller.getWidth() / 2));
|
||||
}
|
||||
|
||||
private void resetVerticalPanelPosition() {
|
||||
@@ -2326,4 +2327,8 @@ public class NotificationPanelView extends PanelView implements
|
||||
mNotificationStackScroller.setStackHeight(stackHeight);
|
||||
updateKeyguardBottomAreaAlpha();
|
||||
}
|
||||
|
||||
public void setPanelScrimMinFraction(float minFraction) {
|
||||
mBar.panelScrimMinFractionChanged(minFraction);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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) {
|
||||
@@ -153,6 +153,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]
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user