summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorcretin45 <cretin45@gmail.com>2016-02-10 13:54:58 -0800
committercretin45 <cretin45@gmail.com>2016-02-10 14:15:45 -0800
commit9c806338cddf3e2a3aff907b821d3abfdb510e72 (patch)
tree30e9d12a6f1c9025c24cc15ac4c639d0d81967c9 /src
parent51c8571933879a98be336d7a32b9f06a184d30de (diff)
downloadandroid_packages_apps_Trebuchet-9c806338cddf3e2a3aff907b821d3abfdb510e72.zip
android_packages_apps_Trebuchet-9c806338cddf3e2a3aff907b821d3abfdb510e72.tar.gz
android_packages_apps_Trebuchet-9c806338cddf3e2a3aff907b821d3abfdb510e72.tar.bz2
Trebuchet: Change icon labels setting to switch
Issue-id: CYNGNOS-1900 Change-Id: Ife68fe84867be631c59cc1de7c44205817e07130
Diffstat (limited to 'src')
-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 d2f721a..09b27b8 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,
@@ -145,9 +144,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,
@@ -407,7 +405,7 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
return !current;
}
- 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);
@@ -415,10 +413,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) {