summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2011-09-01 17:22:18 -0700
committerAdam Cohen <adamcohen@google.com>2011-09-07 18:16:11 -0700
commit22f823d340710bcde587b18a1542570cbe0360f5 (patch)
treed864a3e0f20b57664a71be01ceff1f72481143d6 /src
parent4512637a8a38610282caafe1335a67073dda8224 (diff)
downloadpackages_apps_trebuchet-22f823d340710bcde587b18a1542570cbe0360f5.zip
packages_apps_trebuchet-22f823d340710bcde587b18a1542570cbe0360f5.tar.gz
packages_apps_trebuchet-22f823d340710bcde587b18a1542570cbe0360f5.tar.bz2
New AllAppsCustomize transitions
Change-Id: Ibefda8bf156810849c5e8f3383d49ae64a7ee08a
Diffstat (limited to 'src')
-rw-r--r--src/com/android/launcher2/AppsCustomizePagedView.java112
-rw-r--r--src/com/android/launcher2/PagedView.java58
-rw-r--r--src/com/android/launcher2/PagedViewCellLayout.java50
-rw-r--r--src/com/android/launcher2/PagedViewCellLayoutChildren.java8
-rw-r--r--src/com/android/launcher2/PagedViewGridLayout.java20
5 files changed, 143 insertions, 105 deletions
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index d3e0963..8d49b4c 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -189,6 +189,14 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
private final float sWidgetPreviewIconPaddingPercentage = 0.25f;
private PagedViewCellLayout mWidgetSpacingLayout;
+ // Relating to the scroll and overscroll effects
+ Workspace.ZInterpolator mZInterpolator = new Workspace.ZInterpolator(0.5f);
+ private float mDensity;
+ private static float CAMERA_DISTANCE = 3500;
+ private static float TRANSITION_SCALE_FACTOR = 0.6f;
+ private static float TRANSITION_PIVOT = 0.75f;
+ private static float TRANSITION_MAX_ROTATION = 26f;
+
// Previews & outlines
ArrayList<AppsCustomizeAsyncTask> mRunningTasks;
private HolographicOutlineHelper mHolographicOutlineHelper;
@@ -211,6 +219,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mDefaultWidgetBackground = resources.getDrawable(R.drawable.default_widget_preview_holo);
mAppIconSize = resources.getDimensionPixelSize(R.dimen.app_icon_size);
mDragViewMultiplyColor = resources.getColor(R.color.drag_view_multiply_color);
+ mDensity = resources.getDisplayMetrics().density;
TypedArray a = context.obtainStyledAttributes(attrs, R.styleable.PagedView, 0, 0);
// TODO-APPS_CUSTOMIZE: remove these unnecessary attrs after
@@ -265,7 +274,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
int currentPage = getCurrentPage();
switch (mContentType) {
case Applications: {
- PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(currentPage);
+ PagedViewCellLayout layout = (PagedViewCellLayout) getPageAt(currentPage);
PagedViewCellLayoutChildren childrenLayout = layout.getChildrenLayout();
int numItemsPerPage = mCellCountX * mCellCountY;
int childCount = childrenLayout.getChildCount();
@@ -274,7 +283,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}}
break;
case Widgets: {
- PagedViewGridLayout layout = (PagedViewGridLayout) getChildAt(currentPage);
+ PagedViewGridLayout layout = (PagedViewGridLayout) getPageAt(currentPage);
int numItemsPerPage = mWidgetCountX * mWidgetCountY;
int childCount = layout.getChildCount();
if (childCount > 0) {
@@ -526,8 +535,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
if (!super.beginDragging(v)) return false;
// Go into spring loaded mode (must happen before we startDrag())
- int currentPageIndex = mLauncher.getWorkspace().getCurrentPage();
- CellLayout currentPage = (CellLayout) mLauncher.getWorkspace().getChildAt(currentPageIndex);
mLauncher.enterSpringLoadedDragMode();
if (v instanceof PagedViewIcon) {
@@ -626,11 +633,10 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
public void syncAppsPageItems(int page, boolean immediate) {
// ensure that we have the right number of items on the pages
- int numPages = getPageCount();
int numCells = mCellCountX * mCellCountY;
int startIndex = page * numCells;
int endIndex = Math.min(startIndex + numCells, mApps.size());
- PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(page);
+ PagedViewCellLayout layout = (PagedViewCellLayout) getPageAt(page);
layout.removeAllViewsOnPage();
ArrayList<Object> items = new ArrayList<Object>();
@@ -653,8 +659,6 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
images.add(info.iconBitmap);
}
- // Create the hardware layers
- layout.allowHardwareLayerCreation();
layout.createHardwareLayers();
if (mFadeInAdjacentScreens) {
@@ -959,6 +963,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
} else {
prepareLoadWidgetPreviewsTask(page, items, cellWidth, cellHeight, mWidgetCountX);
}
+ PagedViewGridLayout layout = (PagedViewGridLayout) getPageAt(page);
+ layout.createHardwareLayer();
}
private void loadWidgetPreviewsInBackground(AppsCustomizeAsyncTask task,
AsyncTaskPageData data) {
@@ -997,7 +1003,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
private void onSyncWidgetPageItems(AsyncTaskPageData data) {
int page = data.page;
- PagedViewGridLayout layout = (PagedViewGridLayout) getChildAt(page);
+ PagedViewGridLayout layout = (PagedViewGridLayout) getPageAt(page);
// Only set the column count once we have items
layout.setColumnCount(layout.getCellCountX());
@@ -1062,7 +1068,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
invalidate();
int page = data.page;
- ViewGroup layout = (ViewGroup) getChildAt(page);
+ ViewGroup layout = (ViewGroup) getPageAt(page);
if (layout instanceof PagedViewCellLayout) {
PagedViewCellLayout cl = (PagedViewCellLayout) layout;
int count = cl.getPageChildCount();
@@ -1114,6 +1120,92 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
}
+ // We want our pages to be z-ordered such that the further a page is to the left, the higher
+ // it is in the z-order. This is important to insure touch events are handled correctly.
+ View getPageAt(int index) {
+ return getChildAt(getChildCount() - index - 1);
+ }
+
+ // In apps customize, we have a scrolling effect which emulates pulling cards off of a stack.
+ @Override
+ protected void screenScrolled(int screenCenter) {
+ super.screenScrolled(screenCenter);
+ final int halfScreenSize = getMeasuredWidth() / 2;
+
+ for (int i = 0; i < getChildCount(); i++) {
+ View v = getPageAt(i);
+ if (v != null) {
+ int totalDistance = getScaledMeasuredWidth(v) + mPageSpacing;
+ int delta = screenCenter - (getChildOffset(i) -
+ getRelativeChildOffset(i) + halfScreenSize);
+
+ float scrollProgress = delta / (totalDistance * 1.0f);
+ scrollProgress = Math.min(scrollProgress, 1.0f);
+ scrollProgress = Math.max(scrollProgress, -1.0f);
+
+ float interpolatedProgress =
+ mZInterpolator.getInterpolation(Math.abs(Math.min(scrollProgress, 0)));
+ float scale = (1 - interpolatedProgress) +
+ interpolatedProgress * TRANSITION_SCALE_FACTOR;
+ float translationX = Math.min(0, scrollProgress) * v.getMeasuredWidth();
+ float alpha = scrollProgress < 0 ? 1 - Math.abs(scrollProgress) : 1.0f;
+
+ v.setCameraDistance(mDensity * CAMERA_DISTANCE);
+ int pageWidth = v.getMeasuredWidth();
+ int pageHeight = v.getMeasuredHeight();
+ if (i == 0 && scrollProgress < 0) {
+ // Overscroll to the left
+ v.setPivotX(TRANSITION_PIVOT * pageWidth);
+ v.setRotationY(-TRANSITION_MAX_ROTATION * scrollProgress);
+ scale = 1.0f;
+ alpha = 1.0f;
+ // On the first page, we don't want the page to have any lateral motion
+ translationX = getScrollX();
+ } else if (i == getChildCount() - 1 && scrollProgress > 0) {
+ // Overscroll to the right
+ v.setPivotX((1 - TRANSITION_PIVOT) * pageWidth);
+ v.setRotationY(-TRANSITION_MAX_ROTATION * scrollProgress);
+ scale = 1.0f;
+ alpha = 1.0f;
+ // On the last page, we don't want the page to have any lateral motion.
+ translationX = getScrollX() - mMaxScrollX;
+ } else {
+ v.setPivotY(pageHeight / 2.0f);
+ v.setPivotX(pageWidth / 2.0f);
+ v.setRotationY(0f);
+ }
+
+ v.setTranslationX(translationX);
+ v.setScaleX(scale);
+ v.setScaleY(scale);
+ v.setAlpha(alpha);
+ }
+ }
+ }
+
+ protected void overScroll(float amount) {
+ int screenSize = getMeasuredWidth();
+
+ // We want to reach the max overscroll effect when the user has
+ // overscrolled half the size of the screen
+ float f = 2 * (amount / screenSize);
+
+ if (f == 0) return;
+
+ // Clamp this factor, f, to -1 < f < 1
+ if (Math.abs(f) >= 1) {
+ f /= Math.abs(f);
+ }
+
+ int overScrollAmount = (int) Math.round(f * screenSize);
+ if (amount < 0) {
+ mScrollX = overScrollAmount;
+ } else {
+ mScrollX = mMaxScrollX + overScrollAmount;
+ }
+ invalidate();
+ }
+
/**
* Used by the parent to get the content width to set the tab bar to
* @return
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 76fa937..807470c 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -441,7 +441,7 @@ public abstract class PagedView extends ViewGroup {
final int childCount = getChildCount();
for (int i = 0; i < childCount; i++) {
// disallowing padding in paged view (just pass 0)
- final View child = getChildAt(i);
+ final View child = getPageAt(i);
final LayoutParams lp = (LayoutParams) child.getLayoutParams();
int childWidthMode;
@@ -489,7 +489,7 @@ public abstract class PagedView extends ViewGroup {
final int pageCount = getChildCount();
for (int i = 0; i < pageCount; i++) {
- View page = (View) getChildAt(i);
+ View page = (View) getPageAt(i);
page.setX(page.getX() + delta);
}
setCurrentPage(newCurrentPage);
@@ -506,7 +506,7 @@ public abstract class PagedView extends ViewGroup {
float childrenX[] = new float[childCount];
float childrenY[] = new float[childCount];
for (int i = 0; i < childCount; i++) {
- final View child = getChildAt(i);
+ final View child = getPageAt(i);
childrenX[i] = child.getX();
childrenY[i] = child.getY();
}
@@ -517,7 +517,7 @@ public abstract class PagedView extends ViewGroup {
measure(widthSpec, heightSpec);
layout(mLeft, mTop, mRight, mBottom);
for (int i = 0; i < childCount; i++) {
- final View child = getChildAt(i);
+ final View child = getPageAt(i);
child.setX(childrenX[i]);
child.setY(childrenY[i]);
}
@@ -553,7 +553,7 @@ public abstract class PagedView extends ViewGroup {
}
for (int i = 0; i < childCount; i++) {
- final View child = getChildAt(i);
+ final View child = getPageAt(i);
if (child.getVisibility() != View.GONE) {
final int childWidth = getScaledMeasuredWidth(child);
final int childHeight = child.getMeasuredHeight();
@@ -586,7 +586,7 @@ public abstract class PagedView extends ViewGroup {
int screenCenter = mScrollX + halfScreenSize + mPaddingLeft;
final int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
- View layout = (View) getChildAt(i);
+ View layout = (View) getPageAt(i);
int childWidth = getScaledMeasuredWidth(layout);
int halfChildWidth = (childWidth / 2);
int childCenter = getChildOffset(i) + halfChildWidth;
@@ -603,13 +603,13 @@ public abstract class PagedView extends ViewGroup {
int distanceFromScreenCenter = childCenter - screenCenter;
if (distanceFromScreenCenter > 0) {
if (i > 0) {
- d += getScaledMeasuredWidth(getChildAt(i - 1)) / 2;
+ d += getScaledMeasuredWidth(getPageAt(i - 1)) / 2;
} else {
continue;
}
} else {
if (i < childCount - 1) {
- d += getScaledMeasuredWidth(getChildAt(i + 1)) / 2;
+ d += getScaledMeasuredWidth(getPageAt(i + 1)) / 2;
} else {
continue;
}
@@ -663,21 +663,19 @@ public abstract class PagedView extends ViewGroup {
// page.
final int pageCount = getChildCount();
if (pageCount > 0) {
- final int pageWidth = getScaledMeasuredWidth(getChildAt(0));
+ final int pageWidth = getScaledMeasuredWidth(getPageAt(0));
final int screenWidth = getMeasuredWidth();
int x = getScaledRelativeChildOffset(0) + pageWidth;
int leftScreen = 0;
int rightScreen = 0;
- while (x <= mScrollX) {
+ while (x <= mScrollX && leftScreen < pageCount - 1) {
leftScreen++;
- x += getScaledMeasuredWidth(getChildAt(leftScreen)) + mPageSpacing;
+ x += getScaledMeasuredWidth(getPageAt(leftScreen)) + mPageSpacing;
}
rightScreen = leftScreen;
- while (x < mScrollX + screenWidth && rightScreen < pageCount) {
+ while (x < mScrollX + screenWidth && rightScreen < pageCount - 1) {
rightScreen++;
- if (rightScreen < pageCount) {
- x += getScaledMeasuredWidth(getChildAt(rightScreen)) + mPageSpacing;
- }
+ x += getScaledMeasuredWidth(getPageAt(rightScreen)) + mPageSpacing;
}
rightScreen = Math.min(getChildCount() - 1, rightScreen);
@@ -687,8 +685,8 @@ public abstract class PagedView extends ViewGroup {
canvas.clipRect(mScrollX, mScrollY, mScrollX + mRight - mLeft,
mScrollY + mBottom - mTop);
- for (int i = leftScreen; i <= rightScreen; i++) {
- drawChild(canvas, getChildAt(i), drawingTime);
+ for (int i = rightScreen; i >= leftScreen; i--) {
+ drawChild(canvas, getPageAt(i), drawingTime);
}
canvas.restore();
}
@@ -787,7 +785,7 @@ public abstract class PagedView extends ViewGroup {
if (disallowIntercept) {
// We need to make sure to cancel our long press if
// a scrollable widget takes over touch events
- final View currentPage = getChildAt(mCurrentPage);
+ final View currentPage = getPageAt(mCurrentPage);
currentPage.cancelLongPress();
}
super.requestDisallowInterceptTouchEvent(disallowIntercept);
@@ -1092,7 +1090,7 @@ public abstract class PagedView extends ViewGroup {
// in the opposite direction, we use a threshold to determine whether we should
// just return to the starting page, or if we should skip one further.
boolean returnToOriginalPage = false;
- final int pageWidth = getScaledMeasuredWidth(getChildAt(mCurrentPage));
+ final int pageWidth = getScaledMeasuredWidth(getPageAt(mCurrentPage));
if (Math.abs(deltaX) > pageWidth * RETURN_TO_ORIGINAL_PAGE_THRESHOLD &&
Math.signum(velocityX) != Math.signum(deltaX)) {
returnToOriginalPage = true;
@@ -1241,7 +1239,7 @@ public abstract class PagedView extends ViewGroup {
int right;
for (int i = 0; i < childCount; ++i) {
left = getRelativeChildOffset(i);
- right = (left + getScaledMeasuredWidth(getChildAt(i)));
+ right = (left + getScaledMeasuredWidth(getPageAt(i)));
if (left <= relativeOffset && relativeOffset <= right) {
return i;
}
@@ -1259,7 +1257,7 @@ public abstract class PagedView extends ViewGroup {
protected int getChildWidth(int index) {
// This functions are called enough times that it actually makes a difference in the
// profiler -- so just inline the max() here
- final int measuredWidth = getChildAt(index).getMeasuredWidth();
+ final int measuredWidth = getPageAt(index).getMeasuredWidth();
final int minWidth = mMinimumWidth;
return (minWidth > measuredWidth) ? minWidth : measuredWidth;
}
@@ -1271,7 +1269,7 @@ public abstract class PagedView extends ViewGroup {
protected int getScaledRelativeChildOffset(int index) {
int padding = mPaddingLeft + mPaddingRight;
return mPaddingLeft + (getMeasuredWidth() - padding -
- getScaledMeasuredWidth(getChildAt(index))) / 2;
+ getScaledMeasuredWidth(getPageAt(index))) / 2;
}
protected int getChildOffset(int index) {
@@ -1280,7 +1278,7 @@ public abstract class PagedView extends ViewGroup {
int offset = getRelativeChildOffset(0);
for (int i = 0; i < index; ++i) {
- offset += getScaledMeasuredWidth(getChildAt(i)) + mPageSpacing;
+ offset += getScaledMeasuredWidth(getPageAt(i)) + mPageSpacing;
}
return offset;
}
@@ -1295,12 +1293,12 @@ public abstract class PagedView extends ViewGroup {
}
int getPageNearestToCenterOfScreen() {
- int minDistanceFromScreenCenter = getMeasuredWidth();
+ int minDistanceFromScreenCenter = Integer.MAX_VALUE;
int minDistanceFromScreenCenterIndex = -1;
int screenCenter = mScrollX + (getMeasuredWidth() / 2);
final int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
- View layout = (View) getChildAt(i);
+ View layout = (View) getPageAt(i);
int childWidth = getScaledMeasuredWidth(layout);
int halfChildWidth = (childWidth / 2);
int childCenter = getChildOffset(i) + halfChildWidth;
@@ -1395,7 +1393,7 @@ public abstract class PagedView extends ViewGroup {
View focusedChild = getFocusedChild();
if (focusedChild != null && whichPage != mCurrentPage &&
- focusedChild == getChildAt(mCurrentPage)) {
+ focusedChild == getPageAt(mCurrentPage)) {
focusedChild.clearFocus();
}
@@ -1441,7 +1439,7 @@ public abstract class PagedView extends ViewGroup {
ViewParent vp = v.getParent();
int count = getChildCount();
for (int i = 0; i < count; i++) {
- if (vp == getChildAt(i)) {
+ if (vp == getPageAt(i)) {
return i;
}
}
@@ -1509,7 +1507,7 @@ public abstract class PagedView extends ViewGroup {
if ((i != page) && immediateAndOnly) {
continue;
}
- Page layout = (Page) getChildAt(i);
+ Page layout = (Page) getPageAt(i);
final int childCount = layout.getPageChildCount();
if (lowerPageBound <= i && i <= upperPageBound) {
if (mDirtyPageContent.get(i)) {
@@ -1559,7 +1557,7 @@ public abstract class PagedView extends ViewGroup {
ArrayList<Checkable> checked = new ArrayList<Checkable>();
final int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
- Page layout = (Page) getChildAt(i);
+ Page layout = (Page) getPageAt(i);
final int grandChildCount = layout.getPageChildCount();
for (int j = 0; j < grandChildCount; ++j) {
final View v = layout.getChildOnPageAt(j);
@@ -1579,7 +1577,7 @@ public abstract class PagedView extends ViewGroup {
if (mChoiceMode != CHOICE_MODE_MULTIPLE) {
final int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
- Page layout = (Page) getChildAt(i);
+ Page layout = (Page) getPageAt(i);
final int grandChildCount = layout.getPageChildCount();
for (int j = 0; j < grandChildCount; ++j) {
final View v = layout.getChildOnPageAt(j);
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 803e700..29dc352 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -47,9 +47,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
private int mHeightGap;
private int mMaxGap;
protected PagedViewCellLayoutChildren mChildren;
- private PagedViewCellLayoutChildren mHolographicChildren;
- private boolean mAllowHardwareLayerCreation = false;
- private boolean mCreateHardwareLayersIfAllowed = false;
public PagedViewCellLayout(Context context) {
this(context, null);
@@ -80,12 +77,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
mChildren.setGap(mWidthGap, mHeightGap);
addView(mChildren);
- mHolographicChildren = new PagedViewCellLayoutChildren(context);
- mHolographicChildren.setAlpha(0f);
- mHolographicChildren.setCellDimensions(mCellWidth, mCellHeight);
- mHolographicChildren.setGap(mWidthGap, mHeightGap);
-
- addView(mHolographicChildren);
}
public int getCellWidth() {
@@ -96,41 +87,20 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
return mCellHeight;
}
- public void allowHardwareLayerCreation() {
- // This is called after the first time we launch into All Apps. Before that point,
- // there's no need for hardware layers here since there's a hardware layer set on the
- // parent, AllAppsTabbed, during the AllApps transition -- creating hardware layers here
- // before the animation is done slows down the animation
- if (!mAllowHardwareLayerCreation) {
- mAllowHardwareLayerCreation = true;
- if (mCreateHardwareLayersIfAllowed) {
- createHardwareLayers();
- }
- }
- }
-
@Override
public void setAlpha(float alpha) {
- mChildren.setAlpha(HolographicOutlineHelper.viewAlphaInterpolator(alpha));
- mHolographicChildren.setAlpha(HolographicOutlineHelper.highlightAlphaInterpolator(alpha));
+ mChildren.setAlpha(alpha);
}
void destroyHardwareLayers() {
// called when a page is no longer visible (triggered by loadAssociatedPages ->
// removeAllViewsOnPage)
- mCreateHardwareLayersIfAllowed = false;
- if (mAllowHardwareLayerCreation) {
- mChildren.destroyHardwareLayer();
- mHolographicChildren.destroyHardwareLayer();
- }
+ mChildren.destroyHardwareLayer();
}
+
void createHardwareLayers() {
// called when a page is visible (triggered by loadAssociatedPages -> syncPageItems)
- mCreateHardwareLayersIfAllowed = true;
- if (mAllowHardwareLayerCreation) {
- mChildren.createHardwareLayer();
- mHolographicChildren.createHardwareLayer();
- }
+ mChildren.createHardwareLayer();
}
@Override
@@ -163,11 +133,7 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
if (child instanceof PagedViewIcon) {
PagedViewIcon pagedViewIcon = (PagedViewIcon) child;
- if (mAllowHardwareLayerCreation) {
- pagedViewIcon.disableCache();
- }
- mHolographicChildren.addView(pagedViewIcon.getHolographicOutlineView(),
- index, lp);
+ pagedViewIcon.disableCache();
}
return true;
}
@@ -177,14 +143,12 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
@Override
public void removeAllViewsOnPage() {
mChildren.removeAllViews();
- mHolographicChildren.removeAllViews();
destroyHardwareLayers();
}
@Override
public void removeViewOnPageAt(int index) {
mChildren.removeViewAt(index);
- mHolographicChildren.removeViewAt(index);
}
@Override
@@ -237,7 +201,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
mHeightGap = Math.min(mMaxGap,numHeightGaps > 0 ? (vFreeSpace / numHeightGaps) : 0);
mChildren.setGap(mWidthGap, mHeightGap);
- mHolographicChildren.setGap(mWidthGap, mHeightGap);
} else {
mWidthGap = mOriginalWidthGap;
mHeightGap = mOriginalHeightGap;
@@ -317,13 +280,11 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
public void enableCenteredContent(boolean enabled) {
mChildren.enableCenteredContent(enabled);
- mHolographicChildren.enableCenteredContent(enabled);
}
@Override
protected void setChildrenDrawingCacheEnabled(boolean enabled) {
mChildren.setChildrenDrawingCacheEnabled(enabled);
- mHolographicChildren.setChildrenDrawingCacheEnabled(enabled);
}
public void setCellCount(int xCount, int yCount) {
@@ -336,7 +297,6 @@ public class PagedViewCellLayout extends ViewGroup implements Page {
mWidthGap = widthGap;
mHeightGap = heightGap;
mChildren.setGap(widthGap, heightGap);
- mHolographicChildren.setGap(widthGap, heightGap);
}
public int[] getCellCountForDimensions(int width, int height) {
diff --git a/src/com/android/launcher2/PagedViewCellLayoutChildren.java b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
index 0907c60..eaef682 100644
--- a/src/com/android/launcher2/PagedViewCellLayoutChildren.java
+++ b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
@@ -142,14 +142,10 @@ public class PagedViewCellLayoutChildren extends ViewGroup {
}
void destroyHardwareLayer() {
- if (getLayerType() != LAYER_TYPE_NONE) {
- setLayerType(LAYER_TYPE_NONE, null);
- }
+ setLayerType(LAYER_TYPE_NONE, null);
}
void createHardwareLayer() {
- if (getLayerType() != LAYER_TYPE_HARDWARE) {
- setLayerType(LAYER_TYPE_HARDWARE, null);
- }
+ setLayerType(LAYER_TYPE_HARDWARE, null);
}
public void enableCenteredContent(boolean enabled) {
diff --git a/src/com/android/launcher2/PagedViewGridLayout.java b/src/com/android/launcher2/PagedViewGridLayout.java
index 4131d8b..93626f0 100644
--- a/src/com/android/launcher2/PagedViewGridLayout.java
+++ b/src/com/android/launcher2/PagedViewGridLayout.java
@@ -40,6 +40,7 @@ public class PagedViewGridLayout extends GridLayout implements Page {
int getCellCountX() {
return mCellCountX;
}
+
int getCellCountY() {
return mCellCountY;
}
@@ -69,27 +70,18 @@ public class PagedViewGridLayout extends GridLayout implements Page {
return result;
}
- @Override
- protected boolean onSetAlpha(int alpha) {
- return true;
- }
-
- @Override
- public void setAlpha(float alpha) {
- setChildrenAlpha(alpha);
- super.setAlpha(alpha);
+ void destroyHardwareLayer() {
+ setLayerType(LAYER_TYPE_NONE, null);
}
- private void setChildrenAlpha(float alpha) {
- final int childCount = getChildCount();
- for (int i = 0; i < childCount; i++) {
- getChildAt(i).setAlpha(alpha);
- }
+ void createHardwareLayer() {
+ setLayerType(LAYER_TYPE_HARDWARE, null);
}
@Override
public void removeAllViewsOnPage() {
removeAllViews();
+ destroyHardwareLayer();
}
@Override