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
This commit is contained in:
1 parent
9041a98280
commit
40c5ed3039
7 files changed
+159
-25
No files matched your search
@@ -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();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user