summaryrefslogtreecommitdiffstats
path: root/src/com/android/launcher2/AppsCustomizePagedView.java
diff options
context:
space:
mode:
authorWinson Chung <winsonc@google.com>2011-05-05 17:06:13 -0700
committerWinson Chung <winsonc@google.com>2011-05-06 16:25:37 -0700
commit63257c110a4ee54d5e8872c471cce254cf613c7a (patch)
tree4dc38f02429a6e4c78356ddabb39e1af17dc4b2c /src/com/android/launcher2/AppsCustomizePagedView.java
parent563ed71d682cc979a095fff7d27f1afe378508df (diff)
downloadandroid_packages_apps_Trebuchet-63257c110a4ee54d5e8872c471cce254cf613c7a.tar.gz
android_packages_apps_Trebuchet-63257c110a4ee54d5e8872c471cce254cf613c7a.tar.bz2
android_packages_apps_Trebuchet-63257c110a4ee54d5e8872c471cce254cf613c7a.zip
Minor changes to help address some hiccups when panning, changing tabs and rotating in AppsCustomize.
- Also removing references to old all-apps 2d/3d Change-Id: Ibe07ad8b4facc5c57b3c82ccf0b55260be61a31b
Diffstat (limited to 'src/com/android/launcher2/AppsCustomizePagedView.java')
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java30
1 files changed, 26 insertions, 4 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index 307140d1d..a1e61714a 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -44,6 +44,7 @@ import android.util.LruCache;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
+import android.view.ViewGroup;
import android.view.animation.DecelerateInterpolator;
import android.view.animation.LinearInterpolator;
import android.widget.FrameLayout;
@@ -471,17 +472,28 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
/*
* Apps PagedView implementation
*/
+ private void setVisibilityOnChildren(ViewGroup layout, int visibility) {
+ int childCount = layout.getChildCount();
+ for (int i = 0; i < childCount; ++i) {
+ layout.getChildAt(i).setVisibility(visibility);
+ }
+ }
private void setupPage(PagedViewCellLayout layout) {
layout.setCellCount(mCellCountX, mCellCountY);
layout.setGap(mPageLayoutWidthGap, mPageLayoutHeightGap);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
- // We force a measure here to get around the fact that when we do layout calculations
- // immediately after syncing, we don't have a proper width.
+ // Note: We force a measure here to get around the fact that when we do layout calculations
+ // immediately after syncing, we don't have a proper width. That said, we already know the
+ // expected page width, so we can actually optimize by hiding all the TextView-based
+ // children that are expensive to measure, and let that happen naturally later.
+ setVisibilityOnChildren(layout, View.GONE);
int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
+ layout.setMinimumWidth(getPageContentWidth());
layout.measure(widthSpec, heightSpec);
+ setVisibilityOnChildren(layout, View.VISIBLE);
}
public void syncAppsPages() {
// Ensure that we have the right number of pages
@@ -514,8 +526,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int index = i - startIndex;
int x = index % mCellCountX;
int y = index / mCellCountX;
- setupPage(layout);
- layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1));
+ layout.addViewToCellLayout(icon, -1, i, new PagedViewCellLayout.LayoutParams(x,y, 1,1),
+ isHardwareAccelerated() && (numPages > 1));
}
}
/*
@@ -525,7 +537,17 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
layout.setGravity(Gravity.LEFT);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
+
+ // Note: We force a measure here to get around the fact that when we do layout calculations
+ // immediately after syncing, we don't have a proper width. That said, we already know the
+ // expected page width, so we can actually optimize by hiding all the TextView-based
+ // children that are expensive to measure, and let that happen naturally later.
+ setVisibilityOnChildren(layout, View.GONE);
+ int widthSpec = MeasureSpec.makeMeasureSpec(getMeasuredWidth(), MeasureSpec.AT_MOST);
+ int heightSpec = MeasureSpec.makeMeasureSpec(getMeasuredHeight(), MeasureSpec.AT_MOST);
layout.setMinimumWidth(getPageContentWidth());
+ layout.measure(widthSpec, heightSpec);
+ setVisibilityOnChildren(layout, View.VISIBLE);
}
private void renderDrawableToBitmap(Drawable d, Bitmap bitmap, int x, int y, int w, int h,
float scaleX, float scaleY) {