From d2065a7274f7e995deeddfb0d128167d635b5fcb Mon Sep 17 00:00:00 2001 From: Jens Doll Date: Tue, 21 May 2013 18:43:19 +0200 Subject: [PATCH] Pie controls: Tweaking UX for pie service (2/2) This is the Settings application part of the user settable activation sensitivity patch for pie controls. For the complete message look at the commit in frameworks/base. Patch Set #3: * Enabled "Very High" * Changed title from "Sensitivity" to "Responsiveness" * Display summary Patch Set #4: * "Very High" -> "Very high" Change-Id: I99fbbc94c75b64121fd04ff5deb8f5a10a04a63b Conflicts: src/com/android/settings/cyanogenmod/PieControl.java --- res/values/cm_arrays.xml | 15 ++++++++++ res/values/cm_strings.xml | 5 ++++ res/xml/pie_control.xml | 13 +++++++++ .../settings/cyanogenmod/PieControl.java | 28 ++++++++++++++++++- 4 files changed, 60 insertions(+), 1 deletion(-) diff --git a/res/values/cm_arrays.xml b/res/values/cm_arrays.xml index 60ea03a29df..c7ebe2e9f12 100755 --- a/res/values/cm_arrays.xml +++ b/res/values/cm_arrays.xml @@ -619,6 +619,21 @@ 2 + + + @string/pie_control_sensitivity_low + @string/pie_control_sensitivity_medium + @string/pie_control_sensitivity_high + @string/pie_control_sensitivity_very_high + + + + 1 + 2 + 3 + 4 + + @string/gestures_action_empty diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml index af757677a2e..12ba082d535 100755 --- a/res/values/cm_strings.xml +++ b/res/values/cm_strings.xml @@ -936,6 +936,11 @@ two in order to insert additional control points. \'Remove\' deletes the selecte Pie controls Floating controls when Expanded desktop is enabled Floating controls disabled + Responsiveness + Low + Medium + High + Very high Navigation key size Trigger positions Left screen border diff --git a/res/xml/pie_control.xml b/res/xml/pie_control.xml index 5b19a3c0da4..58121108176 100755 --- a/res/xml/pie_control.xml +++ b/res/xml/pie_control.xml @@ -21,8 +21,17 @@ + + diff --git a/src/com/android/settings/cyanogenmod/PieControl.java b/src/com/android/settings/cyanogenmod/PieControl.java index 728b02b1eaf..cd8ebde403b 100755 --- a/src/com/android/settings/cyanogenmod/PieControl.java +++ b/src/com/android/settings/cyanogenmod/PieControl.java @@ -4,6 +4,7 @@ import android.os.Bundle; import android.os.Handler; import android.preference.CheckBoxPreference; +import android.preference.ListPreference; import android.preference.Preference; import android.preference.PreferenceScreen; import android.preference.SeekBarDialogPreference; @@ -21,6 +22,7 @@ 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 PIE_SENSITIVITY = "pie_control_sensitivity"; private static final String PIE_SIZE = "pie_control_size"; private static final String[] TRIGGER = { "pie_control_trigger_left", @@ -44,6 +46,7 @@ public class PieControl extends SettingsPreferenceFragment private static final String PIE_OUTLINE = "pie_control_outline"; private CheckBoxPreference mPieControl; + private ListPreference mPieSensitivity; private SeekBarDialogPreference mPieSize; private CheckBoxPreference[] mTrigger = new CheckBoxPreference[TRIGGER.length]; private PieColorPreference[] mColor = new PieColorPreference[COLORS.length]; @@ -68,6 +71,8 @@ public void onCreate(Bundle savedInstanceState) { PreferenceScreen prefSet = getPreferenceScreen(); mPieControl = (CheckBoxPreference) prefSet.findPreference(PIE_CONTROL); mPieControl.setOnPreferenceChangeListener(this); + mPieSensitivity = (ListPreference) prefSet.findPreference(PIE_SENSITIVITY); + mPieSensitivity.setOnPreferenceChangeListener(this); mPieSize = (SeekBarDialogPreference) prefSet.findPreference(PIE_SIZE); for (int i = 0; i < TRIGGER.length; i++) { @@ -117,6 +122,15 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { PieColorSettings colorSettings = PieColorUtils.loadPieColors(getActivity(), false); applyOutlineColor(colorSettings, newState); PieColorUtils.storePieColors(getActivity(), colorSettings); + + } else if (preference == mPieSensitivity) { + String newState = (String) newValue; + + Settings.System.putString(getContentResolver(), + Settings.System.PIE_SENSITIVITY, newState); + mPieSensitivity.setSummary( + mPieSensitivity.getEntries()[Integer.parseInt(newState) - 1]); + } else if (isTriggerPreference(preference)) { int triggerSlots = 0; for (int i = 0; i < mTrigger.length; i++) { @@ -178,12 +192,17 @@ public void onResume() { Settings.System.PIE_CONTROLS, 0) == 1); propagatePieControl(mPieControl.isChecked()); + int sensitivity = Settings.System.getInt(getContentResolver(), + Settings.System.PIE_SENSITIVITY, 3); + mPieSensitivity.setValue(Integer.toString(sensitivity)); + getContentResolver().registerContentObserver( Settings.System.getUriFor(Settings.System.PIE_POSITIONS), true, mPieTriggerObserver); updatePieColors(); updatePieTriggers(); + updateSensitivity(); } @Override @@ -199,6 +218,7 @@ private void propagatePieControl(boolean value) { for (int i = 0; i < mTrigger.length; i++) { mTrigger[i].setEnabled(value); } + mPieSensitivity.setEnabled(value); mPieSize.setEnabled(value); } @@ -224,4 +244,10 @@ private void updatePieTriggers() { } } -} \ No newline at end of file + private void updateSensitivity() { + int triggerSlots = Settings.System.getInt(getContentResolver(), + Settings.System.PIE_SENSITIVITY, 3); + mPieSensitivity.setSummary(mPieSensitivity.getEntry()); + } + +}