summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFlamefire <alex@grundis.de>2014-04-02 20:02:43 +0200
committerFlamefire <alex@grundis.de>2014-04-22 19:40:44 +0200
commit45936b33b0e03b1f3111a0bfaa61344cd10b2cd1 (patch)
tree55d20ae5f55397e9e28275a4e987774d1b18c4f4
parent6a43e660cce2cda206f4fecf3ed4ecf9dce8f326 (diff)
downloadandroid_packages_apps_Trebuchet-45936b33b0e03b1f3111a0bfaa61344cd10b2cd1.tar.gz
android_packages_apps_Trebuchet-45936b33b0e03b1f3111a0bfaa61344cd10b2cd1.tar.bz2
android_packages_apps_Trebuchet-45936b33b0e03b1f3111a0bfaa61344cd10b2cd1.zip
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? Change-Id: I90ae4d2357e5f45fa9261c4eaa0fcf287996e327
-rw-r--r--res/values/cm_strings.xml4
-rw-r--r--res/values/preferences_defaults.xml2
-rw-r--r--res/xml/preferences_drawer.xml6
-rw-r--r--res/xml/preferences_homescreen.xml4
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java4
-rw-r--r--src/com/android/launcher3/CellLayout.java9
-rw-r--r--src/com/android/launcher3/Folder.java18
-rw-r--r--src/com/android/launcher3/Launcher.java21
-rw-r--r--src/com/android/launcher3/PagedViewIcon.java25
-rw-r--r--src/com/android/launcher3/Workspace.java12
-rw-r--r--src/com/android/launcher3/settings/SettingsProvider.java2
11 files changed, 82 insertions, 25 deletions
diff --git a/res/values/cm_strings.xml b/res/values/cm_strings.xml
index 73598a571..7f5de470f 100644
--- a/res/values/cm_strings.xml
+++ b/res/values/cm_strings.xml
@@ -52,6 +52,8 @@
<string name="preferences_interface_homescreen_title">Homescreen</string>
<string name="preferences_interface_homescreen_search_title">Search bar</string>
<string name="preferences_interface_homescreen_search_summary">Show persistent search bar at top of screen</string>
+ <string name="preferences_interface_homescreen_general_hide_icon_labels_title">Hide icon labels</string>
+ <string name="preferences_interface_homescreen_general_hide_icon_labels_summary">Hide icon labels on homescreen</string>
<!-- Drawer -->
<string name="preferences_interface_drawer_title">Drawer</string>
@@ -63,6 +65,8 @@
<string name="preferences_interface_drawer_hidden_apps_shortcuts_summary">Remove the shortcuts of hidden apps from the homescreen</string>
<string name="preferences_interface_drawer_hidden_apps_widgets_title">Remove widgets</string>
<string name="preferences_interface_drawer_hidden_apps_widgets_summary">Remove the widgets of hidden apps from the homescreen</string>
+ <string name="preferences_interface_drawer_hide_icon_labels_title">Hide icon labels</string>
+ <string name="preferences_interface_drawer_hide_icon_labels_summary">Hide icon labels in drawer</string>
<!-- Dock -->
<string name="preferences_interface_dock_title">Dock</string>
diff --git a/res/values/preferences_defaults.xml b/res/values/preferences_defaults.xml
index daf28a3de..676b174a2 100644
--- a/res/values/preferences_defaults.xml
+++ b/res/values/preferences_defaults.xml
@@ -5,10 +5,12 @@
<bool name="preferences_interface_homescreen_scrolling_wallpaper_scroll_default">true</bool>
<bool name="preferences_interface_homescreen_scrolling_page_outlines_default">@bool/config_workspaceDefaultShowOutlines</bool>
<bool name="preferences_interface_homescreen_scrolling_fade_adjacent_default">@bool/config_workspaceFadeAdjacentScreens</bool>
+ <bool name="preferences_interface_homescreen_hide_icon_labels">true</bool>
<string name="preferences_interface_drawer_scrolling_transition_effect">stack</string>
<bool name="preferences_interface_drawer_scrolling_fade_adjacent_default">false</bool>
<bool name="preferences_interface_drawer_remove_hidden_apps_shortcuts_default">true</bool>
<bool name="preferences_interface_drawer_remove_hidden_apps_widgets_default">true</bool>
+ <bool name="preferences_interface_drawer_hide_icon_labels_default">true</bool>
<bool name="preferences_interface_general_icons_large_default">@bool/config_largeIcons</bool>
<string name="preferences_interface_general_icons_text_font_family_default">sans-serif-condensed</string>
<integer name="preferences_interface_general_icons_text_font_style_default">0</integer>
diff --git a/res/xml/preferences_drawer.xml b/res/xml/preferences_drawer.xml
index c59d6b7fe..b22597516 100644
--- a/res/xml/preferences_drawer.xml
+++ b/res/xml/preferences_drawer.xml
@@ -33,4 +33,10 @@
android:summary="@string/preferences_interface_drawer_hidden_apps_widgets_summary"
android:defaultValue="@bool/preferences_interface_drawer_remove_hidden_apps_widgets_default" />
</PreferenceCategory>
+ <PreferenceCategory android:title="@string/preferences_interface_general_icons_category">
+ <CheckBoxPreference android:key="ui_drawer_hide_icon_labels"
+ android:title="@string/preferences_interface_drawer_hide_icon_labels_title"
+ android:summary="@string/preferences_interface_drawer_hide_icon_labels_summary"
+ android:defaultValue="@bool/preferences_interface_drawer_hide_icon_labels_default" />
+ </PreferenceCategory>
</PreferenceScreen> \ No newline at end of file
diff --git a/res/xml/preferences_homescreen.xml b/res/xml/preferences_homescreen.xml
index 8b2652b9a..4671a8a4a 100644
--- a/res/xml/preferences_homescreen.xml
+++ b/res/xml/preferences_homescreen.xml
@@ -22,4 +22,8 @@
android:title="@string/preferences_interface_homescreen_search_title"
android:summary="@string/preferences_interface_homescreen_search_summary"
android:defaultValue="@bool/preferences_interface_homescreen_search_default" />
+ <CheckBoxPreference android:key="ui_homescreen_general_hide_icon_labels"
+ android:title="@string/preferences_interface_homescreen_general_hide_icon_labels_title"
+ android:summary="@string/preferences_interface_homescreen_general_hide_icon_labels_summary"
+ android:defaultValue="@bool/preferences_interface_homescreen_hide_icon_labels" />
</PreferenceScreen>
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 0cc540436..7e67f7c60 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -1114,11 +1114,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 = mFilteredApps.get(i);
PagedViewIcon icon = (PagedViewIcon) mLayoutInflater.inflate(
R.layout.apps_customize_application, layout, false);
icon.applyFromApplicationInfo(info, true, this);
+ icon.setTextVisibility(!hideIconLabels);
icon.setOnClickListener(this);
icon.setOnLongClickListener(this);
icon.setOnTouchListener(this);
diff --git a/src/com/android/launcher3/CellLayout.java b/src/com/android/launcher3/CellLayout.java
index dafb79ffc..dc2db8773 100644
--- a/src/com/android/launcher3/CellLayout.java
+++ b/src/com/android/launcher3/CellLayout.java
@@ -35,7 +35,6 @@ import android.graphics.PorterDuffXfermode;
import android.graphics.Rect;
import android.graphics.drawable.ColorDrawable;
import android.graphics.drawable.Drawable;
-import android.graphics.drawable.NinePatchDrawable;
import android.os.Parcelable;
import android.util.AttributeSet;
import android.util.Log;
@@ -48,7 +47,6 @@ import android.view.animation.Animation;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LayoutAnimationController;
-import com.android.launcher3.R;
import com.android.launcher3.FolderIcon.FolderRingAnimator;
import java.util.ArrayList;
@@ -198,7 +196,7 @@ public class CellLayout extends ViewGroup {
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.CellLayout, defStyle, 0);
mCellWidth = mCellHeight = -1;
- mFixedCellHeight = mFixedCellHeight = -1;
+ mFixedCellWidth = mFixedCellHeight = -1;
mWidthGap = mOriginalWidthGap = 0;
mHeightGap = mOriginalHeightGap = 0;
mMaxGap = Integer.MAX_VALUE;
@@ -606,9 +604,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 1a25760ae..1fcfa1173 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -31,9 +31,7 @@ import android.text.InputType;
import android.text.Selection;
import android.text.Spannable;
import android.util.AttributeSet;
-import android.util.DisplayMetrics;
import android.util.Log;
-import android.util.TypedValue;
import android.view.ActionMode;
import android.view.KeyEvent;
import android.view.LayoutInflater;
@@ -43,8 +41,6 @@ import android.view.MotionEvent;
import android.view.View;
import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
-import android.view.animation.AccelerateInterpolator;
-import android.view.animation.Interpolator;
import android.view.inputmethod.EditorInfo;
import android.view.inputmethod.InputMethodManager;
import android.widget.LinearLayout;
@@ -52,6 +48,7 @@ import android.widget.ScrollView;
import android.widget.TextView;
import com.android.launcher3.FolderInfo.FolderListener;
+import com.android.launcher3.settings.SettingsProvider;
import java.util.ArrayList;
import java.util.Collections;
@@ -195,6 +192,13 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
mFolderName.setInputType(mFolderName.getInputType() |
InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS | InputType.TYPE_TEXT_FLAG_CAP_WORDS);
mAutoScrollHelper = new FolderAutoScrollHelper(mScrollView);
+
+ if (SettingsProvider.getBoolean(mLauncher,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
+ R.bool.preferences_interface_homescreen_hide_icon_labels)) {
+ mFolderName.setVisibility(View.GONE);
+ mFolderNameHeight = getPaddingBottom();
+ }
}
private ActionMode.Callback mActionModeCallback = new ActionMode.Callback() {
@@ -270,7 +274,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)) {
+ 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 620071460..29618422d 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -50,9 +50,7 @@ import android.content.pm.PackageManager;
import android.content.pm.PackageManager.NameNotFoundException;
import android.content.res.Configuration;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.database.ContentObserver;
-import android.database.DataSetObserver;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Point;
@@ -96,15 +94,9 @@ import android.view.accessibility.AccessibilityManager;
import android.view.animation.AccelerateDecelerateInterpolator;
import android.view.animation.DecelerateInterpolator;
import android.view.inputmethod.InputMethodManager;
-
-import android.widget.AbsListView;
-import android.widget.AdapterView;
import android.widget.Advanceable;
-import android.widget.ArrayAdapter;
import android.widget.FrameLayout;
-import android.widget.GridView;
import android.widget.ImageView;
-import android.widget.ListAdapter;
import android.widget.PopupMenu;
import android.widget.TextView;
import android.widget.Toast;
@@ -123,7 +115,6 @@ import java.io.IOException;
import java.io.PrintWriter;
import java.text.DateFormat;
import java.util.ArrayList;
-import java.util.Arrays;
import java.util.Collection;
import java.util.Date;
import java.util.HashMap;
@@ -345,6 +336,9 @@ public class Launcher extends Activity
private HideFromAccessibilityHelper mHideFromAccessibilityHelper
= new HideFromAccessibilityHelper();
+ // Preferences
+ private boolean mHideIconLabels;
+
private Runnable mBuildLayersRunnable = new Runnable() {
public void run() {
if (mWorkspace != null) {
@@ -395,6 +389,10 @@ public class Launcher extends Activity
LauncherAppState.setApplicationContext(getApplicationContext());
LauncherAppState app = LauncherAppState.getInstance();
+ mHideIconLabels = SettingsProvider.getBoolean(this,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
+ R.bool.preferences_interface_homescreen_hide_icon_labels);
+
// Determine the dynamic grid properties
Point smallestSize = new Point();
Point largestSize = new Point();
@@ -1482,6 +1480,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);
+ favorite.setTextVisibility(!mHideIconLabels);
favorite.setOnClickListener(this);
if (info.itemType == LauncherSettings.Favorites.ITEM_TYPE_ALLAPPS && info.getIcon(mIconCache) == null) {
// All apps icon
@@ -2301,6 +2300,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
@@ -4021,6 +4023,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/PagedViewIcon.java b/src/com/android/launcher3/PagedViewIcon.java
index 8bfe42d24..785725852 100644
--- a/src/com/android/launcher3/PagedViewIcon.java
+++ b/src/com/android/launcher3/PagedViewIcon.java
@@ -20,7 +20,6 @@ import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Region;
-import android.graphics.Region.Op;
import android.util.AttributeSet;
import android.util.TypedValue;
import android.widget.TextView;
@@ -44,6 +43,9 @@ public class PagedViewIcon extends TextView {
private Bitmap mIcon;
+ private int mTextColor;
+ private boolean mIsTextVisible;
+
public PagedViewIcon(Context context) {
this(context, null);
}
@@ -63,6 +65,8 @@ public class PagedViewIcon extends TextView {
LauncherAppState app = LauncherAppState.getInstance();
DeviceProfile grid = app.getDynamicGrid().getDeviceProfile();
setTextSize(TypedValue.COMPLEX_UNIT_SP, grid.iconTextSize);
+ mTextColor = getCurrentTextColor();
+ mIsTextVisible = mTextColor != getResources().getColor(android.R.color.transparent);
}
public void applyFromApplicationInfo(AppInfo info, boolean scaleUp,
@@ -126,4 +130,23 @@ public class PagedViewIcon extends TextView {
super.draw(canvas);
canvas.restore();
}
+
+ @Override
+ public void setTextColor(int color) {
+ mTextColor = color;
+ super.setTextColor(color);
+ }
+
+ public void setTextVisibility(boolean visible) {
+ if (visible) {
+ super.setTextColor(mTextColor);
+ } else {
+ super.setTextColor(getResources().getColor(android.R.color.transparent));
+ }
+ mIsTextVisible = visible;
+ }
+
+ public boolean isTextVisible() {
+ return mIsTextVisible;
+ }
}
diff --git a/src/com/android/launcher3/Workspace.java b/src/com/android/launcher3/Workspace.java
index c3ce8bf69..83074aeda 100644
--- a/src/com/android/launcher3/Workspace.java
+++ b/src/com/android/launcher3/Workspace.java
@@ -54,10 +54,7 @@ import android.view.Display;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
-import android.view.View.OnClickListener;
-import android.view.accessibility.AccessibilityEvent;
import android.view.accessibility.AccessibilityManager;
-import android.view.accessibility.AccessibilityNodeInfo;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.Interpolator;
import android.widget.TextView;
@@ -282,6 +279,7 @@ public class Workspace extends SmoothPagedView
private boolean mShowSearchBar;
private boolean mShowOutlines;
+ private boolean mHideIconLabels;
/**
* Used to inflate the Workspace from XML.
@@ -315,6 +313,9 @@ public class Workspace extends SmoothPagedView
mShowOutlines = SettingsProvider.getBoolean(context,
SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_PAGE_OUTLINES,
R.bool.preferences_interface_homescreen_scrolling_page_outlines_default);
+ mHideIconLabels = SettingsProvider.getBoolean(context,
+ SettingsProvider.SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS,
+ R.bool.preferences_interface_homescreen_hide_icon_labels);
mWorkspaceFadeInAdjacentScreens = SettingsProvider.getBoolean(context,
SettingsProvider.SETTINGS_UI_HOMESCREEN_SCROLLING_FADE_ADJACENT,
R.bool.preferences_interface_homescreen_scrolling_fade_adjacent_default);
@@ -895,7 +896,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());
@@ -3707,6 +3710,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);
diff --git a/src/com/android/launcher3/settings/SettingsProvider.java b/src/com/android/launcher3/settings/SettingsProvider.java
index 3a211952a..abf4e1b67 100644
--- a/src/com/android/launcher3/settings/SettingsProvider.java
+++ b/src/com/android/launcher3/settings/SettingsProvider.java
@@ -26,6 +26,7 @@ public final class SettingsProvider {
public static final String SETTINGS_UI_HOMESCREEN_DEFAULT_SCREEN_ID = "ui_homescreen_default_screen_id";
public static final String SETTINGS_UI_HOMESCREEN_SEARCH = "ui_homescreen_search";
+ public static final String SETTINGS_UI_HOMESCREEN_HIDE_ICON_LABELS = "ui_homescreen_general_hide_icon_labels";
public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_TRANSITION_EFFECT = "ui_homescreen_scrolling_transition_effect";
public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_WALLPAPER_SCROLL = "ui_homescreen_scrolling_wallpaper_scroll";
public static final String SETTINGS_UI_HOMESCREEN_SCROLLING_PAGE_OUTLINES = "ui_homescreen_scrolling_page_outlines";
@@ -35,6 +36,7 @@ public final class SettingsProvider {
public static final String SETTINGS_UI_DRAWER_HIDDEN_APPS = "ui_drawer_hidden_apps";
public static final String SETTINGS_UI_DRAWER_REMOVE_HIDDEN_APPS_SHORTCUTS = "ui_drawer_remove_hidden_apps_shortcuts";
public static final String SETTINGS_UI_DRAWER_REMOVE_HIDDEN_APPS_WIDGETS = "ui_drawer_remove_hidden_apps_widgets";
+ public static final String SETTINGS_UI_DRAWER_HIDE_ICON_LABELS = "ui_drawer_hide_icon_labels";
public static final String SETTINGS_UI_GENERAL_ICONS_LARGE = "ui_general_icons_large";
public static final String SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_FAMILY = "ui_general_icons_text_font";
public static final String SETTINGS_UI_GENERAL_ICONS_TEXT_FONT_STYLE = "ui_general_icons_text_font_style";