summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher3/BubbleTextView.java
diff options
context:
space:
mode:
authorChris Wren <cwren@android.com>2014-06-24 18:24:23 -0400
committerChris Wren <cwren@android.com>2014-06-27 15:17:56 -0400
commit40c5ed303909c4df71037be3429aa1423e59585f (patch)
treeef0d2211280e8539bbd91ec1389ae64525cc450c /src/com/android/launcher3/BubbleTextView.java
parent9041a98280252abfa1a81065c103ee9a70943af5 (diff)
downloadandroid_packages_apps_Trebuchet-40c5ed303909c4df71037be3429aa1423e59585f.tar.gz
android_packages_apps_Trebuchet-40c5ed303909c4df71037be3429aa1423e59585f.tar.bz2
android_packages_apps_Trebuchet-40c5ed303909c4df71037be3429aa1423e59585f.zip
Offer to delete broken promise icons.
Track state of promise in the info, not the view. Fix bugs around moving promises to folders. Fix bugs around filterign and removing promises. Bug: 12764789 Change-Id: If5e8b6d315e463154b5bafe8aef7ef4f9889bb95
Diffstat (limited to 'src/com/android/launcher3/BubbleTextView.java')
-rw-r--r--src/com/android/launcher3/BubbleTextView.java34
1 files changed, 19 insertions, 15 deletions
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 95300c133..992ac5897 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -74,8 +74,6 @@ public class BubbleTextView extends TextView {
private CheckLongPressHelper mLongPressHelper;
private int mInstallState;
- private int mState;
-
private CharSequence mDefaultText = "";
public BubbleTextView(Context context) {
@@ -124,10 +122,9 @@ public class BubbleTextView extends TextView {
Drawable iconDrawable = Utilities.createIconDrawable(b);
setCompoundDrawables(null, iconDrawable, null, null);
setCompoundDrawablePadding(grid.iconDrawablePaddingPx);
- setText(info.title);
setTag(info);
if (info.isPromise()) {
- setState(ShortcutInfo.PACKAGE_STATE_UNKNOWN); // TODO: persist this state somewhere
+ applyState();
}
}
@@ -150,6 +147,11 @@ public class BubbleTextView extends TextView {
LauncherModel.checkItemInfo((ItemInfo) tag);
}
super.setTag(tag);
+ if (tag instanceof ShortcutInfo) {
+ final ShortcutInfo info = (ShortcutInfo) tag;
+ mDefaultText = info.title;
+ setText(mDefaultText);
+ }
}
@Override
@@ -415,19 +417,12 @@ public class BubbleTextView extends TextView {
mLongPressHelper.cancelLongPress();
}
- public void setState(int state) {
- if (mState == ShortcutInfo.PACKAGE_STATE_DEFAULT && mState != state) {
- mDefaultText = getText();
- }
- mState = state;
- applyState();
- }
-
- private void applyState() {
+ public void applyState() {
int alpha = getResources().getInteger(R.integer.promise_icon_alpha);
- if (DEBUG) Log.d(TAG, "applying icon state: " + mState);
+ final int state = getState();
+ if (DEBUG) Log.d(TAG, "applying icon state: " + state);
- switch(mState) {
+ switch(state) {
case ShortcutInfo.PACKAGE_STATE_DEFAULT:
super.setText(mDefaultText);
alpha = 255;
@@ -462,4 +457,13 @@ public class BubbleTextView extends TextView {
}
}
}
+
+ private int getState() {
+ if (! (getTag() instanceof ShortcutInfo)) {
+ return ShortcutInfo.PACKAGE_STATE_DEFAULT;
+ } else {
+ ShortcutInfo info = (ShortcutInfo) getTag();
+ return info.getState();
+ }
+ }
}