Merge "Calling removeItems() should mark the item's previous cell as unoccupied. (3405806)" into honeycomb
diff --git a/src/com/android/launcher2/CachedViewGroup.java b/src/com/android/launcher2/CachedViewGroup.java
index b5cfd60..f314b32 100644
--- a/src/com/android/launcher2/CachedViewGroup.java
+++ b/src/com/android/launcher2/CachedViewGroup.java
@@ -26,6 +26,7 @@
import android.graphics.Rect;
import android.graphics.Bitmap.Config;
import android.graphics.PorterDuff.Mode;
+import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
@@ -52,6 +53,15 @@
public CachedViewGroup(Context context) {
super(context);
+ init();
+ }
+
+ public CachedViewGroup(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ init();
+ }
+
+ private void init() {
mBackgroundRect = new Rect();
mCacheRect = new Rect();
final Resources res = getResources();
@@ -124,14 +134,13 @@
float alpha = getAlpha();
setAlpha(1.0f);
isUpdatingCache = true;
- draw(mCacheCanvas);
+ drawChildren(mCacheCanvas);
isUpdatingCache = false;
setAlpha(alpha);
mIsCacheDirty = false;
}
-
public void drawChildren(Canvas canvas) {
super.dispatchDraw(canvas);
}
@@ -148,11 +157,6 @@
invalidateCache();
}
- public void removeViewWithoutMarkingCells(View view) {
- super.removeView(view);
- invalidateCache();
- }
-
@Override
public void removeView(View view) {
super.removeView(view);
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index b92aab2..6767cf1 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -50,7 +50,7 @@
import java.util.Arrays;
-public class CellLayout extends ViewGroup {
+public class CellLayout extends CachedViewGroup {
static final String TAG = "CellLayout";
private int mCellWidth;
@@ -363,14 +363,6 @@
}
}
- public void disableCacheUpdates() {
- mChildren.disableCacheUpdates();
- }
-
- public void enableCacheUpdates() {
- mChildren.enableCacheUpdates();
- }
-
@Override
protected void onDraw(Canvas canvas) {
// When we're large, we are either drawn in a "hover" state (ie when dragging an item to
@@ -538,7 +530,7 @@
}
public void removeViewWithoutMarkingCells(View view) {
- mChildren.removeViewWithoutMarkingCells(view);
+ mChildren.removeView(view);
}
@Override
diff --git a/src/com/android/launcher2/CellLayoutChildren.java b/src/com/android/launcher2/CellLayoutChildren.java
index 782db73..620da6a 100644
--- a/src/com/android/launcher2/CellLayoutChildren.java
+++ b/src/com/android/launcher2/CellLayoutChildren.java
@@ -18,11 +18,12 @@
import android.app.WallpaperManager;
import android.content.Context;
-import android.graphics.Canvas;
import android.graphics.Rect;
import android.view.View;
+import android.view.ViewGroup;
+import android.view.View.MeasureSpec;
-public class CellLayoutChildren extends CachedViewGroup {
+public class CellLayoutChildren extends ViewGroup {
static final String TAG = "CellLayoutChildren";
// These are temporary variables to prevent having to allocate a new object just to
@@ -94,7 +95,6 @@
@Override
protected void onLayout(boolean changed, int l, int t, int r, int b) {
- super.onLayout(changed, l, t, r, b);
int count = getChildCount();
for (int i = 0; i < count; i++) {
final View child = getChildAt(i);
@@ -168,3 +168,4 @@
super.setChildrenDrawnWithCacheEnabled(enabled);
}
}
+}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 8e73f58..f3208d0 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2783,10 +2783,12 @@
PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.0f));
alphaAnim.setDuration(res.getInteger(R.integer.config_allAppsFadeOutTime));
alphaAnim.setInterpolator(new DecelerateInterpolator(2.0f));
+ fromView.setLayerType(View.LAYER_TYPE_HARDWARE, null);
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEnd(Animator animation) {
fromView.setVisibility(View.GONE);
+ fromView.setLayerType(View.LAYER_TYPE_NONE, null);
}
});