diff options
author | Daniel Sandler <dsandler@android.com> | 2012-10-11 10:47:12 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2012-10-11 10:47:12 -0700 |
commit | 092ad66a571d95cad20003daeac4c1119352b854 (patch) | |
tree | dfcc2e568ab14253d9dbf80584ea5666f6330603 /packages/SystemUI/src | |
parent | 2a3e1ffd0f1c369a39f5321a54206d36beab31b9 (diff) | |
parent | ace0bd77438c89578ff821a86ff1ae91f8000ed3 (diff) | |
download | frameworks_base-092ad66a571d95cad20003daeac4c1119352b854.zip frameworks_base-092ad66a571d95cad20003daeac4c1119352b854.tar.gz frameworks_base-092ad66a571d95cad20003daeac4c1119352b854.tar.bz2 |
Merge changes Ic860de75,I8b2d6c7a into jb-mr1-dev
* changes:
Remove notification/quicksettings explanation cling.
Remove the double-swipe to access quick settings on phones.
Diffstat (limited to 'packages/SystemUI/src')
4 files changed, 67 insertions, 38 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..d68151d 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/PhoneStatusBar.java @@ -106,6 +106,8 @@ public class PhoneStatusBar extends BaseStatusBar { public static final boolean DEBUG_CLINGS = false; + public static final boolean ENABLE_NOTIFICATION_PANEL_CLING = false; + // additional instrumentation for testing purposes; intended to be left on during development public static final boolean CHATTY = DEBUG; @@ -344,6 +346,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 +359,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 +422,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); @@ -490,8 +507,7 @@ public class PhoneStatusBar extends BaseStatusBar { mClingShown = ! (DEBUG_CLINGS || !Prefs.read(mContext).getBoolean(Prefs.SHOWN_QUICK_SETTINGS_HELP, false)); - // robots don't need help - if (ActivityManager.isRunningInTestHarness()) { + if (!ENABLE_NOTIFICATION_PANEL_CLING || ActivityManager.isRunningInTestHarness()) { mClingShown = true; } @@ -1900,18 +1916,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 |