summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlamefire <alex@grundis.de>2014-11-10 18:35:01 (GMT)
committerAdnan <adnan@cyngn.com>2014-11-19 23:53:58 (GMT)
commit6c336aea9f6f895fedb29840eb3598989317f8bc (patch)
tree8261baaef46a1b6f4a4a8c7dad87d668f3d5912b
parentec033982ef151a1e226ce452f64518879bd5a696 (diff)
downloadandroid_packages_apps_Trebuchet-6c336aea9f6f895fedb29840eb3598989317f8bc.zip
android_packages_apps_Trebuchet-6c336aea9f6f895fedb29840eb3598989317f8bc.tar.gz
android_packages_apps_Trebuchet-6c336aea9f6f895fedb29840eb3598989317f8bc.tar.bz2
Add options to hide icon labels from drawer and homescreen
Forward port from CM 10.2 PS3: Fix typo PS4: Rebase and global defaults PS8: Rebase to head Issue: There is already an Icon section in general, move both settings there or leave separate in their categories? Conflicts: res/values/preferences_defaults.xml res/xml/preferences_drawer.xml res/xml/preferences_homescreen.xml src/com/android/launcher3/AppsCustomizePagedView.java src/com/android/launcher3/Folder.java src/com/android/launcher3/Launcher.java src/com/android/launcher3/PagedViewIcon.java src/com/android/launcher3/Workspace.java Change-Id: I90ae4d2357e5f45fa9261c4eaa0fcf287996e327
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java4
-rw-r--r--src/com/android/launcher3/CellLayout.java5
-rw-r--r--src/com/android/launcher3/Folder.java6
-rw-r--r--src/com/android/launcher3/Launcher.java8
-rw-r--r--src/com/android/launcher3/TransitionEffectsFragment.java3
-rw-r--r--src/com/android/launcher3/Workspace.java12
6 files changed, 31 insertions, 7 deletions
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 61ae289..55b4a55 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -1032,11 +1032,15 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
layout.removeAllViewsOnPage();
ArrayList<Object> items = new ArrayList<Object>();
ArrayList<Bitmap> images = new ArrayList<Bitmap>();
+ boolean hideIconLabels = SettingsProvider.getBoolean(mLauncher,
+ SettingsProvider.SETTINGS_UI_DRAWER_HIDE_ICON_LABELS,
+ R.bool.preferences_interface_drawer_hide_icon_labels_default);
for (int i = startIndex; i < endIndex; ++i) {
AppInfo info = mApps.get(i);
BubbleTextView icon = (BubbleTextView) mLayoutInflater.inflate(
R.layout.apps_customize_application, layout, false);
icon.applyFromApplicationInfo(info);
+ icon.setTextVisibility(!hideIconLabels);
icon.setOnClickListener(mLauncher);
icon.setOnLongClickListener(this);
icon.setOnTouchListener(this);
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index 131d638..2ecc639 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -596,9 +596,8 @@ public class CellLayout extends ViewGroup {
final LayoutParams lp = params;
// Hotseat icons - remove text
- if (child instanceof BubbleTextView) {
- BubbleTextView bubbleChild = (BubbleTextView) child;
- bubbleChild.setTextVisibility(!mIsHotseat);
+ if (mIsHotseat && child instanceof BubbleTextView) {
+ ((BubbleTextView) child).setTextVisibility(false);
}
child.setScaleX(getChildrenScale());
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 6e6bb5d..91f3678 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -367,7 +367,11 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
// Convert to a string here to ensure that no other state associated with the text field
// gets saved.
String newTitle = mFolderName.getText().toString();
- mInfo.setTitle(newTitle);
+ if (!SettingsProvider.getBoolean(mLauncher,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
+ R.bool.preferences_interface_homescreen_hide_icon_labels_default)) {
+ mInfo.setTitle(newTitle);
+ }
LauncherModel.updateItemInDatabase(mLauncher, mInfo);
if (commit) {
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 15874a0..07d1708 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -460,6 +460,9 @@ public class Launcher extends Activity
super.onCreate(savedInstanceState);
initializeDynamicGrid();
+ mHideIconLabels = SettingsProvider.getBoolean(this,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
+ R.bool.preferences_interface_homescreen_hide_icon_labels_default);
// the LauncherApplication should call this, but in case of Instrumentation it might not be present yet
mSharedPrefs = getSharedPreferences(LauncherAppState.getSharedPreferencesKey(),
@@ -1649,6 +1652,7 @@ public class Launcher extends Activity
View createShortcut(int layoutResId, ViewGroup parent, ShortcutInfo info) {
BubbleTextView favorite = (BubbleTextView) mInflater.inflate(layoutResId, parent, false);
favorite.applyFromShortcutInfo(info, mIconCache, true);
+ favorite.setTextVisibility(!mHideIconLabels);
favorite.setOnClickListener(this);
favorite.setOnFocusChangeListener(mFocusHandler);
return favorite;
@@ -2589,6 +2593,9 @@ public class Launcher extends Activity
// Create the view
FolderIcon newFolder =
FolderIcon.fromXml(R.layout.folder_icon, this, layout, folderInfo, mIconCache);
+ if (container == LauncherSettings.Favorites.CONTAINER_DESKTOP) {
+ newFolder.setTextVisible(!mHideIconLabels);
+ }
mWorkspace.addInScreen(newFolder, container, screenId, cellX, cellY, 1, 1,
isWorkspaceLocked());
// Force measure the new folder icon
@@ -4666,6 +4673,7 @@ public class Launcher extends Activity
FolderIcon newFolder = FolderIcon.fromXml(R.layout.folder_icon, this,
(ViewGroup) workspace.getChildAt(workspace.getCurrentPage()),
(FolderInfo) item, mIconCache);
+ newFolder.setTextVisible(!mHideIconLabels);
workspace.addInScreenFromBind(newFolder, item.container, item.screenId, item.cellX,
item.cellY, 1, 1);
break;
diff --git a/src/com/android/launcher3/TransitionEffectsFragment.java b/src/com/android/launcher3/TransitionEffectsFragment.java
index 6340d9d..cb038b2 100644
--- a/src/com/android/launcher3/TransitionEffectsFragment.java
+++ b/src/com/android/launcher3/TransitionEffectsFragment.java
@@ -14,6 +14,7 @@ import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
+import android.widget.FrameLayout;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ListView;
@@ -27,7 +28,6 @@ public class TransitionEffectsFragment extends Fragment {
ImageView mTransitionIcon;
ListView mListView;
View mCurrentSelection;
- ScrollView mScrollView;
String[] mTransitionStates;
TypedArray mTransitionDrawables;
@@ -88,7 +88,6 @@ public class TransitionEffectsFragment extends Fragment {
mTransitionIcon = (ImageView) v.findViewById(R.id.settings_transition_image);
mListView = (ListView) v.findViewById(R.id.settings_transitions_list);
- mScrollView = (ScrollView) v.findViewById(R.id.scroll_view);
TextView title = (TextView) v.findViewById(R.id.transition_effect_title);
title.setText(getResources().getString(R.string.scroll_effect_text));
LinearLayout titleLayout = (LinearLayout) v.findViewById(R.id.transition_title);
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index 13ee53f..53e8040 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -307,6 +307,7 @@ public class Workspace extends SmoothPagedView
private boolean mShowSearchBar;
private boolean mShowOutlines;
private boolean mHideIconLabels;
+
/**
* Used to inflate the Workspace from XML.
*
@@ -342,6 +343,12 @@ public class Workspace extends SmoothPagedView
mScrollWallpaper = SettingsProvider.getBoolean(context,
SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL,
R.bool.preferences_interface_homescreen_scrolling_wallpaper_scroll_default);
+ mHideIconLabels = SettingsProvider.getBoolean(context,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
+ R.bool.preferences_interface_homescreen_hide_icon_labels_default);
+ mWorkspaceFadeInAdjacentScreens = SettingsProvider.getBoolean(context,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_FADE_ADJACENT,
+ R.bool.preferences_interface_homescreen_scrolling_fade_adjacent_default);
TransitionEffect.setFromString(this, SettingsProvider.getString(context,
SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_TRANSITION_EFFECT,
R.string.preferences_interface_homescreen_scrolling_transition_effect));
@@ -1057,7 +1064,9 @@ public class Workspace extends SmoothPagedView
} else {
// Show folder title if not in the hotseat
if (child instanceof FolderIcon) {
- ((FolderIcon) child).setTextVisible(true);
+ ((FolderIcon) child).setTextVisible(!mHideIconLabels);
+ } else if (child instanceof BubbleTextView) {
+ ((BubbleTextView) child).setTextVisibility(!mHideIconLabels);
}
layout = getScreenWithId(screenId);
child.setOnKeyListener(new IconKeyEventListener());
@@ -4063,6 +4072,7 @@ public class Workspace extends SmoothPagedView
case LauncherSettings.Favorites.ITEM_TYPE_FOLDER:
view = FolderIcon.fromXml(R.layout.folder_icon, mLauncher, cellLayout,
(FolderInfo) info, mIconCache);
+ ((FolderIcon) view).setTextVisible(!mHideIconLabels);
break;
default:
throw new IllegalStateException("Unknown item type: " + info.itemType);