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:
@@ -22,6 +22,7 @@ import android.database.ContentObserver;
|
||||
import android.net.Uri;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.SystemProperties;
|
||||
import android.provider.Settings;
|
||||
|
||||
/**
|
||||
@@ -29,6 +30,8 @@ import android.provider.Settings;
|
||||
*/
|
||||
public class OneHandedSettingsUtils {
|
||||
|
||||
static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";
|
||||
|
||||
public enum OneHandedTimeout {
|
||||
NEVER(0), SHORT(4), MEDIUM(8), LONG(12);
|
||||
|
||||
@@ -51,6 +54,13 @@ public class OneHandedSettingsUtils {
|
||||
mSettingsObserver = new SettingsObserver(new Handler(Looper.getMainLooper()));
|
||||
}
|
||||
|
||||
/**
|
||||
* Get One-Handed mode support flag.
|
||||
*/
|
||||
public static boolean isSupportOneHandedMode() {
|
||||
return SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get one-handed mode enable or disable flag from Settings provider.
|
||||
*
|
||||
@@ -118,6 +128,28 @@ public class OneHandedSettingsUtils {
|
||||
Settings.Secure.ONE_HANDED_MODE_TIMEOUT, timeout);
|
||||
}
|
||||
|
||||
/**
|
||||
* Get Swipe-down-notification enable or disable flag from Settings provider.
|
||||
*
|
||||
* @param context App context
|
||||
* @return enable or disable Swipe-down-notification flag.
|
||||
*/
|
||||
public static boolean isSwipeDownNotificationEnabled(Context context) {
|
||||
return Settings.Secure.getInt(context.getContentResolver(),
|
||||
Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, 0) == 1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set Swipe-down-notification enable or disable flag to Settings provider.
|
||||
*
|
||||
* @param context App context
|
||||
* @param enable enable or disable Swipe-down-notification.
|
||||
*/
|
||||
public static void setSwipeDownNotificationEnabled(Context context, boolean enable) {
|
||||
Settings.Secure.putInt(context.getContentResolver(),
|
||||
Settings.Secure.SWIPE_BOTTOM_TO_NOTIFICATION_ENABLED, enable ? 1 : 0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register callback for observing Settings.Secure.ONE_HANDED_MODE_ENABLED state.
|
||||
* @param callback for state changes
|
||||
|
||||
Reference in New Issue
Block a user