summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorTony Wickham <twickham@google.com>2016-07-13 17:46:26 -0700
committerTony Wickham <twickham@google.com>2016-07-13 17:46:26 -0700
commitdb19730e87f8c8a978e6427071cfd465f6050aad (patch)
tree2c4fec77c28311690cb00bae76be907721110f0c /src
parent7b8f1eaba147ac42a347f3787d0e90b24be015db (diff)
downloadandroid_packages_apps_Trebuchet-db19730e87f8c8a978e6427071cfd465f6050aad.tar.gz
android_packages_apps_Trebuchet-db19730e87f8c8a978e6427071cfd465f6050aad.tar.bz2
android_packages_apps_Trebuchet-db19730e87f8c8a978e6427071cfd465f6050aad.zip
Use the shortcut's long label in the container, if it is available.
Bug: 28980830 Change-Id: Iefea0a7ee4be5bf45af14ce47abdd597f4137f92
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java13
1 files changed, 11 insertions, 2 deletions
diff --git a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
index 5479453e4..d9e34a69a 100644
--- a/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
+++ b/src/com/android/launcher3/shortcuts/DeepShortcutsContainer.java
@@ -10,6 +10,7 @@ import android.graphics.Rect;
import android.os.Build;
import android.os.Handler;
import android.os.Looper;
+import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.MotionEvent;
import android.view.View;
@@ -113,7 +114,11 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
final ShortcutInfoCompat shortcut = shortcuts.get(i);
final ShortcutInfo launcherShortcutInfo = ShortcutInfo
.fromDeepShortcutInfo(shortcut, mLauncher);
- uiHandler.post(new UpdateShortcutChild(i, launcherShortcutInfo));
+ CharSequence label = shortcut.getLongLabel();
+ if (TextUtils.isEmpty(label)) {
+ label = shortcut.getShortLabel();
+ }
+ uiHandler.post(new UpdateShortcutChild(i, launcherShortcutInfo, label));
}
}
});
@@ -123,10 +128,13 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
private class UpdateShortcutChild implements Runnable {
private int mShortcutChildIndex;
private ShortcutInfo mShortcutChildInfo;
+ private CharSequence mLabel;
- public UpdateShortcutChild(int shortcutChildIndex, ShortcutInfo shortcutChildInfo) {
+ public UpdateShortcutChild(int shortcutChildIndex, ShortcutInfo shortcutChildInfo,
+ CharSequence label) {
mShortcutChildIndex = shortcutChildIndex;
mShortcutChildInfo = shortcutChildInfo;
+ mLabel = label;
}
@Override
@@ -134,6 +142,7 @@ public class DeepShortcutsContainer extends LinearLayout implements View.OnLongC
DeepShortcutView shortcutView = (DeepShortcutView) getChildAt(mShortcutChildIndex);
shortcutView.applyFromShortcutInfo(mShortcutChildInfo,
LauncherAppState.getInstance().getIconCache());
+ shortcutView.setText(mLabel);
shortcutView.setOnClickListener(mLauncher);
shortcutView.setOnLongClickListener(DeepShortcutsContainer.this);
shortcutView.setOnTouchListener(DeepShortcutsContainer.this);