summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-02-10 13:54:58 -0800
committerTom Powell <zifnab@zifnab06.net>2017-03-26 16:15:31 -0700
commit02bcffada9aa1b9000ae0c6c597db5484458c29b (patch)
tree0ef57e0c138f9357d99d8defd8856e242024f0b3
parentb64e6c03ef041ef6539ed72bc8f7662d7969c173 (diff)
downloadandroid_packages_apps_Trebuchet-02bcffada9aa1b9000ae0c6c597db5484458c29b.zip
android_packages_apps_Trebuchet-02bcffada9aa1b9000ae0c6c597db5484458c29b.tar.gz
android_packages_apps_Trebuchet-02bcffada9aa1b9000ae0c6c597db5484458c29b.tar.bz2
Trebuchet: Change icon labels setting to switch
Issue-id: CYNGNOS-1900 Change-Id: Ife68fe84867be631c59cc1de7c44205817e07130
-rw-r--r--src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java28
1 files changed, 17 insertions, 11 deletions
diff --git a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
index aa63b20..c4f16c4 100644
--- a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
+++ b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
@@ -110,9 +110,8 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
current = SettingsProvider.getBoolean(mContext,
SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
R.bool.preferences_interface_homescreen_hide_icon_labels_default);
- state = current ? res.getString(R.string.icon_labels_hide)
- : res.getString(R.string.icon_labels_show);
- setStateText(stateView, settingSwitch, state);
+ // Reversed logic here. Boolean is hideLabels, where setting is show labels
+ setSettingSwitch(stateView, settingSwitch, !current);
break;
case 2:
current = SettingsProvider.getBoolean(mContext,
@@ -133,9 +132,8 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
current = SettingsProvider.getBoolean(mContext,
SettingsProvider.SETTINGS_UI_DRAWER_HIDE_ICON_LABELS,
R.bool.preferences_interface_drawer_hide_icon_labels_default);
- state = current ? res.getString(R.string.icon_labels_hide)
- : res.getString(R.string.icon_labels_show);
- setStateText(stateView, settingSwitch, state);
+ // Reversed logic here. Boolean is hideLabels, where setting is show labels
+ setSettingSwitch(stateView, settingSwitch, !current);
break;
case 1:
current = SettingsProvider.getBoolean(mContext,
@@ -381,7 +379,7 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
key, extras);
}
- private void onIconLabelsBooleanChanged(View v, String key, int res) {
+ private boolean onIconLabelsBooleanChanged(View v, String key, int res) {
boolean current = SettingsProvider.getBoolean(
mContext, key, res);
@@ -389,10 +387,18 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
SettingsProvider.putBoolean(mContext, key, !current);
SettingsProvider.putBoolean(mContext, SettingsProvider.SETTINGS_CHANGED, true);
- String state = current ? mLauncher.getResources().getString(
- R.string.icon_labels_show) : mLauncher.getResources().getString(
- R.string.icon_labels_hide);
- ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ // Reversed logic here. Boolean is hideLabels, where setting is show labels
+ ((Switch)v.findViewById(R.id.setting_switch)).setChecked(current);
+
+ Bundle extras = new Bundle();
+ extras.putBoolean(LauncherSettings.Settings.EXTRA_VALUE, !current);
+
+ mContext.getContentResolver().call(
+ LauncherSettings.Settings.CONTENT_URI,
+ LauncherSettings.Settings.METHOD_SET_BOOLEAN,
+ key, extras);
+
+ return !current;
}
private void onDrawerStyleBooleanChanged(View v, String key, int res) {