diff --git a/src/com/android/launcher2/CachedViewGroup.java b/src/com/android/launcher2/CachedViewGroup.java index b5cfd60623..f314b32c60 100644 --- a/src/com/android/launcher2/CachedViewGroup.java +++ b/src/com/android/launcher2/CachedViewGroup.java @@ -26,6 +26,7 @@ import android.graphics.Paint; 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 class CachedViewGroup extends ViewGroup implements VisibilityChangedListe 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 @@ public class CachedViewGroup extends ViewGroup implements VisibilityChangedListe 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 @@ public class CachedViewGroup extends ViewGroup implements VisibilityChangedListe 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 448b766041..9b173be08c 100644 --- a/src/com/android/launcher2/CellLayout.java +++ b/src/com/android/launcher2/CellLayout.java @@ -50,7 +50,7 @@ import android.view.animation.LayoutAnimationController; 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 class CellLayout extends ViewGroup { } } - 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 @@ -542,7 +534,7 @@ public class CellLayout extends ViewGroup { } 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 09ab266883..a6f7f42143 100644 --- a/src/com/android/launcher2/CellLayoutChildren.java +++ b/src/com/android/launcher2/CellLayoutChildren.java @@ -18,11 +18,12 @@ package com.android.launcher2; 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 @@ public class CellLayoutChildren extends CachedViewGroup { @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); diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index a592f208e4..1733ddb2cf 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -2783,10 +2783,12 @@ public final class Launcher extends Activity 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); } });