Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 858bda81 authored by Jason Chang's avatar Jason Chang
Browse files

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
parent 59aa4f9c
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -21,7 +21,7 @@
    <ImageView
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:scaleType="centerCrop"
        android:scaleType="centerInside"
        android:cropToPadding="true"
        android:src="@drawable/one_handed_guideline"
        android:contentDescription="@null" />
+2 −2
Original line number Diff line number Diff line
@@ -11280,8 +11280,8 @@
    <!-- Title text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=60]-->
    <string name="swipe_bottom_to_notifications_title">Swipe for notifications</string>
    <!-- Summary text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=80]-->
    <string name="swipe_bottom_to_notifications_summary">Swipe down on the bottom edge of the screen to show your notifications</string>
    <!-- Summary text for swiping downwards on the bottom of the screen for notifications [CHAR LIMIT=NONE]-->
    <string name="swipe_bottom_to_notifications_summary">Swipe down on the bottom edge of the screen to show your notifications.\nYou can\'t use one-handed mode when this feature is turned on.</string>
    <!-- Preference and settings suggestion title text for one handed [CHAR LIMIT=60] -->
    <string name="one_handed_title">One-Handed mode</string>
+7 −5
Original line number Diff line number Diff line
@@ -20,11 +20,13 @@
    xmlns:settings="http://schemas.android.com/apk/res-auto"
    android:title="@string/swipe_bottom_to_notifications_title">

    <com.android.settings.widget.VideoPreference
        android:title="@string/swipe_bottom_to_notifications_title"
        settings:animation="@raw/gesture_fingerprint_swipe"
        settings:preview="@drawable/gesture_fingerprint_swipe"
        settings:controller="com.android.settings.widget.VideoPreferenceController"/>
    <com.android.settingslib.widget.LayoutPreference
        android:key="one_handed_header"
        android:layout="@layout/one_handed_header"
        android:persistent="false"
        android:selectable="false"
        settings:allowDividerBelow="false"
        settings:searchable="false"/>

    <SwitchPreference
        android:key="gesture_swipe_bottom_to_notification"
+2 −4
Original line number Diff line number Diff line
@@ -17,7 +17,6 @@
package com.android.settings.gestures;

import android.content.Context;
import android.os.SystemProperties;

import com.android.settings.R;
import com.android.settings.core.BasePreferenceController;
@@ -28,15 +27,13 @@ import com.android.settings.core.TogglePreferenceController;
 **/
public class OneHandedEnablePreferenceController extends TogglePreferenceController {

    static final String SUPPORT_ONE_HANDED_MODE = "ro.support_one_handed_mode";

    public OneHandedEnablePreferenceController(Context context, String key) {
        super(context, key);
    }

    @Override
    public int getAvailabilityStatus() {
        return SystemProperties.getBoolean(SUPPORT_ONE_HANDED_MODE, false)
        return OneHandedSettingsUtils.isSupportOneHandedMode()
                ? BasePreferenceController.AVAILABLE
                : BasePreferenceController.UNSUPPORTED_ON_DEVICE;
    }
@@ -45,6 +42,7 @@ public class OneHandedEnablePreferenceController extends TogglePreferenceControl
    public boolean setChecked(boolean isChecked) {
        OneHandedSettingsUtils.setSettingsOneHandedModeEnabled(mContext,
                isChecked);
        OneHandedSettingsUtils.setSwipeDownNotificationEnabled(mContext, !isChecked);
        return true;
    }

+1 −3
Original line number Diff line number Diff line
@@ -18,7 +18,6 @@ package com.android.settings.gestures;

import android.app.settings.SettingsEnums;
import android.content.Context;
import android.os.SystemProperties;

import com.android.settings.R;
import com.android.settings.dashboard.DashboardFragment;
@@ -52,8 +51,7 @@ public class OneHandedSettings extends DashboardFragment {
            new BaseSearchIndexProvider(R.xml.one_handed_settings) {
                @Override
                protected boolean isPageSearchEnabled(Context context) {
                    return SystemProperties.getBoolean(
                            OneHandedEnablePreferenceController.SUPPORT_ONE_HANDED_MODE, false);
                    return OneHandedSettingsUtils.isSupportOneHandedMode();
                }
            };
}
Loading