summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRaj Yengisetty <rajesh@cyngn.com>2014-11-10 18:35:01 (GMT)
committerAdnan <adnan@cyngn.com>2014-11-19 23:53:57 (GMT)
commitae6b7551e4c92fa942b11788f401842aedc24d91 (patch)
tree3d21cbb26808a4be80119ae76f3869f4bcac6a2c
parent506b0b660d7e8ee198c5f1052191bfea8968addf (diff)
downloadandroid_packages_apps_Trebuchet-ae6b7551e4c92fa942b11788f401842aedc24d91.zip
android_packages_apps_Trebuchet-ae6b7551e4c92fa942b11788f401842aedc24d91.tar.gz
android_packages_apps_Trebuchet-ae6b7551e4c92fa942b11788f401842aedc24d91.tar.bz2
Settings adapter should use the position and partition values
Fixes: https://jira.cyanogenmod.org/browse/BACON-587 Conflicts: src/com/android/launcher3/OverviewSettingsPanel.java src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java Change-Id: Ie935c51ea1e68eaa7da64b23eaf2ae28a630a3bb
-rw-r--r--src/com/android/launcher3/Launcher.java6
-rw-r--r--src/com/android/launcher3/OverviewSettingsPanel.java23
-rw-r--r--src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java278
3 files changed, 166 insertions, 141 deletions
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index c3f357c..34a4533 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -299,7 +299,7 @@ public class Launcher extends Activity
private View mAllAppsButton;
- private SearchDropTargetBar mSearchDropTargetBar;
+ protected SearchDropTargetBar mSearchDropTargetBar;
private AppsCustomizeTabHost mAppsCustomizeTabHost;
private AppsCustomizePagedView mAppsCustomizeContent;
private boolean mAutoAdvanceRunning = false;
@@ -1055,10 +1055,6 @@ public class Launcher extends Activity
updateGridIfNeeded();
- if(isGelIntegrationEnabled() && isGelIntegrationSupported()) {
- GelIntegrationHelper.getInstance().handleGelResume();
- }
-
// Restore the previous launcher state
if (mOnResumeState == State.WORKSPACE) {
showWorkspace(false);
diff --git a/src/com/android/launcher3/OverviewSettingsPanel.java b/src/com/android/launcher3/OverviewSettingsPanel.java
index 91f7f0d..b52c9f6 100644
--- a/src/com/android/launcher3/OverviewSettingsPanel.java
+++ b/src/com/android/launcher3/OverviewSettingsPanel.java
@@ -19,6 +19,7 @@ public class OverviewSettingsPanel {
"com.android.settings.Settings$ThemeSettingsActivity";
public static final int HOME_SETTINGS_POSITION = 0;
public static final int DRAWER_SETTINGS_POSITION = 1;
+ public static final int APP_SETTINGS_POSITION = 2;
private Launcher mLauncher;
private View mOverviewPanel;
@@ -43,11 +44,11 @@ public class OverviewSettingsPanel {
res.getString(R.string.app_settings)};
String[] values = new String[]{
- res.getString(R.string.home_screen_search_text),
- res.getString(R.string.scroll_effect_text),
- res.getString(R.string.icon_labels),
- res.getString(R.string.scrolling_wallpaper),
- res.getString(R.string.grid_size_text)};
+ res.getString(R.string.home_screen_search_text),
+ res.getString(R.string.scroll_effect_text),
+ res.getString(R.string.icon_labels),
+ res.getString(R.string.scrolling_wallpaper),
+ res.getString(R.string.grid_size_text)};
String[] valuesDrawer = new String[] {
res.getString(R.string.scroll_effect_text),
@@ -66,9 +67,10 @@ public class OverviewSettingsPanel {
mSettingsAdapter.addPartition(false, true);
mSettingsAdapter.mPinnedHeaderCount = headers.length;
- mSettingsAdapter.changeCursor(0, createCursor(headers[0], values));
- mSettingsAdapter.changeCursor(1, createCursor(headers[1], valuesDrawer));
- mSettingsAdapter.changeCursor(2, createCursor(headers[2], valuesApp));
+ mSettingsAdapter.changeCursor(HOME_SETTINGS_POSITION, createCursor(headers[0], values));
+ mSettingsAdapter.changeCursor(DRAWER_SETTINGS_POSITION, createCursor(headers[1],
+ valuesDrawer));
+ mSettingsAdapter.changeCursor(APP_SETTINGS_POSITION, createCursor(headers[2], valuesApp));
mListView.setAdapter(mSettingsAdapter);
}
@@ -166,8 +168,9 @@ public class OverviewSettingsPanel {
String[] values = new String[] {
res.getString(R.string.home_screen_search_text),
res.getString(R.string.scroll_effect_text),
- res.getString(R.string.larger_icons_text),
- res.getString(R.string.icon_labels)};
+ res.getString(R.string.icon_labels),
+ res.getString(R.string.scrolling_wallpaper),
+ res.getString(R.string.grid_size_text)};
mSettingsAdapter.changeCursor(0, createCursor(res
.getString(R.string.home_screen_settings), values));
}
diff --git a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
index 0daf142..8399db6 100644
--- a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
+++ b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
@@ -10,7 +10,6 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
-import android.widget.Toast;
import com.android.launcher3.DeviceProfile;
import com.android.launcher3.Launcher;
import com.android.launcher3.OverviewSettingsPanel;
@@ -22,9 +21,22 @@ import android.view.View.OnClickListener;
import android.content.SharedPreferences;
public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
+ private static final int PARTITION_TAG = 0;
+ private static final int POSITION_TAG = 1;
+
private Launcher mLauncher;
private Context mContext;
+ class SettingsPosition {
+ int partition = 0;
+ int position = 0;
+
+ SettingsPosition (int partition, int position) {
+ this.partition = partition;
+ this.position = position;
+ }
+ }
+
public SettingsPinnedHeaderAdapter(Context context) {
super(context);
mLauncher = (Launcher) context;
@@ -67,78 +79,85 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
String title = cursor.getString(1);
text.setText(title);
+ v.setTag(new SettingsPosition(partition, position));
+
Resources res = mLauncher.getResources();
- if (title.equals(res
- .getString(R.string.home_screen_search_text))) {
- boolean current = mLauncher.isSearchBarEnabled();
- String state = current ? res.getString(
- R.string.setting_state_on) : res.getString(
- R.string.setting_state_off);
- ((TextView) v.findViewById(R.id.item_state)).setText(state);
- } else if (title.equals(res
- .getString(R.string.drawer_sorting_text))) {
- updateDrawerSortSettingsItem(v);
- } else if (title.equals(res
- .getString(R.string.scroll_effect_text)) &&
- partition == OverviewSettingsPanel.DRAWER_SETTINGS_POSITION) {
- String state = mLauncher.getAppsCustomizeTransitionEffect();
- state = mapEffectToValue(state);
- ((TextView) v.findViewById(R.id.item_state)).setText(state);
- } else if (title.equals(res
- .getString(R.string.scroll_effect_text)) &&
- partition == OverviewSettingsPanel.HOME_SETTINGS_POSITION) {
- String state = mLauncher.getWorkspaceTransitionEffect();
- state = mapEffectToValue(state);
- ((TextView) v.findViewById(R.id.item_state)).setText(state);
- } else if (title.equals(res
- .getString(R.string.larger_icons_text))) {
- boolean current = SettingsProvider
- .getBoolean(
- mContext,
- SettingsProvider.SETTINGS_UI_GENERAL_ICONS_LARGE,
- R.bool.preferences_interface_general_icons_large_default);
- String state = current ? res.getString(
- R.string.setting_state_on) : res.getString(
- R.string.setting_state_off);
- ((TextView) v.findViewById(R.id.item_state)).setText(state);
- } else if (title.equals(res
- .getString(R.string.icon_labels)) &&
- partition == OverviewSettingsPanel.HOME_SETTINGS_POSITION) {
- boolean current = mLauncher.shouldHideWorkspaceIconLables();
- String state = current ? res.getString(
- R.string.icon_labels_hide) : res.getString(
- R.string.icon_labels_show);
- ((TextView) v.findViewById(R.id.item_state)).setText(state);
- } else if (title.equals(res
- .getString(R.string.icon_labels)) &&
- partition == OverviewSettingsPanel.DRAWER_SETTINGS_POSITION) {
- boolean current = SettingsProvider
- .getBoolean(
- mContext,
- SettingsProvider.SETTINGS_UI_DRAWER_HIDE_ICON_LABELS,
- R.bool.preferences_interface_drawer_hide_icon_labels_default);
- String state = current ? res.getString(
- R.string.icon_labels_hide) : res.getString(
- R.string.icon_labels_show);
- ((TextView) v.findViewById(R.id.item_state)).setText(state);
- } else if (title.equals(res.getString(R.string.scrolling_wallpaper))) {
- boolean current = SettingsProvider
- .getBoolean(
- mContext,
- SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL,
- R.bool.preferences_interface_homescreen_scrolling_wallpaper_scroll_default);
- String state = current ? res.getString(
- R.string.setting_state_on) : res.getString(
- R.string.setting_state_off);
- ((TextView) v.findViewById(R.id.item_state)).setText(state);
- } else if (title.equals(res.getString(R.string.grid_size_text))) {
- updateDynamicGridSizeSettingsItem(v);
- } else {
- ((TextView) v.findViewById(R.id.item_state)).setText("");
+ boolean current = false;
+ String state = "";
+
+ switch (partition) {
+ case OverviewSettingsPanel.HOME_SETTINGS_POSITION:
+ switch (position) {
+ case 0:
+ current = mLauncher.isSearchBarEnabled();
+ state = current ? res.getString(R.string.setting_state_on)
+ : res.getString(R.string.setting_state_off);
+ ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ break;
+ case 1:
+ state = mLauncher.getWorkspaceTransitionEffect();
+ state = mapEffectToValue(state);
+ ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ break;
+ case 2:
+ current = mLauncher.shouldHideWorkspaceIconLables();
+ state = current ? res.getString(R.string.icon_labels_hide)
+ : res.getString(R.string.icon_labels_show);
+ ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ break;
+ case 3:
+ current = SettingsProvider.getBoolean(mContext,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL,
+ R.bool.preferences_interface_homescreen_scrolling_wallpaper_scroll_default);
+ state = current ? res.getString(R.string.setting_state_on)
+ : res.getString(R.string.setting_state_off);
+ ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ break;
+ case 4:
+ updateDynamicGridSizeSettingsItem(v);
+ break;
+ default:
+ ((TextView) v.findViewById(R.id.item_state)).setText("");
+ }
+ break;
+ case OverviewSettingsPanel.DRAWER_SETTINGS_POSITION:
+ switch (position) {
+ case 0:
+ state = mLauncher.getAppsCustomizeTransitionEffect();
+ state = mapEffectToValue(state);
+ ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ break;
+ case 1:
+ updateDrawerSortSettingsItem(v);
+ break;
+ case 2:
+ 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);
+ ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ break;
+ default:
+ ((TextView) v.findViewById(R.id.item_state)).setText("");
+ }
+ break;
+ default:
+ switch (position) {
+ case 0:
+ current = SettingsProvider.getBoolean(mContext,
+ SettingsProvider.SETTINGS_UI_GENERAL_ICONS_LARGE,
+ R.bool.preferences_interface_general_icons_large_default);
+ state = current ? res.getString(R.string.setting_state_on)
+ : res.getString(R.string.setting_state_off);
+ ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ break;
+ default:
+ ((TextView) v.findViewById(R.id.item_state)).setText("");
+ }
}
- v.setTag(partition);
v.setOnClickListener(mSettingsItemListener);
}
@@ -225,63 +244,70 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
String value = ((TextView) v.findViewById(R.id.item_name)).getText().toString();
Resources res = mLauncher.getResources();
- // Handle toggles or launch pickers
- if (value.equals(res
- .getString(R.string.home_screen_search_text))) {
- onSettingsBooleanChanged(
- v,
- SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH,
- R.bool.preferences_interface_homescreen_search_default);
- mLauncher.setUpdateDynamicGrid();
- } else if (value.equals(res
- .getString(R.string.drawer_sorting_text))) {
- onClickTransitionEffectButton();
- } else if (value.equals(res
- .getString(R.string.scroll_effect_text)) &&
- ((Integer)v.getTag() == OverviewSettingsPanel.DRAWER_SETTINGS_POSITION)) {
- mLauncher.onClickTransitionEffectButton(v, true);
- } else if (value.equals(res
- .getString(R.string.scroll_effect_text)) &&
- ((Integer)v.getTag() == OverviewSettingsPanel.HOME_SETTINGS_POSITION)) {
- mLauncher.onClickTransitionEffectButton(v, false);
- } else if (value.equals(res
- .getString(R.string.larger_icons_text))) {
- onSettingsBooleanChanged(
- v,
- SettingsProvider.SETTINGS_UI_GENERAL_ICONS_LARGE,
- R.bool.preferences_interface_general_icons_large_default);
- mLauncher.setUpdateDynamicGrid();
- } else if (value.equals(res
- .getString(R.string.icon_labels)) &&
- ((Integer)v.getTag() == OverviewSettingsPanel.HOME_SETTINGS_POSITION)) {
- onIconLabelsBooleanChanged(
- v,
- SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
- R.bool.preferences_interface_homescreen_hide_icon_labels_default);
- mLauncher.setUpdateDynamicGrid();
- } else if (value.equals(res
- .getString(R.string.icon_labels)) &&
- ((Integer)v.getTag() == OverviewSettingsPanel.DRAWER_SETTINGS_POSITION)) {
- onIconLabelsBooleanChanged(
- v,
- SettingsProvider.SETTINGS_UI_DRAWER_HIDE_ICON_LABELS,
- R.bool.preferences_interface_drawer_hide_icon_labels_default);
- mLauncher.setUpdateDynamicGrid();
- } else if (value.equals(res.getString(R.string.protected_app_settings))) {
- Intent intent = new Intent();
- intent.setClassName(OverviewSettingsPanel.ANDROID_SETTINGS,
- OverviewSettingsPanel.ANDROID_PROTECTED_APPS);
- mLauncher.startActivity(intent);
- } else if (value.equals(res
- .getString(R.string.scrolling_wallpaper))) {
- onSettingsBooleanChanged(
- v,
- SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL,
- R.bool.preferences_interface_homescreen_scrolling_wallpaper_scroll_default);
- mLauncher.setUpdateDynamicGrid();
- } else if (value.equals(res
- .getString(R.string.grid_size_text))) {
- mLauncher.onClickDynamicGridSizeButton();
+ int partition = ((SettingsPosition) v.getTag()).partition;
+ int position = ((SettingsPosition) v.getTag()).position;
+
+ switch (partition) {
+ case OverviewSettingsPanel.HOME_SETTINGS_POSITION:
+ switch (position) {
+ case 0:
+ onSettingsBooleanChanged(v,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SEARCH,
+ R.bool.preferences_interface_homescreen_search_default);
+ mLauncher.setUpdateDynamicGrid();
+ break;
+ case 1:
+ mLauncher.onClickTransitionEffectButton(v, false);
+ break;
+ case 2:
+ onIconLabelsBooleanChanged(v,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
+ R.bool.preferences_interface_homescreen_hide_icon_labels_default);
+ mLauncher.setUpdateDynamicGrid();
+ break;
+ case 3:
+ onSettingsBooleanChanged(v,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL,
+ R.bool.preferences_interface_homescreen_scrolling_wallpaper_scroll_default);
+ mLauncher.setUpdateDynamicGrid();
+ break;
+ case 4:
+ mLauncher.onClickDynamicGridSizeButton();
+ break;
+
+ }
+ break;
+ case OverviewSettingsPanel.DRAWER_SETTINGS_POSITION:
+ switch (position) {
+ case 0:
+ mLauncher.onClickTransitionEffectButton(v, true);
+ break;
+ case 1:
+ onClickTransitionEffectButton();
+ break;
+ case 2:
+ onIconLabelsBooleanChanged(v,
+ SettingsProvider.SETTINGS_UI_DRAWER_HIDE_ICON_LABELS,
+ R.bool.preferences_interface_drawer_hide_icon_labels_default);
+ mLauncher.setUpdateDynamicGrid();
+ break;
+ }
+ break;
+ default:
+ switch (position) {
+ case 0:
+ onSettingsBooleanChanged(v,
+ SettingsProvider.SETTINGS_UI_GENERAL_ICONS_LARGE,
+ R.bool.preferences_interface_general_icons_large_default);
+ mLauncher.setUpdateDynamicGrid();
+ break;
+ case 1:
+ Intent intent = new Intent();
+ intent.setClassName(OverviewSettingsPanel.ANDROID_SETTINGS,
+ OverviewSettingsPanel.ANDROID_PROTECTED_APPS);
+ mLauncher.startActivity(intent);
+ break;
+ }
}
View defaultHome = mLauncher.findViewById(R.id.default_home_screen_panel);