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

Commit 24b922de authored by Danny Baumann's avatar Danny Baumann Committed by Gerrit Code Review
Browse files

Merge "Enable custom actions for double tap home (2/2)" into cm-10.2

parents e762e915 7c635067
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -510,6 +510,7 @@
    <string name="hardware_keys_volume_keys_title">Volume buttons</string>
    <string name="hardware_keys_short_press_title">Short press action</string>
    <string name="hardware_keys_long_press_title">Long press action</string>
    <string name="hardware_keys_double_tap_title">Double tap action</string>
    <string name="hardware_keys_show_overflow_title">Show action overflow</string>
    <string name="hardware_keys_show_overflow_summary">Display the 3-dot overflow menu button within apps</string>
    <string name="hardware_keys_show_overflow_toast_enable">The action overflow button may not be visible until apps are restarted</string>
+9 −0
Original line number Diff line number Diff line
@@ -47,6 +47,15 @@
            android:persistent="false"
            android:dependency="hardware_keys_enable_custom" />

        <ListPreference
            android:key="hardware_keys_home_double_tap"
            android:dialogTitle="@string/hardware_keys_double_tap_title"
            android:title="@string/hardware_keys_double_tap_title"
            android:entries="@array/hardware_keys_action_entries"
            android:entryValues="@array/hardware_keys_action_values"
            android:persistent="false"
            android:dependency="hardware_keys_enable_custom" />

    </PreferenceCategory>

    <PreferenceCategory
+26 −1
Original line number Diff line number Diff line
@@ -37,6 +37,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
        Preference.OnPreferenceChangeListener {
    private static final String KEY_ENABLE_CUSTOM_BINDING = "hardware_keys_enable_custom";
    private static final String KEY_HOME_LONG_PRESS = "hardware_keys_home_long_press";
    private static final String KEY_HOME_DOUBLE_TAP = "hardware_keys_home_double_tap";
    private static final String KEY_MENU_PRESS = "hardware_keys_menu_press";
    private static final String KEY_MENU_LONG_PRESS = "hardware_keys_menu_long_press";
    private static final String KEY_ASSIST_PRESS = "hardware_keys_assist_press";
@@ -77,6 +78,7 @@ public class ButtonSettings extends SettingsPreferenceFragment implements

    private CheckBoxPreference mEnableCustomBindings;
    private ListPreference mHomeLongPressAction;
    private ListPreference mHomeDoubleTapAction;
    private CheckBoxPreference mHomeWake;
    private ListPreference mMenuPressAction;
    private ListPreference mMenuLongPressAction;
@@ -129,11 +131,30 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
                        Settings.System.HOME_WAKE_SCREEN, 1) == 1);
            }

            int defaultLongPressAction = res.getInteger(
                    com.android.internal.R.integer.config_longPressOnHomeBehavior);
            if (defaultLongPressAction < ACTION_NOTHING ||
                    defaultLongPressAction > ACTION_IN_APP_SEARCH) {
                defaultLongPressAction = ACTION_NOTHING;
            }

            int defaultDoubleTapAction = res.getInteger(
                    com.android.internal.R.integer.config_doubleTapOnHomeBehavior);
            if (defaultDoubleTapAction < ACTION_NOTHING ||
                    defaultDoubleTapAction > ACTION_IN_APP_SEARCH) {
                defaultDoubleTapAction = ACTION_NOTHING;
            }

            int longPressAction = Settings.System.getInt(resolver,
                    Settings.System.KEY_HOME_LONG_PRESS_ACTION,
                    hasAppSwitchKey ? ACTION_NOTHING : ACTION_APP_SWITCH);
                    defaultLongPressAction);
            mHomeLongPressAction = initActionList(KEY_HOME_LONG_PRESS, longPressAction);

            int doubleTapAction = Settings.System.getInt(resolver,
                    Settings.System.KEY_HOME_DOUBLE_TAP_ACTION,
                    defaultDoubleTapAction);
            mHomeDoubleTapAction = initActionList(KEY_HOME_DOUBLE_TAP, doubleTapAction);

            hasAnyBindableKey = true;
        } else {
            prefScreen.removePreference(homeCategory);
@@ -254,6 +275,10 @@ public class ButtonSettings extends SettingsPreferenceFragment implements
            handleActionListChange(mHomeLongPressAction, newValue,
                    Settings.System.KEY_HOME_LONG_PRESS_ACTION);
            return true;
        } else if (preference == mHomeDoubleTapAction) {
            handleActionListChange(mHomeDoubleTapAction, newValue,
                    Settings.System.KEY_HOME_DOUBLE_TAP_ACTION);
            return true;
        } else if (preference == mMenuPressAction) {
            handleActionListChange(mMenuPressAction, newValue,
                    Settings.System.KEY_MENU_ACTION);