summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/strings.xml2
-rw-r--r--src/com/android/launcher3/BubbleTextView.java44
2 files changed, 20 insertions, 26 deletions
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 1ac66207b..7bd9ff759 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -112,6 +112,8 @@
<string name="folder_hint_text">Unnamed Folder</string>
<!-- Accessibility -->
+ <!-- The format string for when an app is temporarily disabled. -->
+ <string name="disabled_app_label">Disabled <xliff:g id="app_name" example="Messenger">%1$s</xliff:g></string>
<skip />
<!-- The format string for default page scroll text [CHAR_LIMIT=none] -->
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index ca60d5cbd..33e4e2a67 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -153,34 +153,16 @@ public class BubbleTextView extends TextView
public void applyFromShortcutInfo(ShortcutInfo info, IconCache iconCache,
boolean promiseStateChanged) {
- Bitmap b = info.getIcon(iconCache);
-
- FastBitmapDrawable iconDrawable = mLauncher.createIconDrawable(b);
- if (info.isDisabled()) {
- iconDrawable.setState(FastBitmapDrawable.State.DISABLED);
- }
- setIcon(iconDrawable);
- if (info.contentDescription != null) {
- setContentDescription(info.contentDescription);
- }
- setText(info.title);
+ applyIconAndLabel(info.getIcon(iconCache), info);
setTag(info);
-
if (promiseStateChanged || info.isPromise()) {
applyState(promiseStateChanged);
}
}
public void applyFromApplicationInfo(AppInfo info) {
- FastBitmapDrawable iconDrawable = mLauncher.createIconDrawable(info.iconBitmap);
- if (info.isDisabled()) {
- iconDrawable.setState(FastBitmapDrawable.State.DISABLED);
- }
- setIcon(iconDrawable);
- setText(info.title);
- if (info.contentDescription != null) {
- setContentDescription(info.contentDescription);
- }
+ applyIconAndLabel(info.iconBitmap, info);
+
// We don't need to check the info since it's not a ShortcutInfo
super.setTag(info);
@@ -189,11 +171,7 @@ public class BubbleTextView extends TextView
}
public void applyFromPackageItemInfo(PackageItemInfo info) {
- setIcon(mLauncher.createIconDrawable(info.iconBitmap));
- setText(info.title);
- if (info.contentDescription != null) {
- setContentDescription(info.contentDescription);
- }
+ applyIconAndLabel(info.iconBitmap, info);
// We don't need to check the info since it's not a ShortcutInfo
super.setTag(info);
@@ -201,6 +179,20 @@ public class BubbleTextView extends TextView
verifyHighRes();
}
+ private void applyIconAndLabel(Bitmap icon, ItemInfo info) {
+ FastBitmapDrawable iconDrawable = mLauncher.createIconDrawable(icon);
+ if (info.isDisabled()) {
+ iconDrawable.setState(FastBitmapDrawable.State.DISABLED);
+ }
+ setIcon(iconDrawable);
+ setText(info.title);
+ if (info.contentDescription != null) {
+ setContentDescription(info.isDisabled()
+ ? getContext().getString(R.string.disabled_app_label, info.contentDescription)
+ : info.contentDescription);
+ }
+ }
+
/**
* Used for measurement only, sets some dummy values on this view.
*/