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

This commit is contained in:
Selim Cinek
2015-06-17 18:23:06 +00:00
committed by Android (Google) Code Review
4 changed files with 28 additions and 3 deletions

View File

@@ -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();

View File

@@ -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) {
@@ -2317,7 +2318,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() {
@@ -2334,4 +2335,8 @@ public class NotificationPanelView extends PanelView implements
mNotificationStackScroller.setStackHeight(stackHeight);
updateKeyguardBottomAreaAlpha();
}
public void setPanelScrimMinFraction(float minFraction) {
mBar.panelScrimMinFractionChanged(minFraction);
}
}

View File

@@ -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]

View File

@@ -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);
}
}