From 8245a8685fc9f4802c9fa29a989854b2522fc588 Mon Sep 17 00:00:00 2001 From: Michael Jurka Date: Tue, 1 Feb 2011 17:53:59 -0800 Subject: Adding hardware layers to All Apps - splitting up the "holo" outlines and the icons into separate views - enabling hardware layers on each of the views --- src/com/android/launcher2/AllAppsPagedView.java | 16 +- src/com/android/launcher2/CustomizePagedView.java | 4 +- .../launcher2/HolographicPagedViewIcon.java | 56 +++++++ src/com/android/launcher2/PagedView.java | 18 +-- src/com/android/launcher2/PagedViewCellLayout.java | 145 ++++++++---------- .../launcher2/PagedViewCellLayoutChildren.java | 164 +++++++++++++++++++++ .../android/launcher2/PagedViewExtendedLayout.java | 28 +++- src/com/android/launcher2/PagedViewIcon.java | 13 +- 8 files changed, 343 insertions(+), 101 deletions(-) create mode 100644 src/com/android/launcher2/HolographicPagedViewIcon.java create mode 100644 src/com/android/launcher2/PagedViewCellLayoutChildren.java diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java index 59065996e..a0f1f6e57 100644 --- a/src/com/android/launcher2/AllAppsPagedView.java +++ b/src/com/android/launcher2/AllAppsPagedView.java @@ -154,8 +154,8 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All private int getChildIndexForGrandChild(View v) { final int childCount = getChildCount(); for (int i = 0; i < childCount; ++i) { - final PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(i); - if (layout.indexOfChild(v) > -1) { + final Page layout = (Page) getChildAt(i); + if (layout.indexOfChildOnPage(v) > -1) { return i; } } @@ -445,13 +445,13 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(page); if (!mFilteredApps.isEmpty()) { - int curNumPageItems = layout.getChildCount(); + int curNumPageItems = layout.getPageChildCount(); int numPageItems = endIndex - startIndex; // If we were previously an empty page, then restart anew boolean wasEmptyPage = false; if (curNumPageItems == 1) { - View icon = layout.getChildAt(0); + View icon = layout.getChildOnPageAt(0); if (icon.getTag() == null) { wasEmptyPage = true; } @@ -460,12 +460,12 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All if (wasEmptyPage) { // Remove all the previous items curNumPageItems = 0; - layout.removeAllViews(); + layout.removeAllViewsOnPage(); } else { // Remove any extra items int extraPageItemsDiff = curNumPageItems - numPageItems; for (int i = 0; i < extraPageItemsDiff; ++i) { - layout.removeViewAt(numPageItems); + layout.removeViewOnPageAt(numPageItems); } } @@ -486,7 +486,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All for (int i = startIndex; i < endIndex; ++i) { final int index = i - startIndex; final ApplicationInfo info = mFilteredApps.get(i); - PagedViewIcon icon = (PagedViewIcon) layout.getChildAt(index); + PagedViewIcon icon = (PagedViewIcon) layout.getChildOnPageAt(index); icon.applyFromApplicationInfo(info, mPageViewIconCache, true, (numPages > 1)); PagedViewCellLayout.LayoutParams params = @@ -510,7 +510,7 @@ public class AllAppsPagedView extends PagedViewWithDraggableItems implements All // Center-align the message layout.enableCenteredContent(true); - layout.removeAllViews(); + layout.removeAllViewsOnPage(); layout.addViewToCellLayout(icon, -1, 0, new PagedViewCellLayout.LayoutParams(0, 0, 4, 1)); } diff --git a/src/com/android/launcher2/CustomizePagedView.java b/src/com/android/launcher2/CustomizePagedView.java index e934efa9c..d08bf5459 100644 --- a/src/com/android/launcher2/CustomizePagedView.java +++ b/src/com/android/launcher2/CustomizePagedView.java @@ -930,7 +930,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems final int endIndex = Math.min(startIndex + numCells, list.size()); final PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(page); // TODO: we can optimize by just re-applying to existing views - layout.removeAllViews(); + layout.removeAllViewsOnPage(); for (int i = startIndex; i < endIndex; ++i) { ResolveInfo info = list.get(i); PendingAddItemInfo createItemInfo = new PendingAddItemInfo(); @@ -990,7 +990,7 @@ public class CustomizePagedView extends PagedViewWithDraggableItems final int endIndex = Math.min(startIndex + numCells, mApps.size()); final PagedViewCellLayout layout = (PagedViewCellLayout) getChildAt(page); // TODO: we can optimize by just re-applying to existing views - layout.removeAllViews(); + layout.removeAllViewsOnPage(); for (int i = startIndex; i < endIndex; ++i) { final ApplicationInfo info = mApps.get(i); PagedViewIcon icon = (PagedViewIcon) mInflater.inflate( diff --git a/src/com/android/launcher2/HolographicPagedViewIcon.java b/src/com/android/launcher2/HolographicPagedViewIcon.java new file mode 100644 index 000000000..5e1816991 --- /dev/null +++ b/src/com/android/launcher2/HolographicPagedViewIcon.java @@ -0,0 +1,56 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher2; + +import android.content.Context; +import android.graphics.Bitmap; +import android.graphics.Canvas; +import android.graphics.Paint; +import android.widget.TextView; + + + +/** + * An icon on a PagedView, specifically for items in the launcher's paged view (with compound + * drawables on the top). + */ +public class HolographicPagedViewIcon extends TextView { + PagedViewIcon mOriginalIcon; + Paint mPaint; + + public HolographicPagedViewIcon(Context context, PagedViewIcon original) { + super(context); + mOriginalIcon = original; + mPaint = new Paint(); + } + + @Override + protected void onDraw(Canvas canvas) { + Bitmap overlay = mOriginalIcon.getHolographicOutline(); + + if (overlay != null) { + final int offset = getScrollX(); + final int compoundPaddingLeft = getCompoundPaddingLeft(); + final int compoundPaddingRight = getCompoundPaddingRight(); + int hspace = getWidth() - compoundPaddingRight - compoundPaddingLeft; + canvas.drawBitmap(overlay, + offset + compoundPaddingLeft + (hspace - overlay.getWidth()) / 2, + mPaddingTop, + mPaint); + } + } +} diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 6138b868f..490417aca 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -1308,8 +1308,8 @@ public abstract class PagedView extends ViewGroup { int lowerPageBound = getAssociatedLowerPageBound(page); int upperPageBound = getAssociatedUpperPageBound(page); for (int i = 0; i < count; ++i) { - final ViewGroup layout = (ViewGroup) getChildAt(i); - final int childCount = layout.getChildCount(); + Page layout = (Page) getChildAt(i); + final int childCount = layout.getPageChildCount(); if (lowerPageBound <= i && i <= upperPageBound) { if (mDirtyPageContent.get(i)) { syncPageItems(i); @@ -1317,7 +1317,7 @@ public abstract class PagedView extends ViewGroup { } } else { if (childCount > 0) { - layout.removeAllViews(); + layout.removeAllViewsOnPage(); } mDirtyPageContent.set(i, true); } @@ -1358,10 +1358,10 @@ public abstract class PagedView extends ViewGroup { ArrayList checked = new ArrayList(); final int childCount = getChildCount(); for (int i = 0; i < childCount; ++i) { - final ViewGroup layout = (ViewGroup) getChildAt(i); - final int grandChildCount = layout.getChildCount(); + Page layout = (Page) getChildAt(i); + final int grandChildCount = layout.getPageChildCount(); for (int j = 0; j < grandChildCount; ++j) { - final View v = layout.getChildAt(j); + final View v = layout.getChildOnPageAt(j); if (v instanceof Checkable && ((Checkable) v).isChecked()) { checked.add((Checkable) v); } @@ -1378,10 +1378,10 @@ public abstract class PagedView extends ViewGroup { if (mChoiceMode == CHOICE_MODE_SINGLE) { final int childCount = getChildCount(); for (int i = 0; i < childCount; ++i) { - final ViewGroup layout = (ViewGroup) getChildAt(i); - final int grandChildCount = layout.getChildCount(); + Page layout = (Page) getChildAt(i); + final int grandChildCount = layout.getPageChildCount(); for (int j = 0; j < grandChildCount; ++j) { - final View v = layout.getChildAt(j); + final View v = layout.getChildOnPageAt(j); if (v instanceof Checkable && ((Checkable) v).isChecked()) { return (Checkable) v; } diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java index 70ad997b6..6d1fb55dc 100644 --- a/src/com/android/launcher2/PagedViewCellLayout.java +++ b/src/com/android/launcher2/PagedViewCellLayout.java @@ -17,7 +17,6 @@ package com.android.launcher2; import android.content.Context; -import android.graphics.Rect; import android.util.AttributeSet; import android.view.MotionEvent; import android.view.View; @@ -29,13 +28,9 @@ import android.view.ViewGroup; * which span multiple cells into a grid-like layout. Also supports dimming * to give a preview of its contents. */ -public class PagedViewCellLayout extends ViewGroup { +public class PagedViewCellLayout extends ViewGroup implements Page { static final String TAG = "PagedViewCellLayout"; - private float mHolographicAlpha; - - private boolean mCenterContent; - private int mCellCountX; private int mCellCountY; private int mCellWidth; @@ -43,6 +38,8 @@ public class PagedViewCellLayout extends ViewGroup { private int mWidthGap; private int mHeightGap; private static int sDefaultCellDimensions = 96; + protected PagedViewCellLayoutChildren mChildren; + private PagedViewCellLayoutChildren mHolographicChildren; public PagedViewCellLayout(Context context) { this(context, null); @@ -61,20 +58,25 @@ public class PagedViewCellLayout extends ViewGroup { mCellWidth = mCellHeight = sDefaultCellDimensions; mCellCountX = LauncherModel.getCellCountX(); mCellCountY = LauncherModel.getCellCountY(); - mHolographicAlpha = 0.0f; mWidthGap = mHeightGap = -1; - } - @Override - protected boolean onSetAlpha(int alpha) { - return true; + mChildren = new PagedViewCellLayoutChildren(context); + mChildren.setCellDimensions(mCellWidth, mCellHeight); + mChildren.setGap(mWidthGap, mHeightGap); + + addView(mChildren); + mHolographicChildren = new PagedViewCellLayoutChildren(context); + mHolographicChildren.setAlpha(0f); + mHolographicChildren.setCellDimensions(mCellWidth, mCellHeight); + mHolographicChildren.setGap(mWidthGap, mHeightGap); + + addView(mHolographicChildren); } @Override public void setAlpha(float alpha) { - mHolographicAlpha = 1.0f - alpha; - setChildrenAlpha(alpha); - super.setAlpha(alpha); + mChildren.setAlpha(alpha); + mHolographicChildren.setAlpha(1.0f - alpha); } @Override @@ -103,28 +105,44 @@ public class PagedViewCellLayout extends ViewGroup { if (lp.cellVSpan < 0) lp.cellVSpan = mCellCountY; child.setId(childId); + mChildren.addView(child, index, lp); - // We might be in the middle or end of shrinking/fading to a dimmed view - // Make sure this view's alpha is set the same as all the rest of the views - child.setAlpha(1.0f - mHolographicAlpha); - - addView(child, index, lp); + if (child instanceof PagedViewIcon) { + PagedViewIcon pagedViewIcon = (PagedViewIcon) child; + mHolographicChildren.addView(pagedViewIcon.getHolographicOutlineView(), index, lp); + } return true; } return false; } @Override - public void requestChildFocus(View child, View focused) { - super.requestChildFocus(child, focused); - if (child != null) { - Rect r = new Rect(); - child.getDrawingRect(r); - requestRectangleOnScreen(r); - } + public void removeAllViewsOnPage() { + mChildren.removeAllViews(); + mHolographicChildren.removeAllViews(); } @Override + public void removeViewOnPageAt(int index) { + mChildren.removeViewAt(index); + mHolographicChildren.removeViewAt(index); + } + + @Override + public int getPageChildCount() { + return mChildren.getChildCount(); + } + + @Override + public View getChildOnPageAt(int i) { + return mChildren.getChildAt(i); + } + + @Override + public int indexOfChildOnPage(View v) { + return mChildren.indexOfChild(v); + } + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { // TODO: currently ignoring padding @@ -154,8 +172,6 @@ public class PagedViewCellLayout extends ViewGroup { // center it around the min gaps int minGap = Math.min(widthGap, heightGap); - int paddingLeft = mPaddingLeft; - int paddingTop = mPaddingTop; /* if (minGap < heightGap) { // vertical space has shrunken, so change padding accordingly @@ -180,16 +196,10 @@ public class PagedViewCellLayout extends ViewGroup { final int count = getChildCount(); for (int i = 0; i < count; i++) { View child = getChildAt(i); - PagedViewCellLayout.LayoutParams lp = - (PagedViewCellLayout.LayoutParams) child.getLayoutParams(); - lp.setup(cellWidth, cellHeight, widthGap, heightGap, - paddingLeft, paddingTop); - - int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(lp.width, - MeasureSpec.EXACTLY); - int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(lp.height, - MeasureSpec.EXACTLY); - + int childWidthMeasureSpec = + MeasureSpec.makeMeasureSpec(newWidth, MeasureSpec.EXACTLY); + int childheightMeasureSpec = + MeasureSpec.makeMeasureSpec(newHeight, MeasureSpec.EXACTLY); child.measure(childWidthMeasureSpec, childheightMeasureSpec); } @@ -199,32 +209,9 @@ public class PagedViewCellLayout extends ViewGroup { @Override protected void onLayout(boolean changed, int l, int t, int r, int b) { int count = getChildCount(); - - int offsetX = 0; - if (mCenterContent) { - // determine the max width of all the rows and center accordingly - int maxRowWidth = 0; - for (int i = 0; i < count; i++) { - View child = getChildAt(i); - if (child.getVisibility() != GONE) { - PagedViewCellLayout.LayoutParams lp = - (PagedViewCellLayout.LayoutParams) child.getLayoutParams(); - maxRowWidth = Math.max(maxRowWidth, lp.x + lp.width); - } - } - offsetX = (getMeasuredWidth() / 2) - (maxRowWidth / 2); - } - for (int i = 0; i < count; i++) { View child = getChildAt(i); - if (child.getVisibility() != GONE) { - PagedViewCellLayout.LayoutParams lp = - (PagedViewCellLayout.LayoutParams) child.getLayoutParams(); - - int childLeft = offsetX + lp.x; - int childTop = lp.y; - child.layout(childLeft, childTop, childLeft + lp.width, childTop + lp.height); - } + child.layout(0, 0, r - l, b - t); } } @@ -234,20 +221,14 @@ public class PagedViewCellLayout extends ViewGroup { } public void enableCenteredContent(boolean enabled) { - mCenterContent = enabled; + mChildren.enableCenteredContent(enabled); + mHolographicChildren.enableCenteredContent(enabled); } @Override protected void setChildrenDrawingCacheEnabled(boolean enabled) { - final int count = getChildCount(); - for (int i = 0; i < count; i++) { - final View view = getChildAt(i); - view.setDrawingCacheEnabled(enabled); - // Update the drawing caches - if (!view.isHardwareAccelerated()) { - view.buildDrawingCache(true); - } - } + mChildren.setChildrenDrawingCacheEnabled(enabled); + mHolographicChildren.setChildrenDrawingCacheEnabled(enabled); } public void setCellCount(int xCount, int yCount) { @@ -259,25 +240,21 @@ public class PagedViewCellLayout extends ViewGroup { public void setGap(int widthGap, int heightGap) { mWidthGap = widthGap; mHeightGap = heightGap; + mChildren.setGap(widthGap, heightGap); + mHolographicChildren.setGap(widthGap, heightGap); } public void setCellDimensions(int width, int height) { mCellWidth = width; mCellHeight = height; - requestLayout(); + mChildren.setCellDimensions(width, height); + mHolographicChildren.setCellDimensions(width, height); } public int getDefaultCellDimensions() { return sDefaultCellDimensions; } - private void setChildrenAlpha(float alpha) { - final int childCount = getChildCount(); - for (int i = 0; i < childCount; i++) { - getChildAt(i).setAlpha(alpha); - } - } - public int[] getCellCountForDimensions(int width, int height) { // Always assume we're working with the smallest span to make sure we // reserve enough space in both orientations @@ -452,3 +429,11 @@ public class PagedViewCellLayout extends ViewGroup { } } } + +interface Page { + public int getPageChildCount(); + public View getChildOnPageAt(int i); + public void removeAllViewsOnPage(); + public void removeViewOnPageAt(int i); + public int indexOfChildOnPage(View v); +} diff --git a/src/com/android/launcher2/PagedViewCellLayoutChildren.java b/src/com/android/launcher2/PagedViewCellLayoutChildren.java new file mode 100644 index 000000000..46994f834 --- /dev/null +++ b/src/com/android/launcher2/PagedViewCellLayoutChildren.java @@ -0,0 +1,164 @@ +/* + * Copyright (C) 2010 The Android Open Source Project + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.android.launcher2; + +import android.content.Context; +import android.graphics.Rect; +import android.view.MotionEvent; +import android.view.View; +import android.view.ViewGroup; + +/** + * An abstraction of the original CellLayout which supports laying out items + * which span multiple cells into a grid-like layout. Also supports dimming + * to give a preview of its contents. + */ +public class PagedViewCellLayoutChildren extends ViewGroup { + static final String TAG = "PagedViewCellLayout"; + + private boolean mCenterContent; + + private int mCellWidth; + private int mCellHeight; + private int mWidthGap; + private int mHeightGap; + + public PagedViewCellLayoutChildren(Context context) { + super(context); + setLayerType(LAYER_TYPE_HARDWARE, null); + } + + @Override + public void cancelLongPress() { + super.cancelLongPress(); + + // Cancel long press for all children + final int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View child = getChildAt(i); + child.cancelLongPress(); + } + } + + public void setGap(int widthGap, int heightGap) { + mWidthGap = widthGap; + mHeightGap = heightGap; + requestLayout(); + } + + public void setCellDimensions(int width, int height) { + mCellWidth = width; + mCellHeight = height; + requestLayout(); + } + + @Override + public void requestChildFocus(View child, View focused) { + super.requestChildFocus(child, focused); + if (child != null) { + Rect r = new Rect(); + child.getDrawingRect(r); + requestRectangleOnScreen(r); + } + } + + @Override + protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { + int widthSpecMode = MeasureSpec.getMode(widthMeasureSpec); + int widthSpecSize = MeasureSpec.getSize(widthMeasureSpec); + + int heightSpecMode = MeasureSpec.getMode(heightMeasureSpec); + int heightSpecSize = MeasureSpec.getSize(heightMeasureSpec); + + if (widthSpecMode == MeasureSpec.UNSPECIFIED || heightSpecMode == MeasureSpec.UNSPECIFIED) { + throw new RuntimeException("CellLayout cannot have UNSPECIFIED dimensions"); + } + + final int count = getChildCount(); + for (int i = 0; i < count; i++) { + View child = getChildAt(i); + PagedViewCellLayout.LayoutParams lp = + (PagedViewCellLayout.LayoutParams) child.getLayoutParams(); + lp.setup(mCellWidth, mCellHeight, mWidthGap, mHeightGap, + ((ViewGroup)getParent()).getPaddingLeft(), + ((ViewGroup)getParent()).getPaddingTop()); + + int childWidthMeasureSpec = MeasureSpec.makeMeasureSpec(lp.width, + MeasureSpec.EXACTLY); + int childheightMeasureSpec = MeasureSpec.makeMeasureSpec(lp.height, + MeasureSpec.EXACTLY); + + child.measure(childWidthMeasureSpec, childheightMeasureSpec); + } + + setMeasuredDimension(widthSpecSize, heightSpecSize); + } + + @Override + protected void onLayout(boolean changed, int l, int t, int r, int b) { + int count = getChildCount(); + + int offsetX = 0; + if (mCenterContent) { + // determine the max width of all the rows and center accordingly + int maxRowWidth = 0; + for (int i = 0; i < count; i++) { + View child = getChildAt(i); + if (child.getVisibility() != GONE) { + PagedViewCellLayout.LayoutParams lp = + (PagedViewCellLayout.LayoutParams) child.getLayoutParams(); + maxRowWidth = Math.max(maxRowWidth, lp.x + lp.width); + } + } + offsetX = (getMeasuredWidth() / 2) - (maxRowWidth / 2); + } + + for (int i = 0; i < count; i++) { + View child = getChildAt(i); + if (child.getVisibility() != GONE) { + PagedViewCellLayout.LayoutParams lp = + (PagedViewCellLayout.LayoutParams) child.getLayoutParams(); + + int childLeft = offsetX + lp.x; + int childTop = lp.y; + child.layout(childLeft, childTop, childLeft + lp.width, childTop + lp.height); + } + } + } + + @Override + public boolean onTouchEvent(MotionEvent event) { + return super.onTouchEvent(event) || true; + } + + public void enableCenteredContent(boolean enabled) { + mCenterContent = enabled; + } + + @Override + protected void setChildrenDrawingCacheEnabled(boolean enabled) { + final int count = getChildCount(); + for (int i = 0; i < count; i++) { + final View view = getChildAt(i); + view.setDrawingCacheEnabled(enabled); + // Update the drawing caches + if (!view.isHardwareAccelerated()) { + view.buildDrawingCache(true); + } + } + } +} diff --git a/src/com/android/launcher2/PagedViewExtendedLayout.java b/src/com/android/launcher2/PagedViewExtendedLayout.java index 52df9f1ed..e54d26176 100644 --- a/src/com/android/launcher2/PagedViewExtendedLayout.java +++ b/src/com/android/launcher2/PagedViewExtendedLayout.java @@ -19,12 +19,13 @@ package com.android.launcher2; import android.content.Context; import android.util.AttributeSet; import android.view.MotionEvent; +import android.view.View; import android.widget.LinearLayout; /** * The linear layout used strictly for the widget/wallpaper tab of the customization tray */ -public class PagedViewExtendedLayout extends LinearLayout { +public class PagedViewExtendedLayout extends LinearLayout implements Page { static final String TAG = "PagedViewWidgetLayout"; public PagedViewExtendedLayout(Context context) { @@ -68,4 +69,29 @@ public class PagedViewExtendedLayout extends LinearLayout { getChildAt(i).setAlpha(alpha); } } + + @Override + public void removeAllViewsOnPage() { + removeAllViews(); + } + + @Override + public void removeViewOnPageAt(int index) { + removeViewAt(index); + } + + @Override + public int getPageChildCount() { + return getChildCount(); + } + + @Override + public View getChildOnPageAt(int i) { + return getChildAt(i); + } + + @Override + public int indexOfChildOnPage(View v) { + return indexOfChild(v); + } } diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java index 0af7b8aa3..702e227d5 100644 --- a/src/com/android/launcher2/PagedViewIcon.java +++ b/src/com/android/launcher2/PagedViewIcon.java @@ -65,6 +65,8 @@ public class PagedViewIcon extends CachedTextView implements Checkable { private int mHoloBlurColor; private int mHoloOutlineColor; + HolographicPagedViewIcon mHolographicOutlineView; + private static final HandlerThread sWorkerThread = new HandlerThread("pagedviewicon-helper"); static { sWorkerThread.start(); @@ -90,7 +92,7 @@ public class PagedViewIcon extends CachedTextView implements Checkable { public void run() { icon.mHolographicOutline = holographicOutline; icon.mIconCache.addOutline(icon.mIconCacheKey, holographicOutline); - icon.invalidate(); + icon.getHolographicOutlineView().invalidate(); } }); } @@ -127,6 +129,15 @@ public class PagedViewIcon extends CachedTextView implements Checkable { setFocusable(true); setBackgroundDrawable(null); + mHolographicOutlineView = new HolographicPagedViewIcon(context, this); + } + + protected HolographicPagedViewIcon getHolographicOutlineView() { + return mHolographicOutlineView; + } + + protected Bitmap getHolographicOutline() { + return mHolographicOutline; } private void queueHolographicOutlineCreation() { -- cgit v1.2.3