summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android
diff options
context:
space:
mode:
authorDaniel Sandler <dsandler@android.com>2012-10-10 14:15:34 -0700
committerDaniel Sandler <dsandler@android.com>2012-10-11 09:56:42 -0700
commitefb0faf1c043777762eecfef87ec575632c365e1 (patch)
tree43728d1bc350538f16a88ac7181250ad1dbfd604 /packages/SystemUI/src/com/android
parenteb214524be8b41a246b4e544cf5cbf30b16497f2 (diff)
downloadframeworks_base-efb0faf1c043777762eecfef87ec575632c365e1.zip
frameworks_base-efb0faf1c043777762eecfef87ec575632c365e1.tar.gz
frameworks_base-efb0faf1c043777762eecfef87ec575632c365e1.tar.bz2
Remove the double-swipe to access quick settings on phones.
On the plus side, the settings button is back! Now that we have two buttons on the right-hand side it's more important than ever that the notification panel header not allow errant taps to go all the way back to the notification panel, where they will drag/close it. Bug: 7319756 // remove double-swipe Bug: 7217201 // finally make the notification header black Change-Id: I8b2d6c7a7cfaaed2bfbcd61fb45db9f234cb002d
Diffstat (limited to 'packages/SystemUI/src/com/android')
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java23
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java10
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java30
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java37
4 files changed, 64 insertions, 36 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
index 6ae09b0..3fd413a 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelBar.java
@@ -68,9 +68,9 @@ public class PanelBar extends FrameLayout {
return getMeasuredHeight();
}
- public PanelView selectPanelForTouchX(float x) {
+ public PanelView selectPanelForTouch(MotionEvent touch) {
final int N = mPanels.size();
- return mPanels.get((int)(N * x / getMeasuredWidth()));
+ return mPanels.get((int)(N * touch.getX() / getMeasuredWidth()));
}
public boolean panelsEnabled() {
@@ -84,15 +84,26 @@ public class PanelBar extends FrameLayout {
// figure out which panel needs to be talked to here
if (event.getAction() == MotionEvent.ACTION_DOWN) {
- final PanelView panel = selectPanelForTouchX(event.getX());
+ final PanelView panel = selectPanelForTouch(event);
+ if (panel == null) {
+ // panel is not there, so we'll eat the gesture
+ if (DEBUG) LOG("PanelBar.onTouch: no panel for x=%d, bailing", event.getX());
+ mTouchingPanel = null;
+ return true;
+ }
boolean enabled = panel.isEnabled();
if (DEBUG) LOG("PanelBar.onTouch: state=%d ACTION_DOWN: panel %s %s", mState, panel,
(enabled ? "" : " (disabled)"));
- if (!enabled)
- return false;
+ if (!enabled) {
+ // panel is disabled, so we'll eat the gesture
+ mTouchingPanel = null;
+ return true;
+ }
startOpeningPanel(panel);
}
- final boolean result = mTouchingPanel.getHandle().dispatchTouchEvent(event);
+ final boolean result = mTouchingPanel != null
+ ? mTouchingPanel.getHandle().dispatchTouchEvent(event)
+ : true;
return result;
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
index b3cf854..7eb84e1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PanelView.java
@@ -23,7 +23,7 @@ public class PanelView extends FrameLayout {
}
public static final boolean BRAKES = false;
- private static final boolean STRETCH_PAST_CONTENTS = true;
+ private boolean mRubberbandingEnabled = true;
private float mSelfExpandVelocityPx; // classic value: 2000px/s
private float mSelfCollapseVelocityPx; // classic value: 2000px/s (will be negated to collapse "up")
@@ -86,6 +86,10 @@ public class PanelView extends FrameLayout {
protected float mInitialTouchY;
protected float mFinalTouchY;
+ public void setRubberbandingEnabled(boolean enable) {
+ mRubberbandingEnabled = enable;
+ }
+
private void runPeekAnimation() {
if (DEBUG) LOG("peek to height=%.1f", mPeekHeight);
if (mTimeAnimator.isStarted()) {
@@ -109,7 +113,7 @@ public class PanelView extends FrameLayout {
mTimeAnimator.start();
- mRubberbanding = STRETCH_PAST_CONTENTS // is it enabled at all?
+ mRubberbanding = mRubberbandingEnabled // is it enabled at all?
&& mExpandedHeight > getFullHeight() // are we past the end?
&& mVel >= -mFlingGestureMinDistPx; // was this not possibly a "close" gesture?
if (mRubberbanding) {
@@ -413,7 +417,7 @@ public class PanelView extends FrameLayout {
}
if (h < 0) h = 0;
- if (!(STRETCH_PAST_CONTENTS && (mTracking || mRubberbanding)) && h > fh) h = fh;
+ if (!(mRubberbandingEnabled && (mTracking || mRubberbanding)) && h > fh) h = fh;
mExpandedHeight = h;
if (DEBUG) LOG("setExpansion: height=%.1f fh=%.1f tracking=%s rubber=%s", h, fh, mTracking?"T":"f", mRubberbanding?"T":"f");
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 f171662..24f602d 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java
@@ -344,6 +344,7 @@ public class PhoneStatusBar extends BaseStatusBar {
mStatusBarView = (PhoneStatusBarView) mStatusBarWindow.findViewById(R.id.status_bar);
mStatusBarView.setBar(this);
+
PanelHolder holder = (PanelHolder) mStatusBarWindow.findViewById(R.id.panel_holder);
mStatusBarView.setPanelHolder(holder);
@@ -356,6 +357,15 @@ public class PhoneStatusBar extends BaseStatusBar {
View.STATUS_BAR_DISABLE_NOTIFICATION_ICONS |
View.STATUS_BAR_DISABLE_CLOCK);
+ // make the header non-responsive to clicks
+ mNotificationPanel.findViewById(R.id.header).setOnTouchListener(
+ new View.OnTouchListener() {
+ @Override
+ public boolean onTouch(View v, MotionEvent event) {
+ return true; // e eats everything
+ }
+ });
+
if (!ActivityManager.isHighEndGfx()) {
mStatusBarWindow.setBackground(null);
mNotificationPanel.setBackground(new FastColorDrawable(context.getResources().getColor(
@@ -410,7 +420,12 @@ public class PhoneStatusBar extends BaseStatusBar {
mDateView = (DateView)mStatusBarWindow.findViewById(R.id.date);
mSettingsButton = mStatusBarWindow.findViewById(R.id.settings_button);
if (mSettingsButton != null) {
- mSettingsButton.setOnClickListener(mSettingsButtonListener);
+ if (mStatusBarView.hasFullWidthNotifications()) {
+ mSettingsButton.setOnClickListener(mSettingsButtonListener);
+ mSettingsButton.setVisibility(View.VISIBLE);
+ } else {
+ mSettingsButton.setVisibility(View.GONE);
+ }
}
mScrollView = (ScrollView)mStatusBarWindow.findViewById(R.id.scroll);
@@ -1900,18 +1915,7 @@ public class PhoneStatusBar extends BaseStatusBar {
private View.OnClickListener mSettingsButtonListener = new View.OnClickListener() {
public void onClick(View v) {
- // We take this as a good indicator that Setup is running and we shouldn't
- // allow you to go somewhere else
- if (!isDeviceProvisioned()) return;
- try {
- // Dismiss the lock screen when Settings starts.
- ActivityManagerNative.getDefault().dismissKeyguardOnNextActivity();
- } catch (RemoteException e) {
- }
- v.getContext().startActivityAsUser(new Intent(Settings.ACTION_SETTINGS)
- .setFlags(Intent.FLAG_ACTIVITY_NEW_TASK),
- new UserHandle(UserHandle.USER_CURRENT));
- animateCollapsePanels();
+ animateExpandSettingsPanel();
}
};
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
index da31861..96f729e 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBarView.java
@@ -45,14 +45,7 @@ public class PhoneStatusBarView extends PanelBar {
public PhoneStatusBarView(Context context, AttributeSet attrs) {
super(context, attrs);
- }
-
- public void setBar(PhoneStatusBar bar) {
- mBar = bar;
- }
- @Override
- public void onAttachedToWindow() {
Resources res = getContext().getResources();
mScrimColor = res.getColor(R.color.notification_panel_scrim_color);
mSettingsPanelDragzoneMin = res.getDimension(R.dimen.settings_panel_dragzone_min);
@@ -61,10 +54,24 @@ public class PhoneStatusBarView extends PanelBar {
} catch (NotFoundException ex) {
mSettingsPanelDragzoneFrac = 0f;
}
-
mFullWidthNotifications = mSettingsPanelDragzoneFrac <= 0f;
}
+ public void setBar(PhoneStatusBar bar) {
+ mBar = bar;
+ }
+
+ public boolean hasFullWidthNotifications() {
+ return mFullWidthNotifications;
+ }
+
+ @Override
+ public void onAttachedToWindow() {
+ for (PanelView pv : mPanels) {
+ pv.setRubberbandingEnabled(!mFullWidthNotifications);
+ }
+ }
+
@Override
public void addPanel(PanelView pv) {
super.addPanel(pv);
@@ -73,6 +80,7 @@ public class PhoneStatusBarView extends PanelBar {
} else if (pv.getId() == R.id.settings_panel){
mSettingsPanel = pv;
}
+ pv.setRubberbandingEnabled(!mFullWidthNotifications);
}
@Override
@@ -96,13 +104,14 @@ public class PhoneStatusBarView extends PanelBar {
}
@Override
- public PanelView selectPanelForTouchX(float x) {
+ public PanelView selectPanelForTouch(MotionEvent touch) {
+ final float x = touch.getX();
+
if (mFullWidthNotifications) {
- if (DEBUG) {
- Slog.v(TAG, "notif frac=" + mNotificationPanel.getExpandedFraction());
- }
- return (mNotificationPanel.getExpandedFraction() > 0f)
- ? mSettingsPanel : mNotificationPanel;
+ // No double swiping. If either panel is open, nothing else can be pulled down.
+ return (mSettingsPanel.getExpandedHeight() + mNotificationPanel.getExpandedHeight()> 0)
+ ? null
+ : mNotificationPanel;
}
// We split the status bar into thirds: the left 2/3 are for notifications, and the