summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJens Doll <jens.doll@gmail.com>2013-05-21 18:43:19 +0200
committerJens Doll <jens.doll@gmail.com>2013-05-24 23:36:25 +0200
commit75abf658b6ab7518cc769d673240e23feb6ac657 (patch)
tree3e57374b2334146da3c20f1b0a8ffde96384625e
parent0bec5621ed15491e0661de30f62217e2f31c8242 (diff)
downloadpackages_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
-rw-r--r--res/values/cm_arrays.xml15
-rw-r--r--res/values/cm_strings.xml5
-rw-r--r--res/xml/pie_control.xml13
-rw-r--r--src/com/android/settings/cyanogenmod/PieControl.java24
4 files changed, 57 insertions, 0 deletions
diff --git a/res/values/cm_arrays.xml b/res/values/cm_arrays.xml
index 2bd764c..8b9869b 100644
--- a/res/values/cm_arrays.xml
+++ b/res/values/cm_arrays.xml
@@ -525,6 +525,21 @@
<item>2</item>
</string-array>
+ <!-- Pie controls -->
+ <string-array name="pie_control_sensitivity_entries" translatable="false">
+ <item>@string/pie_control_sensitivity_low</item>
+ <item>@string/pie_control_sensitivity_medium</item>
+ <item>@string/pie_control_sensitivity_high</item>
+ <item>@string/pie_control_sensitivity_very_high</item>
+ </string-array>
+
+ <string-array name="pie_control_sensitivity_values" translatable="false">
+ <item>1</item>
+ <item>2</item>
+ <item>3</item>
+ <item>4</item>
+ </string-array>
+
<!-- Stylus Gestures -->
<string-array name="gestures_entries" translatable="false">
<item>@string/gestures_action_empty</item>
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 3b18fb0..403bdcc 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -871,6 +871,11 @@ two in order to insert additional control points. \'Remove\' deletes the selecte
<string name="pie_control_title">Pie controls</string>
<string name="pie_control_enabled">Floating controls when Expanded desktop is enabled</string>
<string name="pie_control_disabled">Floating controls disabled</string>
+ <string name="pie_control_sensitivity_title">Responsiveness</string>
+ <string name="pie_control_sensitivity_low">Low</string>
+ <string name="pie_control_sensitivity_medium">Medium</string>
+ <string name="pie_control_sensitivity_high">High</string>
+ <string name="pie_control_sensitivity_very_high">Very high</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>
diff --git a/res/xml/pie_control.xml b/res/xml/pie_control.xml
index ce8a40a..033ce7c 100644
--- a/res/xml/pie_control.xml
+++ b/res/xml/pie_control.xml
@@ -21,8 +21,17 @@
<CheckBoxPreference
android:key="pie_control_checkbox"
android:title="@string/pie_control_title"
+ android:persistent="false"
android:defaultValue="false" />
+ <ListPreference
+ android:key="pie_control_sensitivity"
+ android:title="@string/pie_control_sensitivity_title"
+ android:dialogTitle="@string/pie_control_sensitivity_title"
+ android:entries="@array/pie_control_sensitivity_entries"
+ android:entryValues="@array/pie_control_sensitivity_values"
+ android:persistent="false"/>
+
<com.android.settings.cyanogenmod.PieSizePreference
android:key="pie_control_size"
android:title="@string/pie_control_size"
@@ -34,22 +43,26 @@
<CheckBoxPreference
android:key="pie_control_trigger_left"
android:title="@string/pie_control_trigger_left"
+ android:persistent="false"
android:defaultValue="false" />
<CheckBoxPreference
android:key="pie_control_trigger_bottom"
android:title="@string/pie_control_trigger_bottom"
+ android:persistent="false"
android:defaultValue="false" />
<CheckBoxPreference
android:key="pie_control_trigger_right"
android:title="@string/pie_control_trigger_right"
+ android:persistent="false"
android:defaultValue="false" />
<CheckBoxPreference
android:key="pie_control_trigger_top"
android:title="@string/pie_control_trigger_top"
android:summary="@string/pie_control_trigger_top_summary"
+ android:persistent="false"
android:defaultValue="false" />
</PreferenceCategory>
</PreferenceScreen>
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());
+ }
+
}