--- /dev/null
+<!-- drawable/pocket.xml -->
+<vector xmlns:android="http://schemas.android.com/apk/res/android"
+ android:height="24dp"
+ android:width="24dp"
+ android:viewportWidth="24"
+ android:viewportHeight="24"
+ android:tint="?android:attr/colorControlNormal" >
+ <path android:fillColor="#000" android:pathData="M21.9,4.26C21.64,3.55 20.96,3.07 20.2,3.07H20.19L18.46,3.07H3.81C3.07,3.07 2.39,3.54 2.12,4.24C2.04,4.45 2,4.66 2,4.88V10.92L2.07,12.12C2.36,14.85 3.78,17.23 5.97,18.9C6,18.93 6.05,18.96 6.09,19H6.11C7.29,19.86 8.6,20.44 10,20.73C10.68,20.86 11.35,20.93 12,20.93C12.63,20.93 13.25,20.87 13.85,20.76C13.93,20.75 14,20.73 14.07,20.72C14.09,20.71 14.11,20.7 14.14,20.69C15.5,20.4 16.76,19.83 17.89,19H17.91C17.95,18.96 18,18.93 18.03,18.9C20.22,17.23 21.64,14.85 21.93,12.12L22,10.92V4.88C22,4.68 21.97,4.47 21.9,4.26M17.67,10.55L12.96,15.06C12.7,15.32 12.35,15.44 12,15.44C11.67,15.44 11.33,15.32 11.06,15.06L6.36,10.55C5.81,10.03 5.79,9.16 6.32,8.61C6.84,8.06 7.71,8.05 8.26,8.57L12,12.17L15.77,8.57C16.31,8.05 17.18,8.07 17.71,8.61C18.23,9.16 18.21,10.03 17.67,10.55Z" />
+</vector>
android:summary="@string/hand_wave_gesture_summary"
android:icon="@drawable/ic_hand" />
+ <SwitchPreference
+ android:key="gesture_pocket"
+ android:defaultValue="true"
+ android:title="@string/pocket_gesture_title"
+ android:summary="@string/pocket_gesture_summary"
+ android:icon="@drawable/ic_pocket" />
+
</PreferenceCategory>
</PreferenceScreen>
private SwitchPreference mHandwavePreference;
private SwitchPreference mPickUpPreference;
+ private SwitchPreference mPocketPreference;
@Override
public void onCreatePreferences(Bundle savedInstanceState, String rootKey) {
mPickUpPreference.setEnabled(dozeEnabled);
mPickUpPreference.setOnPreferenceChangeListener(this);
+ mPocketPreference = findPreference(MotoActionsSettings.GESTURE_POCKET_KEY);
+ mPocketPreference.setEnabled(dozeEnabled);
+ mPocketPreference.setOnPreferenceChangeListener(this);
+
// Hide AOD if not supported and set all its dependents otherwise
if (!MotoActionsSettings.alwaysOnDisplayAvailable(getActivity())) {
getPreferenceScreen().removePreference(mAlwaysOnDisplayPreference);
mHandwavePreference.setEnabled(isChecked);
mPickUpPreference.setEnabled(isChecked);
+ mPocketPreference.setEnabled(isChecked);
}
@Override
static final String GESTURE_IR_WAKEUP_KEY = "gesture_hand_wave";
static final String GESTURE_PICK_UP_KEY = "gesture_pick_up";
+ static final String GESTURE_POCKET_KEY = "gesture_pocket";
static final String ALWAYS_ON_DISPLAY = "always_on_display";
private boolean mCameraGestureEnabled;
private boolean mChopChopEnabled;
private boolean mPickUpGestureEnabled;
+ private boolean mPocketGestureEnabled;
private boolean mIrWakeUpEnabled;
private boolean mIrSilencerEnabled;
private boolean mFlipToMuteEnabled;
return isDozeEnabled() && !isAlwaysOnEnabled() && mPickUpGestureEnabled;
}
+ public boolean isPocketGestureEnabled() {
+ return isDozeEnabled() && !isAlwaysOnEnabled() && mPocketGestureEnabled;
+ }
+
public boolean isIrSilencerEnabled() {
return mIrSilencerEnabled;
}
mChopChopEnabled = sharedPreferences.getBoolean(GESTURE_CHOP_CHOP_KEY, true);
mIrWakeUpEnabled = sharedPreferences.getBoolean(GESTURE_IR_WAKEUP_KEY, true);
mPickUpGestureEnabled = sharedPreferences.getBoolean(GESTURE_PICK_UP_KEY, true);
+ mPocketGestureEnabled = sharedPreferences.getBoolean(GESTURE_POCKET_KEY, true);
mIrSilencerEnabled = sharedPreferences.getBoolean(GESTURE_IR_SILENCER_KEY, false);
mFlipToMuteEnabled = sharedPreferences.getBoolean(GESTURE_FLIP_TO_MUTE_KEY, false);
mLiftToSilenceEnabled = sharedPreferences.getBoolean(GESTURE_LIFT_TO_SILENCE_KEY, false);
mIrWakeUpEnabled = sharedPreferences.getBoolean(GESTURE_IR_WAKEUP_KEY, true);
} else if (GESTURE_PICK_UP_KEY.equals(key)) {
mPickUpGestureEnabled = sharedPreferences.getBoolean(GESTURE_PICK_UP_KEY, true);
+ } else if (GESTURE_POCKET_KEY.equals(key)) {
+ mPocketGestureEnabled = sharedPreferences.getBoolean(GESTURE_POCKET_KEY, true);
} else if (GESTURE_IR_SILENCER_KEY.equals(key)) {
mIrSilencerEnabled = sharedPreferences.getBoolean(GESTURE_IR_SILENCER_KEY, false);
} else if (GESTURE_FLIP_TO_MUTE_KEY.equals(key)) {
@Override
public void screenTurnedOff() {
- if (!mMotoActionsSettings.isIrWakeupEnabled() &&
- mMotoActionsSettings.isPickUpEnabled() && !mEnabled) {
+ if (mMotoActionsSettings.isPocketGestureEnabled() && !mEnabled) {
Log.d(TAG, "Enabling");
mSensorHelper.registerListener(mSensor, this);
mEnabled = true;