Merge "Fixing scrolling of all apps when below apps" into honeycomb
diff --git a/res/drawable-xlarge-mdpi/app_market_generic.png b/res/drawable-xlarge-mdpi/app_market_generic.png
index 355ea6a..6eb5497 100644
--- a/res/drawable-xlarge-mdpi/app_market_generic.png
+++ b/res/drawable-xlarge-mdpi/app_market_generic.png
Binary files differ
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 448b766..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
@@ -491,10 +483,6 @@
return mCountY;
}
- public boolean addViewToCellLayout(View child, int index, int childId, LayoutParams params) {
- return addViewToCellLayout(child, index, childId, params, true);
- }
-
public boolean addViewToCellLayout(
View child, int index, int childId, LayoutParams params, boolean markCells) {
final LayoutParams lp = params;
@@ -542,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 09ab266..a6f7f42 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);
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index a592f20..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);
}
});
@@ -3331,8 +3333,8 @@
int count = workspace.getChildCount();
for (int i = 0; i < count; i++) {
// Use removeAllViewsInLayout() to avoid an extra requestLayout() and invalidate().
- final ViewGroup layout = ((CellLayout) workspace.getChildAt(i)).getChildrenLayout();
- layout.removeAllViewsInLayout();
+ final CellLayout layoutParent = (CellLayout) workspace.getChildAt(i);
+ layoutParent.removeAllViewsInLayout();
}
if (DEBUG_USER_INTERFACE) {
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index ef451ae..890bde8 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -2836,7 +2836,8 @@
}
for (int i = 0; i < screenCount; i++) {
- final ViewGroup layout = ((CellLayout) getChildAt(i)).getChildrenLayout();
+ final CellLayout layoutParent = (CellLayout) getChildAt(i);
+ final ViewGroup layout = layoutParent.getChildrenLayout();
// Avoid ANRs by treating each screen separately
post(new Runnable() {
@@ -2923,7 +2924,9 @@
childCount = childrenToRemove.size();
for (int j = 0; j < childCount; j++) {
View child = childrenToRemove.get(j);
- layout.removeViewInLayout(child);
+ // Note: We can not remove the view directly from CellLayoutChildren as this
+ // does not re-mark the spaces as unoccupied.
+ layoutParent.removeViewInLayout(child);
if (child instanceof DropTarget) {
mDragController.removeDropTarget((DropTarget)child);
}