Fix refresh in Gestures, not reflecting the changes after

toggling on/off one-handed mode

1) Remove disabling on swipe down notification.
2) Update to align asset with One-Handed mode temporarily.
3) Change some states when toggle on/off and align with
One-Handed mode.
4) Set temporary asset style to "centerInside" to avoid image
corrupted problem when device rotate.
5) Add new string on Swipe down notification toggle switch.

Bug: 177679988
Bug: 181970213

Test: manual verified on Settings > System > Gesture page
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
      "com.android.settings.gestures.OneHandedSettingsTest"
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
      "com.android.settings.gestures
      .OneHandedAppTapsExitPreferenceControllerTest"
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
      "com.android.settings.gestures
      .OneHandedEnablePreferenceControllerTest"
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
      "com.android.settings.gestures
      .OneHandedTimeoutPreferenceControllerTest"
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
      "com.android.settings.gestures.OneHandedSettingsUtilsTest"
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
      "com.android.settings.gestures.SwipeBottomToNotificationPreferenceControllerTest"
Test: make RunSettingsRoboTests ROBOTEST_FILTER=
      "com.android.settings.gestures.SwipeBottomToNotificationSettingsTest"

Change-Id: Ifd2346a7694323d21eb424891987c8317847e7c5
This commit is contained in:
Jason Chang
2021-03-12 17:26:42 +08:00
parent 59aa4f9cb1
commit 858bda81f1
12 changed files with 85 additions and 84 deletions

View File

@@ -16,14 +16,8 @@
package com.android.settings.gestures;
import static android.provider.Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED;
import static com.android.settings.gestures.OneHandedEnablePreferenceController.SUPPORT_ONE_HANDED_MODE;
import android.content.Context;
import android.os.SystemProperties;
import android.provider.Settings;
import android.text.TextUtils;
import com.android.settings.R;
import com.android.settings.core.TogglePreferenceController;
@@ -33,32 +27,20 @@ import com.android.settings.core.TogglePreferenceController;
**/
public class SwipeBottomToNotificationPreferenceController extends TogglePreferenceController {
private static final int ON = 1;
private static final int OFF = 0;
private static final String PREF_KEY = "gesture_swipe_bottom_to_notification";
public SwipeBottomToNotificationPreferenceController(Context context, String key) {
super(context, key);
}
/** Indicates whether the gesture is available or not. */
public static boolean isGestureAvailable(Context context) {
// Disable the gesture once One-Handed mode gesture enabled.
if (SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)) {
return !OneHandedSettingsUtils.isOneHandedModeEnabled(context);
}
return true;
}
@Override
public int getAvailabilityStatus() {
return isGestureAvailable(mContext) ? AVAILABLE : DISABLED_DEPENDENT_SETTING;
return OneHandedSettingsUtils.isSupportOneHandedMode() ? AVAILABLE : UNSUPPORTED_ON_DEVICE;
}
@Override
public boolean isSliceable() {
return TextUtils.equals(getPreferenceKey(), PREF_KEY);
return true;
}
@Override
@@ -68,15 +50,16 @@ public class SwipeBottomToNotificationPreferenceController extends TogglePrefere
@Override
public boolean setChecked(boolean isChecked) {
Settings.Secure.putInt(mContext.getContentResolver(),
SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, isChecked ? ON : OFF);
if (isChecked) {
OneHandedSettingsUtils.setSettingsOneHandedModeEnabled(mContext, false);
}
OneHandedSettingsUtils.setSwipeDownNotificationEnabled(mContext, isChecked);
return true;
}
@Override
public boolean isChecked() {
return Settings.Secure.getInt(mContext.getContentResolver(),
SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, OFF) == ON;
return OneHandedSettingsUtils.isSwipeDownNotificationEnabled(mContext);
}
@Override