From c3f9f4fcbd3fba3753335d5c9671c0893393b164 Mon Sep 17 00:00:00 2001 From: Winson Chung Date: Tue, 14 Dec 2010 17:25:59 -0800 Subject: Fixing issue with customize page holographic previews not showing. - Adding temporary workaround for bad holographic default widget previews. Change-Id: I261045beac3791111f928511435e17e320f2d4a7 --- src/com/android/launcher2/PagedView.java | 16 +++++----------- src/com/android/launcher2/PagedViewWidget.java | 6 ++++-- 2 files changed, 9 insertions(+), 13 deletions(-) (limited to 'src/com/android') diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java index 856507d64..8483f959f 100644 --- a/src/com/android/launcher2/PagedView.java +++ b/src/com/android/launcher2/PagedView.java @@ -595,20 +595,14 @@ public abstract class PagedView extends ViewGroup { int rightScreen = 0; while (x <= mScrollX) { leftScreen++; - x += pageWidth + mPageSpacing; - // replace above line with this if you don't assume all pages have same width as 0th - // page: - // x += getScaledMeasuredWidth(getChildAt(leftScreen)); + x += getScaledMeasuredWidth(getChildAt(leftScreen)) + mPageSpacing; } rightScreen = leftScreen; - while (x < mScrollX + screenWidth) { + while (x < mScrollX + screenWidth && rightScreen < pageCount) { rightScreen++; - x += pageWidth + mPageSpacing; - // replace above line with this if you don't assume all pages have same width as 0th - // page: - //if (rightScreen < pageCount) { - // x += getScaledMeasuredWidth(getChildAt(rightScreen)); - //} + if (rightScreen < pageCount) { + x += getScaledMeasuredWidth(getChildAt(rightScreen)) + mPageSpacing; + } } rightScreen = Math.min(getChildCount() - 1, rightScreen); diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java index 89ed0ecee..5f5844f44 100644 --- a/src/com/android/launcher2/PagedViewWidget.java +++ b/src/com/android/launcher2/PagedViewWidget.java @@ -25,6 +25,8 @@ import android.graphics.Bitmap; import android.graphics.Canvas; import android.graphics.Color; import android.graphics.Paint; +import android.graphics.PorterDuffXfermode; +import android.graphics.PorterDuff.Mode; import android.graphics.drawable.Drawable; import android.os.Handler; import android.os.HandlerThread; @@ -78,6 +80,8 @@ public class PagedViewWidget extends LinearLayout { widget.mPreview.setAlpha(255); widget.mPreview.draw(widget.mHolographicOutlineCanvas); widget.mPreview.setAlpha(prevAlpha); + // Temporary workaround to make the default widget outlines visible + widget.mHolographicOutlineCanvas.drawColor(Color.argb(156, 0, 0, 0), Mode.SRC_OVER); widget.mHolographicOutlineCanvas.restore(); sHolographicOutlineHelper.applyThickExpensiveOutlineWithBlur(outline, @@ -120,14 +124,12 @@ public class PagedViewWidget extends LinearLayout { } private void queueHolographicOutlineCreation() { - /* Temporarily disabling holographic outline creation. // Generate the outline in the background if (mHolographicOutline == null) { Message m = sWorker.obtainMessage(MESSAGE_CREATE_HOLOGRAPHIC_OUTLINE); m.obj = this; sWorker.sendMessage(m); } - */ } public void applyFromAppWidgetProviderInfo(AppWidgetProviderInfo info, -- cgit v1.2.3