• R/O
  • HTTP
  • SSH
  • HTTPS

Commit

Tags
Keine Tags

Frequently used words (click to add to your profile)

javac++androidlinuxc#windowsobjective-ccocoa誰得qtpythonphprubygameguibathyscaphec計画中(planning stage)翻訳omegatframeworktwitterdomtestvb.netdirectxゲームエンジンbtronarduinopreviewer

frameworks/base


Commit MetaInfo

Revision437f0fc916ad62593fc542a94a26ab9e15e7e960 (tree)
Zeit2016-10-07 10:00:04
AutorZhao Wei Liew <zhaoweiliew@gmai...>
CommiterZhao Wei Liew

Log Message

SystemUI: statusbar: Fix QS quick pulldown feature

Bring in the fixes from CM 13.

This commit squashes the following patches from CM 13.0:
68c40f32470d66e0f8973d33a4124a2181754fb0 SystemUI: fix QS quick pull down
477f58dc1413943926f2b4428f5873c0bb04dab8 SystemUI: hook up settings observer in notificationpanel
d2bec52c76a3bb2c9a7fa3533e40f782fa592826 SystemUI: Fix quick-quick settings pulldown settings
eb10bc20db37978413362250c8546ae7ed865077 Add left QS quick pulldown (1/3)

Change-Id: Ie122477261d96499c80640cf274d22fba6642a01

Ändern Zusammenfassung

Diff

--- a/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java
@@ -218,7 +218,7 @@ public class NotificationPanelView extends PanelView implements
218218 private Handler mHandler = new Handler();
219219 private SettingsObserver mSettingsObserver;
220220
221- private boolean mOneFingerQuickSettingsIntercept;
221+ private int mOneFingerQuickSettingsIntercept;
222222 private boolean mDoubleTapToSleepEnabled;
223223 private int mStatusBarHeaderHeight;
224224 private GestureDetector mDoubleTapGesture;
@@ -370,13 +370,14 @@ public class NotificationPanelView extends PanelView implements
370370 }
371371
372372 @Override
373- public void onAttachedToWindow() {
373+ protected void onAttachedToWindow() {
374+ super.onAttachedToWindow();
374375 mSettingsObserver.observe();
375-
376376 }
377377
378378 @Override
379- public void onDetachedFromWindow() {
379+ protected void onDetachedFromWindow() {
380+ super.onDetachedFromWindow();
380381 mSettingsObserver.unobserve();
381382 }
382383
@@ -833,13 +834,7 @@ public class NotificationPanelView extends PanelView implements
833834 && mQsExpansionEnabled) {
834835 mTwoFingerQsExpandPossible = true;
835836 }
836- boolean twoFingerQsEvent = mTwoFingerQsExpandPossible
837- && (event.getActionMasked() == MotionEvent.ACTION_POINTER_DOWN
838- && event.getPointerCount() == 2);
839- boolean oneFingerQsOverride = mOneFingerQuickSettingsIntercept
840- && event.getActionMasked() == MotionEvent.ACTION_DOWN
841- && shouldQuickSettingsIntercept(event.getX(), event.getY(), -1, false);
842- if ((twoFingerQsEvent || oneFingerQsOverride) && isOpenQsEvent(event)
837+ if (mTwoFingerQsExpandPossible && isOpenQsEvent(event)
843838 && event.getY(event.getActionIndex()) < mStatusBarMinHeight) {
844839 MetricsLogger.count(mContext, COUNTER_PANEL_OPEN_QS, 1);
845840 mQsExpandImmediate = true;
@@ -874,7 +869,22 @@ public class NotificationPanelView extends PanelView implements
874869 && (event.isButtonPressed(MotionEvent.BUTTON_SECONDARY)
875870 || event.isButtonPressed(MotionEvent.BUTTON_TERTIARY));
876871
877- return twoFingerDrag || stylusButtonClickDrag || mouseButtonClickDrag;
872+ final float w = getMeasuredWidth();
873+ final float x = event.getX();
874+ float region = w * 1.f / 4.f; // TODO overlay region fraction?
875+ boolean showQsOverride = false;
876+
877+ switch (mOneFingerQuickSettingsIntercept) {
878+ case 1: // Right side pulldown
879+ showQsOverride = isLayoutRtl() ? x < region : w - region < x;
880+ break;
881+ case 2: // Left side pulldown
882+ showQsOverride = isLayoutRtl() ? w - region < x : x < region;
883+ break;
884+ }
885+ showQsOverride &= mStatusBarState == StatusBarState.SHADE;
886+
887+ return twoFingerDrag || showQsOverride || stylusButtonClickDrag || mouseButtonClickDrag;
878888 }
879889
880890 private void handleQsDown(MotionEvent event) {
@@ -1399,30 +1409,18 @@ public class NotificationPanelView extends PanelView implements
13991409 * @return Whether we should intercept a gesture to open Quick Settings.
14001410 */
14011411 private boolean shouldQuickSettingsIntercept(float x, float y, float yDiff) {
1402- return shouldQuickSettingsIntercept(x, y, yDiff, true);
1403- }
1404-
1405- /**
1406- * @return Whether we should intercept a gesture to open Quick Settings.
1407- */
1408- private boolean shouldQuickSettingsIntercept(float x, float y, float yDiff, boolean useHeader) {
14091412 if (!mQsExpansionEnabled || mCollapsedOnDown) {
14101413 return false;
14111414 }
14121415 View header = mKeyguardShowing ? mKeyguardStatusBar : mQsContainer.getHeader();
1413- boolean onHeader = useHeader && x >= mQsAutoReinflateContainer.getX()
1416+ boolean onHeader = x >= mQsAutoReinflateContainer.getX()
14141417 && x <= mQsAutoReinflateContainer.getX() + mQsAutoReinflateContainer.getWidth()
14151418 && y >= header.getTop() && y <= header.getBottom();
14161419
1417- final float w = getMeasuredWidth();
1418- float region = (w * (1.f/3.f)); // TODO overlay region fraction?
1419- final boolean showQsOverride = isLayoutRtl() ? (x < region) : (w - region < x)
1420- && mStatusBarState == StatusBarState.SHADE;
1421-
14221420 if (mQsExpanded) {
14231421 return onHeader || (yDiff < 0 && isInQsArea(x, y));
14241422 } else {
1425- return onHeader || showQsOverride;
1423+ return onHeader;
14261424 }
14271425 }
14281426
@@ -2438,7 +2436,7 @@ public class NotificationPanelView extends PanelView implements
24382436 public void update() {
24392437 ContentResolver resolver = mContext.getContentResolver();
24402438 mOneFingerQuickSettingsIntercept = CMSettings.System.getInt(
2441- resolver, CMSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN, 1) == 1;
2439+ resolver, CMSettings.System.STATUS_BAR_QUICK_QS_PULLDOWN, 1);
24422440 mDoubleTapToSleepEnabled = CMSettings.System.getInt(
24432441 resolver, CMSettings.System.DOUBLE_TAP_SLEEP_GESTURE, 1) == 1;
24442442 }