summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/BubbleTextView.java
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-07-13 10:46:07 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-07-13 10:46:34 -0700
commitf420438a0b04205d18270923a01a5bd3bc464da8 (patch)
tree0308f6234bbbf39001531ca79c718ffd96273616 /src/com/android/launcher3/BubbleTextView.java
parentba162aa7d2a49c09c00ff3184ffda3bea0e55509 (diff)
downloadandroid_packages_apps_Trebuchet-f420438a0b04205d18270923a01a5bd3bc464da8.tar.gz
android_packages_apps_Trebuchet-f420438a0b04205d18270923a01a5bd3bc464da8.tar.bz2
android_packages_apps_Trebuchet-f420438a0b04205d18270923a01a5bd3bc464da8.zip
Updating the content description of disabled icons
Bug: 27644457 Change-Id: I03aec29e0ea6017b51dcd7567967a067e478cefd
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r--src/com/android/launcher3/BubbleTextView.java44
1 files changed, 18 insertions, 26 deletions
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.
*/