diff options
Diffstat (limited to 'packages')
4 files changed, 58 insertions, 31 deletions
diff --git a/packages/SystemUI/res/values/dimens.xml b/packages/SystemUI/res/values/dimens.xml index 3ed63ed..f40ffd4 100644 --- a/packages/SystemUI/res/values/dimens.xml +++ b/packages/SystemUI/res/values/dimens.xml @@ -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 --> diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CarrierLabel.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CarrierLabel.java index d8441f2..491fad1 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/CarrierLabel.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/CarrierLabel.java @@ -21,6 +21,7 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.provider.Telephony; +import android.text.TextUtils; import android.util.AttributeSet; import android.util.Slog; import android.view.View; @@ -91,24 +92,20 @@ public class CarrierLabel extends TextView { Slog.d("CarrierLabel", "updateNetworkName showSpn=" + showSpn + " spn=" + spn + " showPlmn=" + showPlmn + " plmn=" + plmn); } - StringBuilder str = new StringBuilder(); - boolean something = false; - if (showPlmn && plmn != null) { - str.append(plmn); - something = true; - } - if (showSpn && spn != null) { - if (something) { - str.append('\n'); - } - str.append(spn); - something = true; - } - if (something) { - setText(str.toString()); + final String str; + // match logic in KeyguardStatusViewManager + final boolean plmnValid = showPlmn && !TextUtils.isEmpty(plmn); + final boolean spnValid = showSpn && !TextUtils.isEmpty(spn); + if (plmnValid && spnValid) { + str = plmn + "|" + spn; + } else if (plmnValid) { + str = plmn; + } else if (spnValid) { + str = spn; } else { - setText(com.android.internal.R.string.lockscreen_carrier_default); + str = ""; } + setText(str); } diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java index 9f9e5ca..56de506 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -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 @@ -400,12 +403,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); } }); } @@ -451,12 +455,14 @@ public class PhoneStatusBar extends BaseStatusBar { mNetworkController.addSignalCluster(signalCluster); signalCluster.setNetworkController(mNetworkController); - - // for wifi-only devices, we show SSID; otherwise, we show PLMN - if (mNetworkController.hasMobileDataFeature()) { - mNetworkController.addMobileLabelView(mCarrierLabel); - } else { - mNetworkController.addWifiLabelView(mCarrierLabel); + + if (SHOW_CARRIER_LABEL) { + // for wifi-only devices, we show SSID; otherwise, we show PLMN + if (mNetworkController.hasMobileDataFeature()) { + mNetworkController.addMobileLabelView(mCarrierLabel); + } else { + mNetworkController.addWifiLabelView(mCarrierLabel); + } } // final ImageView wimaxRSSI = @@ -897,7 +903,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. @@ -909,7 +915,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")); @@ -994,7 +1000,7 @@ public class PhoneStatusBar extends BaseStatusBar { .start(); } - updateCarrierLabelVisibility(); + updateCarrierLabelVisibility(false); } public void showClock(boolean show) { @@ -1167,9 +1173,10 @@ public class PhoneStatusBar extends BaseStatusBar { } mExpandedVisible = true; + mPile.setLayoutTransitionsEnabled(true); makeSlippery(mNavigationBarView, true); - updateCarrierLabelVisibility(); + updateCarrierLabelVisibility(true); updateExpandedViewPos(EXPANDED_LEAVE_ALONE); @@ -1287,6 +1294,7 @@ public class PhoneStatusBar extends BaseStatusBar { return; } mExpandedVisible = false; + mPile.setLayoutTransitionsEnabled(false); visibilityChanged(false); makeSlippery(mNavigationBarView, false); @@ -1573,6 +1581,9 @@ public class PhoneStatusBar extends BaseStatusBar { } float vel = (float)Math.hypot(yVel, xVel); + if (vel > mFlingGestureMaxOutputVelocityPx) { + vel = mFlingGestureMaxOutputVelocityPx; + } if (negative) { vel = -vel; } @@ -2050,7 +2061,7 @@ public class PhoneStatusBar extends BaseStatusBar { mStatusBarWindow.setBackgroundColor(color); } - updateCarrierLabelVisibility(); + updateCarrierLabelVisibility(false); } void updateDisplaySize() { @@ -2277,6 +2288,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 diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java index 42db8cf..61e5ab6 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/NotificationRowLayout.java @@ -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); } |