Fixed bug: newly added apps didn't show up immediately
Now, whenever apps change visibility or are removed, we invalidate the bitmap cache for CellLayout
Change-Id: I883ea6cc07b1b09775bb7d262417acb34fbec3de
diff --git a/src/com/android/launcher2/BubbleTextView.java b/src/com/android/launcher2/BubbleTextView.java
index 348fe34..4d1dbf8 100644
--- a/src/com/android/launcher2/BubbleTextView.java
+++ b/src/com/android/launcher2/BubbleTextView.java
@@ -30,13 +30,14 @@
import android.graphics.drawable.Drawable;
import android.util.AttributeSet;
import android.view.MotionEvent;
+import android.view.View;
/**
* TextView that draws a bubble behind the text. We cannot use a LineBackgroundSpan
* because we want to make the bubble taller than the text and TextView's clip is
* too aggressive.
*/
-public class BubbleTextView extends CacheableTextView {
+public class BubbleTextView extends CacheableTextView implements VisibilityChangedBroadcaster {
static final float CORNER_RADIUS = 4.0f;
static final float SHADOW_LARGE_RADIUS = 4.0f;
static final float SHADOW_SMALL_RADIUS = 1.75f;
@@ -64,6 +65,8 @@
private boolean mBackgroundSizeChanged;
private Drawable mBackground;
+ private VisibilityChangedListener mOnVisibilityChangedListener;
+
public BubbleTextView(Context context) {
super(context);
init();
@@ -240,6 +243,18 @@
return result;
}
+ public void setVisibilityChangedListener(VisibilityChangedListener listener) {
+ mOnVisibilityChangedListener = listener;
+ }
+
+ @Override
+ protected void onVisibilityChanged(View changedView, int visibility) {
+ if (mOnVisibilityChangedListener != null) {
+ mOnVisibilityChangedListener.receiveVisibilityChangedMessage(this);
+ }
+ super.onVisibilityChanged(changedView, visibility);
+ }
+
@Override
public void draw(Canvas canvas) {
if (mPressedOrFocusedBackground != null && (isPressed() || isFocused())) {