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

Commit 2433cb7f authored by Jens Doll's avatar Jens Doll Committed by Gerrit Code Review
Browse files

Merge Navigation Bar and Pie Controls button config (2/2)

Based on the commit series for pie controls, this commit
makes the Navigation Bar and Pie Controls share the same
button layout.
This commit applies the changes made in part 1 to the
Settings app. For the real commit see framework/base.

This commit introduces here:
* Some setting constants changes to avoid clashes with PA.
* Removal of the pie search key setting.

Change-Id: I5b4abd6d32a3fc835466ac4cb1f0b9c851641061
parent 84e35b60
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -5182,7 +5182,6 @@
    <string name="pie_control_title">Pie controls</string>
    <string name="pie_control_enabled">Enabled when Expanded desktop is active</string>
    <string name="pie_control_disabled">Disabled</string>
    <string name="pie_control_search_title">Show search button</string>
    <string name="pie_control_size">Navigation key size</string>
    <string name="pie_control_trigger_positions">Trigger positions</string>
    <string name="pie_control_trigger_left">Left screen border</string>
+0 −5
Original line number Diff line number Diff line
@@ -23,11 +23,6 @@
        android:title="@string/pie_control_title"
        android:defaultValue="false" />

    <CheckBoxPreference
        android:key="pie_control_search"
        android:title="@string/pie_control_search_title"
        android:defaultValue="false" />

    <com.android.settings.cyanogenmod.PieSizePreference
        android:key="pie_control_size"
        android:title="@string/pie_control_size"
+6 −5
Original line number Diff line number Diff line
@@ -64,11 +64,6 @@
        android:fragment="com.android.settings.cyanogenmod.HardwareKeys"
        android:title="@string/hardware_keys_title" />

    <PreferenceScreen
        android:key="pie_control"
        android:fragment="com.android.settings.cyanogenmod.PieControl"
        android:title="@string/pie_control_title" />

    <PreferenceCategory
        android:key="navigation_bar_category"
        android:title="@string/navigation_bar_category" >
@@ -82,6 +77,12 @@
            android:key="navigation_ring"
            android:fragment="com.android.settings.cyanogenmod.NavRing"
            android:title="@string/navigation_ring_title" />

        <PreferenceScreen
            android:key="pie_control"
            android:fragment="com.android.settings.cyanogenmod.PieControl"
            android:title="@string/pie_control_title" />

    </PreferenceCategory>

</PreferenceScreen>
+3 −15
Original line number Diff line number Diff line
@@ -19,7 +19,6 @@ public class PieControl extends SettingsPreferenceFragment
    private static final int DEFAULT_POSITION = 1 << 1; // this equals Position.BOTTOM.FLAG

    private static final String PIE_CONTROL = "pie_control_checkbox";
    private static final String SEARCH_BUTTON = "pie_control_search";
    private static final String PIE_SIZE = "pie_control_size";
    private static final String[] TRIGGER = {
        "pie_control_trigger_left",
@@ -29,7 +28,6 @@ public class PieControl extends SettingsPreferenceFragment
    };

    private CheckBoxPreference mPieControl;
    private CheckBoxPreference mSearchButton;
    private SeekBarDialogPreference mPieSize;
    private CheckBoxPreference[] mTrigger = new CheckBoxPreference[4];

@@ -49,8 +47,6 @@ public class PieControl extends SettingsPreferenceFragment
        PreferenceScreen prefSet = getPreferenceScreen();
        mPieControl = (CheckBoxPreference) prefSet.findPreference(PIE_CONTROL);
        mPieControl.setOnPreferenceChangeListener(this);
        mSearchButton = (CheckBoxPreference) prefSet.findPreference(SEARCH_BUTTON);
        mSearchButton.setOnPreferenceChangeListener(this);
        mPieSize = (SeekBarDialogPreference) prefSet.findPreference(PIE_SIZE);

        for (int i = 0; i < TRIGGER.length; i++) {
@@ -68,10 +64,6 @@ public class PieControl extends SettingsPreferenceFragment
                    Settings.System.PIE_CONTROLS, newState ? 1 : 0);
            propagatePieControl(newState);

        } else if (preference == mSearchButton) {
            Settings.System.putInt(getContentResolver(),
                    Settings.System.PIE_SEARCH, (Boolean) newValue ? 1 : 0);

        } else {
            int triggerSlots = 0;
            for (int i = 0; i < mTrigger.length; i++) {
@@ -82,7 +74,7 @@ public class PieControl extends SettingsPreferenceFragment
                }
            }
            Settings.System.putInt(getContentResolver(),
                    Settings.System.PIE_GRAVITY, triggerSlots);
                    Settings.System.PIE_POSITIONS, triggerSlots);
        }
        return true;
    }
@@ -95,11 +87,8 @@ public class PieControl extends SettingsPreferenceFragment
                Settings.System.PIE_CONTROLS, 0) == 1);
        propagatePieControl(mPieControl.isChecked());

        mSearchButton.setChecked(Settings.System.getInt(getContentResolver(),
                Settings.System.PIE_SEARCH, 0) == 1);

        getContentResolver().registerContentObserver(
                Settings.System.getUriFor(Settings.System.PIE_GRAVITY), true,
                Settings.System.getUriFor(Settings.System.PIE_POSITIONS), true,
                mPieTriggerObserver);

        updatePieTriggers();
@@ -112,7 +101,6 @@ public class PieControl extends SettingsPreferenceFragment
    }

    private void propagatePieControl(boolean value) {
        mSearchButton.setEnabled(value);
        for (int i = 0; i < mTrigger.length; i++) {
            mTrigger[i].setEnabled(value);
        }
@@ -121,7 +109,7 @@ public class PieControl extends SettingsPreferenceFragment

    private void updatePieTriggers() {
        int triggerSlots = Settings.System.getInt(getContentResolver(),
                Settings.System.PIE_GRAVITY, DEFAULT_POSITION);
                Settings.System.PIE_POSITIONS, DEFAULT_POSITION);

        for (int i = 0; i < mTrigger.length; i++) {
            if ((triggerSlots & (0x01 << i)) != 0) {