OSDN Git Service

Double tap to sleep anywhere on the lock screen [1/3]
authorAltaf-Mahdi <altaf.mahdi@gmail.com>
Wed, 11 Nov 2015 21:07:49 +0000 (16:07 -0500)
committerDan Pasanen <dan.pasanen@gmail.com>
Fri, 2 Jun 2017 15:13:08 +0000 (10:13 -0500)
Change-Id: I7dd46f3fafeb2e629974c0f32083d4d9774fb1de
[neo: Using Tuner API.]
Signed-off-by: Pranav Vashi <neobuddy89@gmail.com>
packages/SystemUI/src/com/android/systemui/statusbar/phone/NotificationPanelView.java

index acdeac4..bc9fce0 100644 (file)
@@ -75,8 +75,6 @@ import cyanogenmod.weather.util.WeatherUtils;
 
 import java.util.List;
 
-import cyanogenmod.providers.CMSettings;
-
 public class NotificationPanelView extends PanelView implements
         ExpandableView.OnHeightChangedListener,
         View.OnClickListener, NotificationStackScrollLayout.OnOverscrollTopChangedListener,
@@ -102,6 +100,8 @@ public class NotificationPanelView extends PanelView implements
             "cmsystem:" + CMSettings.System.DOUBLE_TAP_SLEEP_GESTURE;
     private static final String LOCK_SCREEN_WEATHER_ENABLED =
             "cmsecure:" + CMSettings.Secure.LOCK_SCREEN_WEATHER_ENABLED;
+    private static final String DOUBLE_TAP_SLEEP_ANYWHERE =
+            "cmsecure:" + CMSettings.Secure.DOUBLE_TAP_SLEEP_ANYWHERE;
 
     private static final Rect mDummyDirtyRect = new Rect(0, 0, 1, 1);
 
@@ -225,6 +225,7 @@ public class NotificationPanelView extends PanelView implements
     private NotificationGroupManager mGroupManager;
 
     private int mOneFingerQuickSettingsIntercept;
+    private boolean mDoubleTapToSleepAnywhere;
     private boolean mDoubleTapToSleepEnabled;
     private int mStatusBarHeaderHeight;
     private GestureDetector mDoubleTapGesture;
@@ -394,7 +395,8 @@ public class NotificationPanelView extends PanelView implements
         TunerService.get(mContext).addTunable(this,
                 STATUS_BAR_QUICK_QS_PULLDOWN,
                 DOUBLE_TAP_SLEEP_GESTURE,
-                LOCK_SCREEN_WEATHER_ENABLED);
+                LOCK_SCREEN_WEATHER_ENABLED,
+                DOUBLE_TAP_SLEEP_ANYWHERE);
     }
 
     @Override
@@ -799,6 +801,9 @@ public class NotificationPanelView extends PanelView implements
                 && mStatusBarState == StatusBarState.KEYGUARD
                 && event.getY() < mStatusBarHeaderHeight) {
             mDoubleTapGesture.onTouchEvent(event);
+        } else if (mDoubleTapToSleepAnywhere
+                && mStatusBarState == StatusBarState.KEYGUARD) {
+            mDoubleTapGesture.onTouchEvent(event);
         }
         initDownStates(event);
         if (mListenForHeadsUp && !mHeadsUpTouchHelper.isTrackingHeadsUp()
@@ -2464,6 +2469,9 @@ public class NotificationPanelView extends PanelView implements
                     onWeatherChanged(mWeatherController.getWeatherInfo());
                 }
                 break;
+            case DOUBLE_TAP_SLEEP_ANYWHERE:
+                mDoubleTapToSleepAnywhere = newValue == null || Integer.parseInt(newValue) == 1;
+                break;
             default:
                 break;
         }