Skip to content

Commit

Permalink
Pie controls: Tweaking UX for pie service (2/2)
Browse files Browse the repository at this point in the history
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 Quarx2k#3:
* Enabled "Very High"
* Changed title from "Sensitivity" to "Responsiveness"
* Display summary

Patch Set Quarx2k#4:
* "Very High" -> "Very high"

Change-Id: I99fbbc94c75b64121fd04ff5deb8f5a10a04a63b

Conflicts:
	src/com/android/settings/cyanogenmod/PieControl.java
  • Loading branch information
jdoll authored and Der-Schubi committed May 25, 2013
1 parent 225e789 commit d2065a7
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 1 deletion.
15 changes: 15 additions & 0 deletions res/values/cm_arrays.xml
Original file line number Diff line number Diff line change
Expand Up @@ -619,6 +619,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>
Expand Down
5 changes: 5 additions & 0 deletions res/values/cm_strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -936,6 +936,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>
Expand Down
13 changes: 13 additions & 0 deletions res/xml/pie_control.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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>

Expand Down
28 changes: 27 additions & 1 deletion src/com/android/settings/cyanogenmod/PieControl.java
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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",
Expand All @@ -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];
Expand All @@ -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++) {
Expand Down Expand Up @@ -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++) {
Expand Down Expand Up @@ -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
Expand All @@ -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);
}

Expand All @@ -224,4 +244,10 @@ private void updatePieTriggers() {
}
}

}
private void updateSensitivity() {
int triggerSlots = Settings.System.getInt(getContentResolver(),
Settings.System.PIE_SENSITIVITY, 3);
mPieSensitivity.setSummary(mPieSensitivity.getEntry());
}

}

0 comments on commit d2065a7

Please sign in to comment.