am 2c1a4c05: Merge "Suppress header flash when collapsing notifications panel." into jb-dev
* commit '2c1a4c05b83e0461169bb846765ae415b4e79fcf': Suppress header flash when collapsing notifications panel.
This commit is contained in:
@@ -87,6 +87,8 @@
|
|||||||
<dimen name="fling_collapse_min_velocity">200dp</dimen>
|
<dimen name="fling_collapse_min_velocity">200dp</dimen>
|
||||||
<!-- Cap on contribution of x dimension of gesture to overall velocity -->
|
<!-- Cap on contribution of x dimension of gesture to overall velocity -->
|
||||||
<dimen name="fling_gesture_max_x_velocity">200dp</dimen>
|
<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
|
<!-- Minimum fraction of the display a gesture must travel, at any velocity, to qualify as a
|
||||||
collapse request -->
|
collapse request -->
|
||||||
|
|||||||
@@ -134,6 +134,9 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
private float mExpandAccelPx; // classic value: 2000px/s/s
|
private float mExpandAccelPx; // classic value: 2000px/s/s
|
||||||
private float mCollapseAccelPx; // classic value: 2000px/s/s (will be negated to collapse "up")
|
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;
|
PhoneStatusBarPolicy mIconPolicy;
|
||||||
|
|
||||||
// These are no longer handled by the policy, because we need custom strategies for them
|
// 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);
|
mTickerView = mStatusBarView.findViewById(R.id.ticker);
|
||||||
|
|
||||||
mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems);
|
mPile = (NotificationRowLayout)mStatusBarWindow.findViewById(R.id.latestItems);
|
||||||
|
mPile.setLayoutTransitionsEnabled(false);
|
||||||
mPile.setLongPressListener(getNotificationLongClicker());
|
mPile.setLongPressListener(getNotificationLongClicker());
|
||||||
if (SHOW_CARRIER_LABEL) {
|
if (SHOW_CARRIER_LABEL) {
|
||||||
mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
|
mPile.setOnSizeChangedListener(new OnSizeChangedListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onSizeChanged(View view, int w, int h, int oldw, int oldh) {
|
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;
|
if (!SHOW_CARRIER_LABEL) return;
|
||||||
// The idea here is to only show the carrier label when there is enough room to see it,
|
// 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.
|
// i.e. when there aren't enough notifications to fill the panel.
|
||||||
@@ -901,7 +905,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
final boolean makeVisible =
|
final boolean makeVisible =
|
||||||
mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
|
mPile.getHeight() < (mScrollView.getHeight() - mCarrierLabelHeight);
|
||||||
|
|
||||||
if (mCarrierLabelVisible != makeVisible) {
|
if (force || mCarrierLabelVisible != makeVisible) {
|
||||||
mCarrierLabelVisible = makeVisible;
|
mCarrierLabelVisible = makeVisible;
|
||||||
if (DEBUG) {
|
if (DEBUG) {
|
||||||
Slog.d(TAG, "making carrier label " + (makeVisible?"visible":"invisible"));
|
Slog.d(TAG, "making carrier label " + (makeVisible?"visible":"invisible"));
|
||||||
@@ -986,7 +990,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
.start();
|
.start();
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCarrierLabelVisibility();
|
updateCarrierLabelVisibility(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showClock(boolean show) {
|
public void showClock(boolean show) {
|
||||||
@@ -1159,9 +1163,10 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
mExpandedVisible = true;
|
mExpandedVisible = true;
|
||||||
|
mPile.setLayoutTransitionsEnabled(true);
|
||||||
makeSlippery(mNavigationBarView, true);
|
makeSlippery(mNavigationBarView, true);
|
||||||
|
|
||||||
updateCarrierLabelVisibility();
|
updateCarrierLabelVisibility(true);
|
||||||
|
|
||||||
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
|
updateExpandedViewPos(EXPANDED_LEAVE_ALONE);
|
||||||
|
|
||||||
@@ -1279,6 +1284,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
mExpandedVisible = false;
|
mExpandedVisible = false;
|
||||||
|
mPile.setLayoutTransitionsEnabled(false);
|
||||||
visibilityChanged(false);
|
visibilityChanged(false);
|
||||||
makeSlippery(mNavigationBarView, false);
|
makeSlippery(mNavigationBarView, false);
|
||||||
|
|
||||||
@@ -1562,6 +1568,9 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
}
|
}
|
||||||
|
|
||||||
float vel = (float)Math.hypot(yVel, xVel);
|
float vel = (float)Math.hypot(yVel, xVel);
|
||||||
|
if (vel > mFlingGestureMaxOutputVelocityPx) {
|
||||||
|
vel = mFlingGestureMaxOutputVelocityPx;
|
||||||
|
}
|
||||||
if (negative) {
|
if (negative) {
|
||||||
vel = -vel;
|
vel = -vel;
|
||||||
}
|
}
|
||||||
@@ -2039,7 +2048,7 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
mStatusBarWindow.setBackgroundColor(color);
|
mStatusBarWindow.setBackgroundColor(color);
|
||||||
}
|
}
|
||||||
|
|
||||||
updateCarrierLabelVisibility();
|
updateCarrierLabelVisibility(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateDisplaySize() {
|
void updateDisplaySize() {
|
||||||
@@ -2266,6 +2275,8 @@ public class PhoneStatusBar extends BaseStatusBar {
|
|||||||
|
|
||||||
mFlingGestureMaxXVelocityPx = res.getDimension(R.dimen.fling_gesture_max_x_velocity);
|
mFlingGestureMaxXVelocityPx = res.getDimension(R.dimen.fling_gesture_max_x_velocity);
|
||||||
|
|
||||||
|
mFlingGestureMaxOutputVelocityPx = res.getDimension(R.dimen.fling_gesture_max_output_velocity);
|
||||||
|
|
||||||
mNotificationPanelMarginBottomPx
|
mNotificationPanelMarginBottomPx
|
||||||
= (int) res.getDimension(R.dimen.notification_panel_margin_bottom);
|
= (int) res.getDimension(R.dimen.notification_panel_margin_bottom);
|
||||||
mNotificationPanelMarginLeftPx
|
mNotificationPanelMarginLeftPx
|
||||||
|
|||||||
@@ -68,6 +68,8 @@ public class NotificationRowLayout
|
|||||||
// animation is done
|
// animation is done
|
||||||
boolean mRemoveViews = true;
|
boolean mRemoveViews = true;
|
||||||
|
|
||||||
|
private LayoutTransition mRealLayoutTransition;
|
||||||
|
|
||||||
public NotificationRowLayout(Context context, AttributeSet attrs) {
|
public NotificationRowLayout(Context context, AttributeSet attrs) {
|
||||||
this(context, attrs, 0);
|
this(context, attrs, 0);
|
||||||
}
|
}
|
||||||
@@ -75,7 +77,8 @@ public class NotificationRowLayout
|
|||||||
public NotificationRowLayout(Context context, AttributeSet attrs, int defStyle) {
|
public NotificationRowLayout(Context context, AttributeSet attrs, int defStyle) {
|
||||||
super(context, attrs, defStyle);
|
super(context, attrs, defStyle);
|
||||||
|
|
||||||
setLayoutTransition(new LayoutTransition());
|
mRealLayoutTransition = new LayoutTransition();
|
||||||
|
setLayoutTransitionsEnabled(true);
|
||||||
|
|
||||||
setOrientation(LinearLayout.VERTICAL);
|
setOrientation(LinearLayout.VERTICAL);
|
||||||
|
|
||||||
@@ -121,9 +124,9 @@ public class NotificationRowLayout
|
|||||||
|
|
||||||
private void logLayoutTransition() {
|
private void logLayoutTransition() {
|
||||||
Log.v(TAG, "layout " +
|
Log.v(TAG, "layout " +
|
||||||
(getLayoutTransition().isChangingLayout() ? "is " : "is not ") +
|
(mRealLayoutTransition.isChangingLayout() ? "is " : "is not ") +
|
||||||
"in transition and animations " +
|
"in transition and animations " +
|
||||||
(getLayoutTransition().isRunning() ? "are " : "are not ") +
|
(mRealLayoutTransition.isRunning() ? "are " : "are not ") +
|
||||||
"running.");
|
"running.");
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -225,6 +228,18 @@ public class NotificationRowLayout
|
|||||||
mRemoveViews = removeViews;
|
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) {
|
public void dismissRowAnimated(View child) {
|
||||||
dismissRowAnimated(child, 0);
|
dismissRowAnimated(child, 0);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user