summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--res/values/colors.xml1
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java13
-rw-r--r--src/com/android/launcher3/AppsCustomizeTabHost.java7
-rw-r--r--src/com/android/launcher3/BubbleTextView.java4
-rw-r--r--src/com/android/launcher3/Folder.java1
-rw-r--r--src/com/android/launcher3/Launcher.java3
-rw-r--r--src/com/android/launcher3/PagedView.java87
7 files changed, 54 insertions, 62 deletions
diff --git a/res/values/colors.xml b/res/values/colors.xml
index dc35a3f68..c07390380 100644
--- a/res/values/colors.xml
+++ b/res/values/colors.xml
@@ -34,6 +34,7 @@
<color name="apps_customize_icon_text_color">#FFF</color>
<color name="wallpaper_picker_translucent_gray">#66000000</color>
<color name="folder_items_text_color">#FF333333</color>
+ <color name="folder_items_glow_color">#FFCCCCCC</color>
<color name="outline_color">#FFFFFFFF</color>
<color name="first_run_cling_circle_background_color">#64b1ea</color>
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 175d5f83e..25cd9f2f1 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -825,6 +825,9 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
@Override
public View getContent() {
+ if (getChildCount() > 0) {
+ return getChildAt(0);
+ }
return null;
}
@@ -848,7 +851,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
public void onLauncherTransitionEnd(Launcher l, boolean animated, boolean toWorkspace) {
mInTransition = false;
for (AsyncTaskPageData d : mDeferredSyncWidgetPageItems) {
- onSyncWidgetPageItems(d);
+ onSyncWidgetPageItems(d, false);
}
mDeferredSyncWidgetPageItems.clear();
for (Runnable r : mDeferredPrepareLoadWidgetPreviewsTasks) {
@@ -1117,7 +1120,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
mRunningTasks.remove(task);
if (task.isCancelled()) return;
// do cleanup inside onSyncWidgetPageItems
- onSyncWidgetPageItems(data);
+ onSyncWidgetPageItems(data, false);
}
}, mWidgetPreviewLoader);
@@ -1233,7 +1236,7 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
AsyncTaskPageData data = new AsyncTaskPageData(page, items,
maxPreviewWidth, maxPreviewHeight, null, null, mWidgetPreviewLoader);
loadWidgetPreviewsInBackground(null, data);
- onSyncWidgetPageItems(data);
+ onSyncWidgetPageItems(data, immediate);
} else {
if (mInTransition) {
mDeferredPrepareLoadWidgetPreviewsTasks.add(this);
@@ -1272,8 +1275,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
}
}
- private void onSyncWidgetPageItems(AsyncTaskPageData data) {
- if (mInTransition) {
+ private void onSyncWidgetPageItems(AsyncTaskPageData data, boolean immediatelySyncItems) {
+ if (!immediatelySyncItems && mInTransition) {
mDeferredSyncWidgetPageItems.add(data);
return;
}
diff --git a/src/com/android/launcher3/AppsCustomizeTabHost.java b/src/com/android/launcher3/AppsCustomizeTabHost.java
index bfcf92ac2..697bd7ecf 100644
--- a/src/com/android/launcher3/AppsCustomizeTabHost.java
+++ b/src/com/android/launcher3/AppsCustomizeTabHost.java
@@ -367,6 +367,10 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
@Override
public View getContent() {
+ View appsCustomizeContent = mAppsCustomizePane.getContent();
+ if (appsCustomizeContent != null) {
+ return appsCustomizeContent;
+ }
return mContent;
}
@@ -397,6 +401,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
@Override
public void onLauncherTransitionStart(Launcher l, boolean animated, boolean toWorkspace) {
+ mAppsCustomizePane.onLauncherTransitionStart(l, animated, toWorkspace);
if (animated) {
enableAndBuildHardwareLayer();
}
@@ -407,7 +412,7 @@ public class AppsCustomizeTabHost extends TabHost implements LauncherTransitiona
@Override
public void onLauncherTransitionStep(Launcher l, float t) {
- // Do nothing
+ mAppsCustomizePane.onLauncherTransitionStep(l, t);
}
@Override
diff --git a/src/com/android/launcher3/BubbleTextView.java b/src/com/android/launcher3/BubbleTextView.java
index 400dd4b4b..30016e5b3 100644
--- a/src/com/android/launcher3/BubbleTextView.java
+++ b/src/com/android/launcher3/BubbleTextView.java
@@ -203,6 +203,10 @@ public class BubbleTextView extends TextView {
destCanvas.restore();
}
+ public void setGlowColor(int color) {
+ mFocusedOutlineColor = mFocusedGlowColor = mPressedOutlineColor = mPressedGlowColor = color;
+ }
+
/**
* Returns a new bitmap to be used as the object outline, e.g. to visualize the drop location.
* Responsibility for the bitmap is transferred to the caller.
diff --git a/src/com/android/launcher3/Folder.java b/src/com/android/launcher3/Folder.java
index 7aa5de832..bd6101080 100644
--- a/src/com/android/launcher3/Folder.java
+++ b/src/com/android/launcher3/Folder.java
@@ -538,6 +538,7 @@ public class Folder extends LinearLayout implements DragSource, View.OnClickList
textView.setTag(item);
textView.setTextColor(getResources().getColor(R.color.folder_items_text_color));
textView.setShadowsEnabled(false);
+ textView.setGlowColor(getResources().getColor(R.color.folder_items_glow_color));
textView.setOnClickListener(this);
textView.setOnLongClickListener(this);
diff --git a/src/com/android/launcher3/Launcher.java b/src/com/android/launcher3/Launcher.java
index 29e8fe969..f721571c2 100644
--- a/src/com/android/launcher3/Launcher.java
+++ b/src/com/android/launcher3/Launcher.java
@@ -3007,7 +3007,7 @@ public class Launcher extends Activity
dispatchOnLauncherTransitionPrepare(fromView, animated, true);
dispatchOnLauncherTransitionPrepare(toView, animated, true);
- mAppsCustomizeContent.pauseScrolling();
+ mAppsCustomizeContent.stopScrolling();
mStateAnimation.addListener(new AnimatorListenerAdapter() {
@Override
@@ -3019,7 +3019,6 @@ public class Launcher extends Activity
onCompleteRunnable.run();
}
mAppsCustomizeContent.updateCurrentPageScroll();
- mAppsCustomizeContent.resumeScrolling();
}
});
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java
index e724063df..3ff987393 100644
--- a/src/com/android/launcher3/PagedView.java
+++ b/src/com/android/launcher3/PagedView.java
@@ -157,7 +157,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
protected int mTouchSlop;
private int mPagingTouchSlop;
private int mMaximumVelocity;
- protected int mPageSpacing;
protected int mPageLayoutPaddingTop;
protected int mPageLayoutPaddingBottom;
protected int mPageLayoutPaddingLeft;
@@ -260,9 +259,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
// Drop to delete
private View mDeleteDropTarget;
- private boolean mAutoComputePageSpacing = false;
- private boolean mRecomputePageSpacing = false;
-
// Bouncer
private boolean mTopAlignPageWhenShrinkingForBouncer = false;
@@ -285,10 +281,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
TypedArray a = context.obtainStyledAttributes(attrs,
R.styleable.PagedView, defStyle, 0);
- setPageSpacing(a.getDimensionPixelSize(R.styleable.PagedView_pageSpacing, 0));
- if (mPageSpacing < 0) {
- mAutoComputePageSpacing = mRecomputePageSpacing = true;
- }
+
mPageLayoutPaddingTop = a.getDimensionPixelSize(
R.styleable.PagedView_pageLayoutPaddingTop, 0);
mPageLayoutPaddingBottom = a.getDimensionPixelSize(
@@ -513,33 +506,39 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
scrollTo(newX, 0);
mScroller.setFinalX(newX);
- mScroller.forceFinished(true);
+ forceFinishScroller();
}
/**
* Called during AllApps/Home transitions to avoid unnecessary work. When that other animation
- * ends, {@link #resumeScrolling()} should be called, along with
- * {@link #updateCurrentPageScroll()} to correctly set the final state and re-enable scrolling.
+ * {@link #updateCurrentPageScroll()} should be called, to correctly set the final state and
+ * re-enable scrolling.
*/
- void pauseScrolling() {
- mScroller.forceFinished(true);
+ void stopScrolling() {
+ mCurrentPage = mNextPage;
+ forceFinishScroller();
}
- /**
- * Enables scrolling again.
- * @see #pauseScrolling()
- */
- void resumeScrolling() {
+ private void abortScrollerAnimation() {
+ mScroller.abortAnimation();
+ // We need to clean up the next page here to avoid computeScrollHelper from
+ // updating current page on the pass.
+ mNextPage = INVALID_PAGE;
}
+
+ private void forceFinishScroller() {
+ mScroller.forceFinished(true);
+ // We need to clean up the next page here to avoid computeScrollHelper from
+ // updating current page on the pass.
+ mNextPage = INVALID_PAGE;
+ }
+
/**
* Sets the current page.
*/
void setCurrentPage(int currentPage) {
if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
- // We need to clean up the next page here to avoid computeScrollHelper from
- // updating current page on the pass.
- mNextPage = INVALID_PAGE;
+ abortScrollerAnimation();
}
// don't introduce any checks like mCurrentPage == currentPage here-- if we change the
// the default
@@ -875,26 +874,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
}
setMeasuredDimension(scaledWidthSize, scaledHeightSize);
-
- if (childCount > 0) {
- // Calculate the variable page spacing if necessary
- if (mAutoComputePageSpacing && mRecomputePageSpacing) {
- // The gap between pages in the PagedView should be equal to the gap from the page
- // to the edge of the screen (so it is not visible in the current screen). To
- // account for unequal padding on each side of the paged view, we take the maximum
- // of the left/right gap and use that as the gap between each page.
- int offset = (getViewportWidth() - getChildWidth(0)) / 2;
- int spacing = Math.max(offset, widthSize - offset -
- getChildAt(0).getMeasuredWidth());
- setPageSpacing(spacing);
- mRecomputePageSpacing = false;
- }
- }
- }
-
- public void setPageSpacing(int pageSpacing) {
- mPageSpacing = pageSpacing;
- requestLayout();
}
@Override
@@ -1029,7 +1008,6 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
// This ensures that when children are added, they get the correct transforms / alphas
// in accordance with any scroll effects.
mForceScreenScrolled = true;
- mRecomputePageSpacing = true;
updateFreescrollBounds();
invalidate();
}
@@ -1301,9 +1279,9 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
int offset = (getViewportWidth() - getChildWidth(mCurrentPage)) / 2;
if (isLayoutRtl()) {
return (x > (getViewportOffsetX() + getViewportWidth() -
- offset + mPageSpacing));
+ offset));
}
- return (x < getViewportOffsetX() + offset - mPageSpacing);
+ return (x < getViewportOffsetX() + offset);
}
/**
@@ -1312,10 +1290,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
protected boolean hitsNextPage(float x, float y) {
int offset = (getViewportWidth() - getChildWidth(mCurrentPage)) / 2;
if (isLayoutRtl()) {
- return (x < getViewportOffsetX() + offset - mPageSpacing);
+ return (x < getViewportOffsetX() + offset);
}
return (x > (getViewportOffsetX() + getViewportWidth() -
- offset + mPageSpacing));
+ offset));
}
/** Returns whether x and y originated within the buffered viewport */
@@ -1394,7 +1372,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
final boolean finishedScrolling = (mScroller.isFinished() || xDist < mTouchSlop);
if (finishedScrolling) {
mTouchState = TOUCH_STATE_REST;
- mScroller.abortAnimation();
+ abortScrollerAnimation();
} else {
if (isTouchPointInViewportWithBuffer((int) mDownMotionX, (int) mDownMotionY)) {
mTouchState = TOUCH_STATE_SCROLLING;
@@ -1506,7 +1484,8 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
protected float getScrollProgress(int screenCenter, View v, int page) {
final int halfScreenSize = getViewportWidth() / 2;
- int totalDistance = v.getMeasuredWidth() + mPageSpacing;
+ int offset = (getViewportWidth() - getChildWidth(page)) / 2;
+ int totalDistance = v.getMeasuredWidth() + offset;
int delta = screenCenter - (getScrollForPage(page) + halfScreenSize);
float scrollProgress = delta / (totalDistance * 1.0f);
@@ -1692,7 +1671,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
* will be false if being flinged.
*/
if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
+ abortScrollerAnimation();
}
// Remember where the motion event started
@@ -1890,7 +1869,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
}
} else {
if (!mScroller.isFinished()) {
- mScroller.abortAnimation();
+ abortScrollerAnimation();
}
float scaleX = getScaleX();
@@ -2354,8 +2333,7 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
if (mContentIsRefreshable) {
// Force all scrolling-related behavior to end
- mScroller.forceFinished(true);
- mNextPage = INVALID_PAGE;
+ forceFinishScroller();
// Update all the pages
syncPages();
@@ -2595,9 +2573,10 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc
int newX = 0;
if (slideFromLeft) {
if (i == 0) {
+ int pageSpace = (getViewportWidth() - getChildWidth(i)) / 2;
// Simulate the page being offscreen with the page spacing
oldX = getViewportOffsetX() + getChildOffset(i) - getChildWidth(i)
- - mPageSpacing;
+ - pageSpace;
} else {
oldX = getViewportOffsetX() + getChildOffset(i - 1);
}