diff options
author | Jens Doll <jens.doll@gmail.com> | 2013-05-21 18:43:19 +0200 |
---|---|---|
committer | Jens Doll <jens.doll@gmail.com> | 2013-05-24 23:36:25 +0200 |
commit | 75abf658b6ab7518cc769d673240e23feb6ac657 (patch) | |
tree | 3e57374b2334146da3c20f1b0a8ffde96384625e /src/com/android/settings/cyanogenmod/PieControl.java | |
parent | 0bec5621ed15491e0661de30f62217e2f31c8242 (diff) | |
download | packages_apps_settings-75abf658b6ab7518cc769d673240e23feb6ac657.zip packages_apps_settings-75abf658b6ab7518cc769d673240e23feb6ac657.tar.gz packages_apps_settings-75abf658b6ab7518cc769d673240e23feb6ac657.tar.bz2 |
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
Diffstat (limited to 'src/com/android/settings/cyanogenmod/PieControl.java')
-rw-r--r-- | src/com/android/settings/cyanogenmod/PieControl.java | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/src/com/android/settings/cyanogenmod/PieControl.java b/src/com/android/settings/cyanogenmod/PieControl.java index da2ee13..6763eee 100644 --- a/src/com/android/settings/cyanogenmod/PieControl.java +++ b/src/com/android/settings/cyanogenmod/PieControl.java @@ -5,6 +5,7 @@ import android.database.ContentObserver; 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; @@ -19,6 +20,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", @@ -28,6 +30,7 @@ public class PieControl extends SettingsPreferenceFragment }; private CheckBoxPreference mPieControl; + private ListPreference mPieSensitivity; private SeekBarDialogPreference mPieSize; private CheckBoxPreference[] mTrigger = new CheckBoxPreference[4]; @@ -47,6 +50,8 @@ public class PieControl extends SettingsPreferenceFragment 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++) { @@ -64,6 +69,13 @@ public class PieControl extends SettingsPreferenceFragment Settings.System.PIE_CONTROLS, newState ? 1 : 0); propagatePieControl(newState); + } 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 { int triggerSlots = 0; for (int i = 0; i < mTrigger.length; i++) { @@ -87,11 +99,16 @@ public class PieControl extends SettingsPreferenceFragment 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); updatePieTriggers(); + updateSensitivity(); } @Override @@ -104,6 +121,7 @@ public class PieControl extends SettingsPreferenceFragment for (int i = 0; i < mTrigger.length; i++) { mTrigger[i].setEnabled(value); } + mPieSensitivity.setEnabled(value); mPieSize.setEnabled(value); } @@ -120,4 +138,10 @@ public class PieControl extends SettingsPreferenceFragment } } + private void updateSensitivity() { + int triggerSlots = Settings.System.getInt(getContentResolver(), + Settings.System.PIE_SENSITIVITY, 3); + mPieSensitivity.setSummary(mPieSensitivity.getEntry()); + } + } |