summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorHayden Schoen <hayden@cyngn.com>2015-03-05 22:55:20 (GMT)
committerRaj Yengisetty <rajesh@cyngn.com>2015-03-06 23:37:46 (GMT)
commit4e5c80ff91db217d2b06be5cd05544203f95f0b4 (patch)
treeaa363cfff7772083094ba3ab86fcf446ecd2fd01
parente8b8d9c8cbc0f48a6d9a2344d7b63562b6ba6d19 (diff)
downloadandroid_packages_apps_Trebuchet-4e5c80ff91db217d2b06be5cd05544203f95f0b4.zip
android_packages_apps_Trebuchet-4e5c80ff91db217d2b06be5cd05544203f95f0b4.tar.gz
android_packages_apps_Trebuchet-4e5c80ff91db217d2b06be5cd05544203f95f0b4.tar.bz2
App Drawer: Disables specific settings for the paginated app
drawer while the vertical app drawer is selected Change-Id: I352bfd42f60d46c53ee74c4ecf6a6bb3f0b7ba90
-rw-r--r--res/values/cm_strings.xml2
-rw-r--r--src/com/android/launcher3/Launcher.java4
-rw-r--r--src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java52
3 files changed, 49 insertions, 9 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 2fbaa1a..389605e 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -80,4 +80,6 @@
<string name="drawer_type_drawer">Vertical</string>
<string name="drawer_type_pager">Paged</string>
+
+ <string name="setting_state_disabled">DISABLED</string>
</resources>
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index e0e05c8..fd219d4 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -1275,6 +1275,10 @@ public class Launcher extends Activity
R.integer.preferences_interface_drawer_type_default));
}
+ public AppDrawerListAdapter.DrawerType getDrawerType() {
+ return mDrawerType;
+ }
+
public void onClickSortModeButton(View v) {
final PopupMenu popupMenu = new PopupMenu(this, v);
final Menu menu = popupMenu.getMenu();
diff --git a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
index fdb3831..93b34b4 100644
--- a/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
+++ b/src/com/android/launcher3/list/SettingsPinnedHeaderAdapter.java
@@ -6,7 +6,9 @@ import android.content.SharedPreferences;
import android.content.res.Configuration;
import android.content.res.Resources;
import android.database.Cursor;
+import android.graphics.Color;
import android.graphics.Typeface;
+import android.util.Log;
import android.util.TypedValue;
import android.view.Gravity;
import android.view.LayoutInflater;
@@ -25,6 +27,8 @@ import com.android.launcher3.settings.SettingsProvider;
public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
private static final int PARTITION_TAG = 0;
private static final int POSITION_TAG = 1;
+ private static final float ENABLED_ALPHA = 1f;
+ private static final float DISABLED_ALPHA = 1f;
private Launcher mLauncher;
private Context mContext;
@@ -91,6 +95,7 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
Resources res = mLauncher.getResources();
+
boolean current = false;
String state = "";
@@ -135,12 +140,16 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
updateDrawerTypeSettingsItem(v);
break;
case 1:
- state = mLauncher.getAppsCustomizeTransitionEffect();
- state = mapEffectToValue(state);
- ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ if (!setDisabled(v)) {
+ state = mLauncher.getAppsCustomizeTransitionEffect();
+ state = mapEffectToValue(state);
+ ((TextView) v.findViewById(R.id.item_state)).setText(state);
+ }
break;
case 2:
- updateDrawerSortSettingsItem(v);
+ if (!setDisabled(v)) {
+ updateDrawerSortSettingsItem(v);
+ }
break;
case 3:
current = SettingsProvider.getBoolean(mContext,
@@ -207,11 +216,7 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
public void updateDrawerTypeSettingsItem(View v) {
String state = "";
- AppDrawerListAdapter.DrawerType type =
- AppDrawerListAdapter.DrawerType.getModeForValue(
- SettingsProvider.getInt(mLauncher,
- SettingsProvider.SETTINGS_UI_DRAWER_TYPE,
- R.integer.preferences_interface_drawer_type_default));
+ AppDrawerListAdapter.DrawerType type = mLauncher.getDrawerType();
switch (type) {
case Drawer:
state = mLauncher.getResources().getString(R.string.drawer_type_drawer);
@@ -313,9 +318,11 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
break;
case 1:
mLauncher.onClickTransitionEffectButton(v, true);
+
break;
case 2:
onClickSortButton();
+
break;
case 3:
onIconLabelsBooleanChanged(v,
@@ -408,4 +415,31 @@ public class SettingsPinnedHeaderAdapter extends PinnedHeaderListAdapter {
notifyDataSetChanged();
}
+
+ private boolean setDisabled(View v) {
+ TextView itemState = ((TextView) v.findViewById(R.id.item_state));
+ TextView itemName = ((TextView) v.findViewById(R.id.item_name));
+
+ AppDrawerListAdapter.DrawerType type = mLauncher.getDrawerType();
+
+ boolean isDisabled = false;
+
+ switch (type) {
+ case Drawer:
+ itemState.setAlpha(DISABLED_ALPHA);
+ itemState.setText(mLauncher.getResources()
+ .getString(R.string.setting_state_disabled));
+ itemName.setAlpha(DISABLED_ALPHA);
+ v.setEnabled(false);
+ isDisabled = true;
+ break;
+ case Pager:
+ itemState.setAlpha(ENABLED_ALPHA);
+ itemName.setAlpha(ENABLED_ALPHA);
+ v.setEnabled(true);
+ break;
+ }
+
+ return isDisabled;
+ }
}