merge in ics-mr1-release history after reset to ics-mr1
diff --git a/res/values-sw600dp-port/dimens.xml b/res/values-sw600dp-port/dimens.xml
index 84f9835..6753cbf 100644
--- a/res/values-sw600dp-port/dimens.xml
+++ b/res/values-sw600dp-port/dimens.xml
@@ -18,7 +18,6 @@
<!-- AppsCustomize -->
<dimen name="apps_customize_cell_width">96dp</dimen>
<dimen name="apps_customize_cell_height">96dp</dimen>
- <dimen name="workspace_page_spacing">64dp</dimen>
<!-- Workspace -->
<!-- the area at the edge of the screen that makes the workspace go left
@@ -31,6 +30,7 @@
<dimen name="workspace_bottom_padding">25dip</dimen>
<dimen name="workspace_width_gap">0dp</dimen>
<dimen name="workspace_height_gap">32dp</dimen>
+ <dimen name="workspace_page_spacing">16dp</dimen>
<dimen name="apps_customize_pageLayoutWidthGap">24dp</dimen>
<dimen name="apps_customize_pageLayoutHeightGap">36dp</dimen>
diff --git a/res/values-sw720dp-port/dimens.xml b/res/values-sw720dp-port/dimens.xml
index 2e3f8ef..52c105d 100644
--- a/res/values-sw720dp-port/dimens.xml
+++ b/res/values-sw720dp-port/dimens.xml
@@ -15,10 +15,8 @@
-->
<resources>
- <!-- We can also afford to have a slightly wider portrait layout in
- xlarge -->
- <integer name="apps_customize_widget_cell_count_x">3</integer>
- <integer name="apps_customize_widget_cell_count_y">3</integer>
+<!-- Workspace -->
+ <dimen name="workspace_page_spacing">24dp</dimen>
<!-- AppsCustomize -->
<integer name="apps_customize_maxCellCountX">-1</integer>
@@ -27,4 +25,8 @@
<dimen name="apps_customize_pageLayoutHeightGap">36dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingLeft">24dp</dimen>
<dimen name="apps_customize_pageLayoutPaddingRight">24dp</dimen>
+ <!-- We can also afford to have a slightly wider portrait layout in
+ xlarge -->
+ <integer name="apps_customize_widget_cell_count_x">3</integer>
+ <integer name="apps_customize_widget_cell_count_y">3</integer>
</resources>
\ No newline at end of file
diff --git a/res/values-sw720dp/dimens.xml b/res/values-sw720dp/dimens.xml
index 5c39b01..48faf9a 100644
--- a/res/values-sw720dp/dimens.xml
+++ b/res/values-sw720dp/dimens.xml
@@ -15,10 +15,9 @@
-->
<resources>
- <dimen name="app_widget_preview_padding_left">0dp</dimen>
- <dimen name="app_widget_preview_padding_top">10dp</dimen>
-
<!-- AppsCustomize -->
<integer name="apps_customize_maxCellCountX">-1</integer>
<integer name="apps_customize_maxCellCountY">-1</integer>
+ <dimen name="app_widget_preview_padding_left">0dp</dimen>
+ <dimen name="app_widget_preview_padding_top">10dp</dimen>
</resources>
\ No newline at end of file
diff --git a/src/com/android/launcher2/AppsCustomizePagedView.java b/src/com/android/launcher2/AppsCustomizePagedView.java
index c55853e..2cdd16a 100644
--- a/src/com/android/launcher2/AppsCustomizePagedView.java
+++ b/src/com/android/launcher2/AppsCustomizePagedView.java
@@ -227,7 +227,7 @@
// Previews & outlines
ArrayList<AppsCustomizeAsyncTask> mRunningTasks;
private HolographicOutlineHelper mHolographicOutlineHelper;
- private static final int sPageSleepDelay = 150;
+ private static final int sPageSleepDelay = 200;
public AppsCustomizePagedView(Context context, AttributeSet attrs) {
super(context, attrs);
@@ -663,6 +663,19 @@
protected void snapToPage(int whichPage, int delta, int duration) {
super.snapToPage(whichPage, delta, duration);
updateCurrentTab(whichPage);
+
+ // Update the thread priorities given the direction lookahead
+ Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
+ while (iter.hasNext()) {
+ AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
+ int pageIndex = task.page + mNumAppsPages;
+ if ((mNextPage > mCurrentPage && pageIndex >= mCurrentPage) ||
+ (mNextPage < mCurrentPage && pageIndex <= mCurrentPage)) {
+ task.setThreadPriority(getThreadPriorityForPage(pageIndex));
+ } else {
+ task.setThreadPriority(Process.THREAD_PRIORITY_LOWEST);
+ }
+ }
}
private void updateCurrentTab(int currentPage) {
@@ -747,25 +760,45 @@
}
/**
+ * A helper to return the priority for loading of the specified widget page.
+ */
+ private int getWidgetPageLoadPriority(int page) {
+ // If we are snapping to another page, use that index as the target page index
+ int toPage = mCurrentPage;
+ if (mNextPage > -1) {
+ toPage = mNextPage;
+ }
+
+ // We use the distance from the target page as an initial guess of priority, but if there
+ // are no pages of higher priority than the page specified, then bump up the priority of
+ // the specified page.
+ Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
+ int minPageDiff = Integer.MAX_VALUE;
+ while (iter.hasNext()) {
+ AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
+ minPageDiff = Math.abs(task.page + mNumAppsPages - toPage);
+ }
+
+ int rawPageDiff = Math.abs(page - toPage);
+ return rawPageDiff - Math.min(rawPageDiff, minPageDiff);
+ }
+ /**
* Return the appropriate thread priority for loading for a given page (we give the current
* page much higher priority)
*/
private int getThreadPriorityForPage(int page) {
// TODO-APPS_CUSTOMIZE: detect number of cores and set thread priorities accordingly below
- int pageDiff = Math.abs(page - mCurrentPage);
+ int pageDiff = getWidgetPageLoadPriority(page);
if (pageDiff <= 0) {
- // return Process.THREAD_PRIORITY_DEFAULT;
- return Process.THREAD_PRIORITY_MORE_FAVORABLE;
+ return Process.THREAD_PRIORITY_LESS_FAVORABLE;
} else if (pageDiff <= 1) {
- // return Process.THREAD_PRIORITY_BACKGROUND;
- return Process.THREAD_PRIORITY_DEFAULT;
+ return Process.THREAD_PRIORITY_LOWEST;
} else {
- // return Process.THREAD_PRIORITY_LOWEST;
- return Process.THREAD_PRIORITY_DEFAULT;
+ return Process.THREAD_PRIORITY_LOWEST;
}
}
private int getSleepForPage(int page) {
- int pageDiff = Math.abs(page - mCurrentPage) - 1;
+ int pageDiff = getWidgetPageLoadPriority(page);
return Math.max(0, pageDiff * sPageSleepDelay);
}
/**
@@ -773,18 +806,18 @@
*/
private void prepareLoadWidgetPreviewsTask(int page, ArrayList<Object> widgets,
int cellWidth, int cellHeight, int cellCountX) {
+
// Prune all tasks that are no longer needed
Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
while (iter.hasNext()) {
AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
- int taskPage = task.page;
- if ((taskPage == page) ||
- taskPage < getAssociatedLowerPageBound(mCurrentPage - mNumAppsPages) ||
- taskPage > getAssociatedUpperPageBound(mCurrentPage - mNumAppsPages)) {
+ int taskPage = task.page + mNumAppsPages;
+ if (taskPage < getAssociatedLowerPageBound(mCurrentPage) ||
+ taskPage > getAssociatedUpperPageBound(mCurrentPage)) {
task.cancel(false);
iter.remove();
} else {
- task.setThreadPriority(getThreadPriorityForPage(taskPage + mNumAppsPages));
+ task.setThreadPriority(getThreadPriorityForPage(taskPage));
}
}
@@ -822,7 +855,7 @@
// Ensure that the task is appropriately prioritized and runs in parallel
AppsCustomizeAsyncTask t = new AppsCustomizeAsyncTask(page,
AsyncTaskPageData.Type.LoadWidgetPreviewData);
- t.setThreadPriority(getThreadPriorityForPage(page));
+ t.setThreadPriority(getThreadPriorityForPage(page + mNumAppsPages));
t.executeOnExecutor(AsyncTask.THREAD_POOL_EXECUTOR, pageData);
mRunningTasks.add(t);
}
@@ -1126,6 +1159,8 @@
}
private void loadWidgetPreviewsInBackground(AppsCustomizeAsyncTask task,
AsyncTaskPageData data) {
+ // loadWidgetPreviewsInBackground can be called without a task to load a set of widget
+ // previews synchronously
if (task != null) {
// Ensure that this task starts running at the correct priority
task.syncThreadPriority();
@@ -1171,14 +1206,23 @@
widget.applyPreview(new FastBitmapDrawable(preview), i);
}
}
- layout.createHardwareLayer();
+ layout.createHardwareLayer();
invalidate();
+
/* TEMPORARILY DISABLE HOLOGRAPHIC ICONS
if (mFadeInAdjacentScreens) {
prepareGenerateHoloOutlinesTask(data.page, data.items, data.generatedImages);
}
*/
+
+ // Update all thread priorities
+ Iterator<AppsCustomizeAsyncTask> iter = mRunningTasks.iterator();
+ while (iter.hasNext()) {
+ AppsCustomizeAsyncTask task = (AppsCustomizeAsyncTask) iter.next();
+ int pageIndex = task.page + mNumAppsPages;
+ task.setThreadPriority(getThreadPriorityForPage(pageIndex));
+ }
}
private void onHolographicPageItemsLoaded(AsyncTaskPageData data) {
// Invalidate early to short-circuit children invalidates
@@ -1475,16 +1519,25 @@
cancelAllTasks();
}
+
/*
* We load an extra page on each side to prevent flashes from scrolling and loading of the
* widget previews in the background with the AsyncTasks.
*/
+ final static int sLookBehindPageCount = 2;
+ final static int sLookAheadPageCount = 2;
protected int getAssociatedLowerPageBound(int page) {
- return Math.max(0, page - 2);
+ final int count = getChildCount();
+ int windowSize = Math.min(count, sLookBehindPageCount + sLookAheadPageCount + 1);
+ int windowMinIndex = Math.max(Math.min(page - sLookBehindPageCount, count - windowSize), 0);
+ return windowMinIndex;
}
protected int getAssociatedUpperPageBound(int page) {
final int count = getChildCount();
- return Math.min(page + 2, count - 1);
+ int windowSize = Math.min(count, sLookBehindPageCount + sLookAheadPageCount + 1);
+ int windowMaxIndex = Math.min(Math.max(page + sLookAheadPageCount, windowSize - 1),
+ count - 1);
+ return windowMaxIndex;
}
@Override
diff --git a/src/com/android/launcher2/AppsCustomizeTabHost.java b/src/com/android/launcher2/AppsCustomizeTabHost.java
index 334b369..07e6625 100644
--- a/src/com/android/launcher2/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher2/AppsCustomizeTabHost.java
@@ -171,7 +171,7 @@
private void reloadCurrentPage() {
if (!LauncherApplication.isScreenLarge()) {
- mAppsCustomizePane.flashScrollingIndicator();
+ mAppsCustomizePane.flashScrollingIndicator(true);
}
mAppsCustomizePane.loadAssociatedPages(mAppsCustomizePane.getCurrentPage());
mAppsCustomizePane.requestFocus();
diff --git a/src/com/android/launcher2/CachedTextView.java b/src/com/android/launcher2/CachedTextView.java
deleted file mode 100644
index f9f68a0..0000000
--- a/src/com/android/launcher2/CachedTextView.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * 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.Bitmap.Config;
-import android.graphics.Canvas;
-import android.graphics.Paint;
-import android.graphics.PorterDuff.Mode;
-import android.graphics.drawable.Drawable;
-import android.text.Layout;
-import android.util.AttributeSet;
-import android.widget.TextView;
-
-/*
- * This class is a bit of a hack, designed to speed up long text labels in Launcher. It caches the
- * text in a TextView to a bitmap and then just draws that Bitmap instead afterward, speeding up
- * rendering. Marquee scrolling is not currently supported.
- *
- */
-public class CachedTextView extends TextView {
- private Bitmap mCache;
- private final Paint mCachePaint = new Paint();
- private final Canvas mCacheCanvas = new Canvas();
-
- private int mPrevAlpha = -1;
- private boolean mIsBuildingCache;
- boolean mIsTextCacheDirty;
- float mTextCacheLeft;
- float mTextCacheTop;
- float mTextCacheScrollX;
- float mRectLeft, mRectTop;
- private float mPaddingH = 0;
- private float mPaddingV = 0;
- private CharSequence mText;
- private boolean mEnabled = true;
-
- public CachedTextView(Context context) {
- super(context);
- }
-
- public CachedTextView(Context context, AttributeSet attrs) {
- super(context, attrs);
- }
-
- public CachedTextView(Context context, AttributeSet attrs, int defStyle) {
- super(context, attrs, defStyle);
- }
-
- protected int getCacheTopPadding() {
- return 0;
- }
- protected int getCacheLeftPadding() {
- return 0;
- }
- protected int getCacheRightPadding() {
- return 0;
- }
- protected int getCacheBottomPadding() {
- return 0;
- }
-
- public void disableCache() {
- mEnabled = false;
- }
-
- public void setText(CharSequence text, BufferType type) {
- super.setText(text, type);
- mIsTextCacheDirty = true;
- }
-
- private void buildAndUpdateCache() {
- final Layout layout = getLayout();
- final int left = getCompoundPaddingLeft();
- final int top = getExtendedPaddingTop();
- final float prevAlpha = getAlpha();
-
- mTextCacheLeft = layout.getLineLeft(0) - getCacheLeftPadding();
- mTextCacheTop = top + layout.getLineTop(0) - mPaddingV - getCacheTopPadding();
-
- mRectLeft = mScrollX + getLeft();
- mRectTop = 0;
- mTextCacheScrollX = mScrollX;
-
- final float textCacheRight =
- Math.min(left + layout.getLineRight(0) + mPaddingH, mScrollX + mRight - mLeft) +
- getCacheRightPadding();
- final float textCacheBottom = top + layout.getLineBottom(0) + mPaddingV +
- getCacheBottomPadding();
- final float xCharWidth = getPaint().measureText("x");
-
- int width = (int) (textCacheRight - mTextCacheLeft + (2 * xCharWidth));
- int height = (int) (textCacheBottom - mTextCacheTop);
-
- if (width > 0 && height > 0) {
- if (mCache != null) {
- if (mCache.getWidth() != width || mCache.getHeight() != height) {
- mCache.recycle();
- mCache = null;
- }
- }
- if (mCache == null) {
- mCache = Bitmap.createBitmap(width, height, Config.ARGB_8888);
- mCacheCanvas.setBitmap(mCache);
- } else {
- mCacheCanvas.drawColor(0, Mode.CLEAR);
- }
-
- mCacheCanvas.save();
- mCacheCanvas.translate(-mTextCacheLeft, -mTextCacheTop);
-
- mIsBuildingCache = true;
- setAlpha(1.0f);
- draw(mCacheCanvas);
- setAlpha(prevAlpha);
- mIsBuildingCache = false;
- mCacheCanvas.restore();
- mCacheCanvas.setBitmap(null);
-
- // A hack-- we set the text to be one space (we don't make it empty just to avoid any
- // potential issues with text measurement, like line height, etc.) so that the text view
- // doesn't draw it anymore, since it's been cached.
- mText = getText();
- setText(" ");
- }
- }
-
- public CharSequence getText() {
- return (mText == null) ? super.getText() : mText;
- }
-
- public void draw(Canvas canvas) {
- if (mEnabled && mIsTextCacheDirty && !mIsBuildingCache) {
- buildAndUpdateCache();
- mIsTextCacheDirty = false;
- }
- if (mCache != null && !mIsBuildingCache) {
- canvas.drawBitmap(mCache, mTextCacheLeft - mTextCacheScrollX + mScrollX,
- mTextCacheTop, mCachePaint);
- }
- super.draw(canvas);
- }
-
- protected boolean isBuildingCache() {
- return mIsBuildingCache;
- }
-
- @Override
- protected boolean onSetAlpha(int alpha) {
- if (mPrevAlpha != alpha) {
- mPrevAlpha = alpha;
- mCachePaint.setAlpha(alpha);
-
- // We manually update the drawables alpha since the default TextView implementation may
- // not do this if there is a background set (which we may due to the focus bg)
- final Drawable[] dr = getCompoundDrawables();
- for (int i = 0; i < dr.length; ++i) {
- if (dr[i] != null) {
- dr[i].mutate().setAlpha(alpha);
- }
- }
-
- super.onSetAlpha(alpha);
- }
- return true;
- }
-}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 7ee03fc..43510c2 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -78,6 +78,7 @@
import android.view.View;
import android.view.View.OnLongClickListener;
import android.view.ViewGroup;
+import android.view.ViewTreeObserver;
import android.view.WindowManager;
import android.view.accessibility.AccessibilityEvent;
import android.view.animation.AccelerateDecelerateInterpolator;
@@ -161,6 +162,7 @@
private enum State { WORKSPACE, APPS_CUSTOMIZE, APPS_CUSTOMIZE_SPRING_LOADED };
private State mState = State.WORKSPACE;
private AnimatorSet mStateAnimation;
+ private AnimatorSet mDividerAnimator;
static final int APPWIDGET_HOST_ID = 1024;
private static final int EXIT_SPRINGLOADED_MODE_SHORT_TIMEOUT = 300;
@@ -177,8 +179,11 @@
private LayoutInflater mInflater;
- private DragController mDragController;
private Workspace mWorkspace;
+ private View mQsbDivider;
+ private View mDockDivider;
+ private DragLayer mDragLayer;
+ private DragController mDragController;
private AppWidgetManager mAppWidgetManager;
private LauncherAppWidgetHost mAppWidgetHost;
@@ -241,7 +246,6 @@
static final ArrayList<String> sDumpLogs = new ArrayList<String>();
- private DragLayer mDragLayer;
private BubbleTextView mWaitingForResume;
@@ -560,7 +564,24 @@
// market intent, so refresh the icon
updateAppMarketIcon();
if (!mWorkspaceLoading) {
- mWorkspace.post(mBuildLayersRunnable);
+ final ViewTreeObserver observer = mWorkspace.getViewTreeObserver();
+ final Workspace workspace = mWorkspace;
+ // We want to let Launcher draw itself at least once before we force it to build
+ // layers on all the workspace pages, so that transitioning to Launcher from other
+ // apps is nice and speedy. Usually the first call to preDraw doesn't correspond to
+ // a true draw so we wait until the second preDraw call to be safe
+ observer.addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
+ boolean mFirstTime = true;
+ public boolean onPreDraw() {
+ if (mFirstTime) {
+ mFirstTime = false;
+ } else {
+ workspace.post(mBuildLayersRunnable);
+ observer.removeOnPreDrawListener(this);
+ }
+ return true;
+ }
+ });
}
clearTypedText();
}
@@ -726,6 +747,8 @@
mDragLayer = (DragLayer) findViewById(R.id.drag_layer);
mWorkspace = (Workspace) mDragLayer.findViewById(R.id.workspace);
+ mQsbDivider = (ImageView) findViewById(R.id.qsb_divider);
+ mDockDivider = (ImageView) findViewById(R.id.dock_divider);
// Setup the drag layer
mDragLayer.setup(this, dragController);
@@ -2252,7 +2275,7 @@
if (!springLoaded && !LauncherApplication.isScreenLarge()) {
// Hide the workspace scrollbar
mWorkspace.hideScrollingIndicator(true);
- mWorkspace.hideDockDivider(true);
+ hideDockDivider();
}
if (!animationCancelled) {
updateWallpaperVisibility(false);
@@ -2294,7 +2317,7 @@
if (!springLoaded && !LauncherApplication.isScreenLarge()) {
// Hide the workspace scrollbar
mWorkspace.hideScrollingIndicator(true);
- mWorkspace.hideDockDivider(true);
+ hideDockDivider();
}
}
updateWallpaperVisibility(false);
@@ -2306,7 +2329,7 @@
* This is the opposite of showAppsCustomizeHelper.
* @param animated If true, the transition will be animated.
*/
- private void hideAppsCustomizeHelper(boolean animated) {
+ private void hideAppsCustomizeHelper(boolean animated, final boolean springLoaded) {
if (mStateAnimation != null) {
mStateAnimation.cancel();
mStateAnimation = null;
@@ -2370,6 +2393,7 @@
((LauncherTransitionable) fromView).onLauncherTransitionStart(instance, null, true);
((LauncherTransitionable) fromView).onLauncherTransitionEnd(instance, null, true);
}
+ mWorkspace.hideScrollingIndicator(false);
}
}
@@ -2380,10 +2404,12 @@
mWorkspace.changeState(Workspace.State.NORMAL, animated, stagger);
if (mState != State.WORKSPACE) {
mWorkspace.setVisibility(View.VISIBLE);
- hideAppsCustomizeHelper(animated);
+ hideAppsCustomizeHelper(animated, false);
// Show the search bar and hotseat
mSearchDropTargetBar.showSearchBar(animated);
+ // We only need to animate in the dock divider if we're going from spring loaded mode
+ showDockDivider(animated && mState == State.APPS_CUSTOMIZE_SPRING_LOADED);
// Set focus to the AppsCustomize button
if (mAllAppsButton != null) {
@@ -2391,8 +2417,7 @@
}
}
- mWorkspace.showDockDivider(!animated);
- mWorkspace.flashScrollingIndicator();
+ mWorkspace.flashScrollingIndicator(animated);
// Change the state *after* we've called all the transition code
mState = State.WORKSPACE;
@@ -2429,7 +2454,8 @@
void enterSpringLoadedDragMode() {
if (mState == State.APPS_CUSTOMIZE) {
mWorkspace.changeState(Workspace.State.SPRING_LOADED);
- hideAppsCustomizeHelper(true);
+ hideAppsCustomizeHelper(true, true);
+ hideDockDivider();
mState = State.APPS_CUSTOMIZE_SPRING_LOADED;
}
}
@@ -2466,6 +2492,33 @@
// Otherwise, we are not in spring loaded mode, so don't do anything.
}
+ void hideDockDivider() {
+ if (mQsbDivider != null && mDockDivider != null) {
+ mQsbDivider.setVisibility(View.INVISIBLE);
+ mDockDivider.setVisibility(View.INVISIBLE);
+ }
+ }
+
+ void showDockDivider(boolean animated) {
+ if (mQsbDivider != null && mDockDivider != null) {
+ mQsbDivider.setVisibility(View.VISIBLE);
+ mDockDivider.setVisibility(View.VISIBLE);
+ if (mDividerAnimator != null) {
+ mDividerAnimator.cancel();
+ mQsbDivider.setAlpha(1f);
+ mDockDivider.setAlpha(1f);
+ mDividerAnimator = null;
+ }
+ if (animated) {
+ mDividerAnimator = new AnimatorSet();
+ mDividerAnimator.playTogether(ObjectAnimator.ofFloat(mQsbDivider, "alpha", 1f),
+ ObjectAnimator.ofFloat(mDockDivider, "alpha", 1f));
+ mDividerAnimator.setDuration(mSearchDropTargetBar.getTransitionInDuration());
+ mDividerAnimator.start();
+ }
+ }
+ }
+
void lockAllApps() {
// TODO
}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 49c25b5..2f66537 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -204,7 +204,7 @@
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.PagedView, defStyle, 0);
- mPageSpacing = a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0);
+ setPageSpacing(a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0));
mPageLayoutPaddingTop = a.getDimensionPixelSize(
R.styleable.PagedView_pageLayoutPaddingTop, 0);
mPageLayoutPaddingBottom = a.getDimensionPixelSize(
@@ -557,6 +557,11 @@
scrollToNewPageWithoutMovingPages(mCurrentPage);
}
+ public void setPageSpacing(int pageSpacing) {
+ mPageSpacing = pageSpacing;
+ invalidateCachedOffsets();
+ }
+
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
if (!mIsDataReady) {
@@ -574,7 +579,7 @@
// Calculate the variable page spacing if necessary
if (mPageSpacing < 0) {
- mPageSpacing = ((right - left) - getChildAt(0).getMeasuredWidth()) / 2;
+ setPageSpacing(((right - left) - getChildAt(0).getMeasuredWidth()) / 2);
}
}
@@ -1761,9 +1766,9 @@
hideScrollingIndicator(false);
}
};
- protected void flashScrollingIndicator() {
+ protected void flashScrollingIndicator(boolean animated) {
removeCallbacks(hideScrollingIndicatorRunnable);
- showScrollingIndicator(false);
+ showScrollingIndicator(!animated);
postDelayed(hideScrollingIndicatorRunnable, sScrollIndicatorFlashDuration);
}
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index ef39813..c29e50d 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -131,10 +131,6 @@
child.setId(childId);
mChildren.addView(child, index, lp);
- if (child instanceof PagedViewIcon) {
- PagedViewIcon pagedViewIcon = (PagedViewIcon) child;
- pagedViewIcon.disableCache();
- }
return true;
}
return false;
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index b03d867..af10f18 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -17,21 +17,14 @@
package com.android.launcher2;
import android.animation.ObjectAnimator;
-import android.content.ComponentName;
import android.content.Context;
-import android.content.pm.PackageManager;
-import android.content.pm.ResolveInfo;
import android.content.res.Resources;
-import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Paint;
-import android.os.Handler;
-import android.os.HandlerThread;
-import android.os.Message;
import android.util.AttributeSet;
-import android.view.KeyEvent;
import android.widget.Checkable;
+import android.widget.TextView;
import com.android.launcher.R;
@@ -40,7 +33,7 @@
* An icon on a PagedView, specifically for items in the launcher's paged view (with compound
* drawables on the top).
*/
-public class PagedViewIcon extends CachedTextView implements Checkable {
+public class PagedViewIcon extends TextView implements Checkable {
private static final String TAG = "PagedViewIcon";
// holographic outline
diff --git a/src/com/android/launcher2/PagedViewWidget.java b/src/com/android/launcher2/PagedViewWidget.java
index 18fa249..9e668fd 100644
--- a/src/com/android/launcher2/PagedViewWidget.java
+++ b/src/com/android/launcher2/PagedViewWidget.java
@@ -156,12 +156,8 @@
if (preview != null) {
image.mAllowRequestLayout = false;
image.setImageDrawable(preview);
+ image.setAlpha(1f);
image.mAllowRequestLayout = true;
- image.setAlpha(0f);
- image.animate()
- .alpha(1f)
- .setDuration(sPreviewFadeInDuration + (index * sPreviewFadeInStaggerDuration))
- .start();
}
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 8ac5248..8c57349 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -107,7 +107,6 @@
private float mBackgroundAlpha = 0;
private float mOverScrollMaxBackgroundAlpha = 0.0f;
private int mOverScrollPageIndex = -1;
- private AnimatorSet mDividerAnimator;
private float mWallpaperScrollRatio = 1.0f;
@@ -3493,30 +3492,6 @@
mLauncher.getDragLayer().getLocationInDragLayer(this, loc);
}
- void showDockDivider(boolean immediately) {
- final ViewGroup parent = (ViewGroup) getParent();
- final View qsbDivider = (ImageView) (parent.findViewById(R.id.qsb_divider));
- final View dockDivider = (ImageView) (parent.findViewById(R.id.dock_divider));
- if (qsbDivider != null && dockDivider != null) {
- qsbDivider.setVisibility(View.VISIBLE);
- dockDivider.setVisibility(View.VISIBLE);
- if (mDividerAnimator != null) {
- mDividerAnimator.cancel();
- mDividerAnimator = null;
- }
- if (immediately) {
- qsbDivider.setAlpha(1f);
- dockDivider.setAlpha(1f);
- } else {
- mDividerAnimator = new AnimatorSet();
- mDividerAnimator.playTogether(ObjectAnimator.ofFloat(qsbDivider, "alpha", 1f),
- ObjectAnimator.ofFloat(dockDivider, "alpha", 1f));
- mDividerAnimator.setDuration(sScrollIndicatorFadeInDuration);
- mDividerAnimator.start();
- }
- }
- }
-
void setFadeForOverScroll(float fade) {
if (!isScrollingIndicatorEnabled()) return;
@@ -3530,42 +3505,4 @@
dockDivider.setAlpha(reducedFade);
scrollIndicator.setAlpha(1 - fade);
}
-
- void hideDockDivider(boolean immediately) {
- final ViewGroup parent = (ViewGroup) getParent();
- final View qsbDivider = (ImageView) (parent.findViewById(R.id.qsb_divider));
- final View dockDivider = (ImageView) (parent.findViewById(R.id.dock_divider));
- if (qsbDivider != null && dockDivider != null) {
- if (mDividerAnimator != null) {
- mDividerAnimator.cancel();
- mDividerAnimator = null;
- }
- if (immediately) {
- qsbDivider.setVisibility(View.GONE);
- dockDivider.setVisibility(View.GONE);
- qsbDivider.setAlpha(0f);
- dockDivider.setAlpha(0f);
- } else {
- mDividerAnimator = new AnimatorSet();
- mDividerAnimator.playTogether(ObjectAnimator.ofFloat(qsbDivider, "alpha", 0f),
- ObjectAnimator.ofFloat(dockDivider, "alpha", 0f));
- mDividerAnimator.addListener(new AnimatorListenerAdapter() {
- private boolean cancelled = false;
- @Override
- public void onAnimationCancel(android.animation.Animator animation) {
- cancelled = true;
- }
- @Override
- public void onAnimationEnd(android.animation.Animator animation) {
- if (!cancelled) {
- qsbDivider.setVisibility(View.GONE);
- dockDivider.setVisibility(View.GONE);
- }
- }
- });
- mDividerAnimator.setDuration(sScrollIndicatorFadeOutDuration);
- mDividerAnimator.start();
- }
- }
- }
}