Merge "Preventing scrolling of workspace when in customize" into honeycomb
diff --git a/res/drawable-xlarge-nodpi/city.jpg b/res/drawable-xlarge-nodpi/city.jpg
index 983678e..72beb6b 100644
--- a/res/drawable-xlarge-nodpi/city.jpg
+++ b/res/drawable-xlarge-nodpi/city.jpg
Binary files differ
diff --git a/res/values-xlarge/config.xml b/res/values-xlarge/config.xml
index c6cd0e2..dc9d096 100644
--- a/res/values-xlarge/config.xml
+++ b/res/values-xlarge/config.xml
@@ -9,7 +9,7 @@
<!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
<!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
- <integer name="config_allAppsZoomInTime">900</integer>
+ <integer name="config_allAppsZoomInTime">1450</integer>
<!-- Duration in milliseconds of the transition between tabs in the all apps/customize
tray -->
@@ -17,10 +17,10 @@
<!-- Duration in milliseconds of the all apps zoom-out animation -->
<!-- NB: This should be less than the workspaceUnshrinkTime as they happen together. -->
- <integer name="config_allAppsZoomOutTime">1400</integer>
+ <integer name="config_allAppsZoomOutTime">1200</integer>
<!-- Scaling factor used in the all apps zooming animations -->
- <integer name="config_allAppsZoomScaleFactor">10</integer>
+ <integer name="config_allAppsZoomScaleFactor">20</integer>
<!-- Duration in milliseconds of the all apps / configuration zoom-in animation. -->
<!-- NB: This should be less than the workspaceShrinkTime as they happen together. -->
@@ -36,16 +36,16 @@
<!-- Duration in milliseconds of the animations between all apps, customize, & home.
NOTE: If these are changed, the toolbar animation times below should also be. -->
<integer name="config_allAppsCameraPanTime">700</integer>
- <integer name="config_allAppsFadeOutTime">400</integer>
+ <integer name="config_allAppsFadeOutTime">500</integer>
<integer name="config_customizeWorkspaceShrinkTime">800</integer>
- <integer name="config_allAppsWorkspaceShrinkTime">950</integer>
- <integer name="config_workspaceUnshrinkTime">450</integer>
+ <integer name="config_allAppsWorkspaceShrinkTime">1450</integer>
+ <integer name="config_workspaceUnshrinkTime">650</integer>
<!-- Duration in milliseconds toolbar fade in and fade out animations.
NOTE: Fade in and fade out time should together be less the transition
animations between all apps, customize, & the workspace. -->
- <integer name="config_toolbarButtonFadeInTime">100</integer>
- <integer name="config_toolbarButtonFadeOutTime">100</integer>
+ <integer name="config_toolbarButtonFadeInTime">350</integer>
+ <integer name="config_toolbarButtonFadeOutTime">200</integer>
<!-- When dragging items on the workspace, how much bigger (in pixels) the dragged view
should be, as compared to the original view. If 0, it will not be scaled at all.
diff --git a/src/com/android/launcher2/AllAppsPagedView.java b/src/com/android/launcher2/AllAppsPagedView.java
index a0f1f6e..daa5d64 100644
--- a/src/com/android/launcher2/AllAppsPagedView.java
+++ b/src/com/android/launcher2/AllAppsPagedView.java
@@ -425,6 +425,7 @@
// add any necessary pages
for (int i = curNumPages; i < numPages; ++i) {
PagedViewCellLayout layout = new PagedViewCellLayout(getContext());
+ layout.enableHardwareLayers();
layout.setCellCount(mCellCountX, mCellCountY);
layout.setPadding(mPageLayoutPaddingLeft, mPageLayoutPaddingTop,
mPageLayoutPaddingRight, mPageLayoutPaddingBottom);
diff --git a/src/com/android/launcher2/CachedTextView.java b/src/com/android/launcher2/CachedTextView.java
index eaa6636..403d856 100644
--- a/src/com/android/launcher2/CachedTextView.java
+++ b/src/com/android/launcher2/CachedTextView.java
@@ -47,6 +47,7 @@
private float mPaddingH = 0;
private float mPaddingV = 0;
private CharSequence mText;
+ private boolean mEnabled = true;
public CachedTextView(Context context) {
super(context);
@@ -73,6 +74,10 @@
return 0;
}
+ public void disableCache() {
+ mEnabled = false;
+ }
+
public void setText(CharSequence text, BufferType type) {
super.setText(text, type);
mIsTextCacheDirty = true;
@@ -138,7 +143,7 @@
}
public void draw(Canvas canvas) {
- if (mIsTextCacheDirty && !mIsBuildingCache) {
+ if (mEnabled && mIsTextCacheDirty && !mIsBuildingCache) {
buildAndUpdateCache();
mIsTextCacheDirty = false;
}
diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java
index 6f40748..df6ff36 100644
--- a/src/com/android/launcher2/Launcher.java
+++ b/src/com/android/launcher2/Launcher.java
@@ -2537,7 +2537,6 @@
}
private void showToolbarButton(View button) {
- button.setAlpha(1.0f);
button.setVisibility(View.VISIBLE);
button.setFocusable(true);
button.setClickable(true);
@@ -2584,6 +2583,7 @@
} else {
if (showing) {
showToolbarButton(view);
+ view.setAlpha(1f);
} else {
hideToolbarButton(view);
}
@@ -2638,7 +2638,7 @@
// visible. Modifying initialHeightFactor changes how much of the view is
// initially showing, and hence the perceived angle from which the view enters.
if (state == State.ALL_APPS) {
- final float initialHeightFactor = 0.165f;
+ final float initialHeightFactor = 0.175f;
view.setPivotY((1 - initialHeightFactor) * height);
} else {
final float initialHeightFactor = 0.2f;
@@ -2675,9 +2675,6 @@
}
if (animated) {
- final float oldScaleX = toView.getScaleX();
- final float oldScaleY = toView.getScaleY();
-
ValueAnimator scaleAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
scaleAnim.setInterpolator(new Workspace.ZoomOutInterpolator());
scaleAnim.addUpdateListener(new AnimatorUpdateListener() {
@@ -2685,15 +2682,15 @@
final float b = (Float) animation.getAnimatedValue();
final float a = 1f - b;
((View) toView.getParent()).fastInvalidate();
- toView.setFastScaleX(a * oldScaleX + b * 1f);
- toView.setFastScaleY(a * oldScaleY + b * 1f);
+ toView.setFastScaleX(a * scale + b * 1f);
+ toView.setFastScaleY(a * scale + b * 1f);
}
});
if (toAllApps) {
toView.setAlpha(0f);
ValueAnimator alphaAnim = ValueAnimator.ofFloat(0f, 1f).setDuration(duration);
- alphaAnim.setInterpolator(new DecelerateInterpolator(1.0f));
+ alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f));
alphaAnim.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
final float b = (Float) animation.getAnimatedValue();
@@ -2810,7 +2807,7 @@
});
ValueAnimator alphaAnim = ValueAnimator.ofFloat(0f, 1f);
alphaAnim.setDuration(res.getInteger(R.integer.config_allAppsFadeOutTime));
- alphaAnim.setInterpolator(new DecelerateInterpolator(2.0f));
+ alphaAnim.setInterpolator(new DecelerateInterpolator(1.5f));
alphaAnim.addUpdateListener(new AnimatorUpdateListener() {
public void onAnimationUpdate(ValueAnimator animation) {
final float b = (Float) animation.getAnimatedValue();
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 96b0551..45baa6c 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -596,7 +596,21 @@
canvas.clipRect(mScrollX, mScrollY, mScrollX + mRight - mLeft,
mScrollY + mBottom - mTop);
+ for (int i = 0; i < pageCount; i++) {
+ View child = getChildAt(i);
+ if (child != null && child instanceof PagedViewCellLayout) {
+ boolean willBeDrawn = i >= leftScreen && i <= rightScreen;
+ if (!willBeDrawn) {
+ ((PagedViewCellLayout)child).destroyHardwareLayers();
+ }
+ }
+ }
+
for (int i = leftScreen; i <= rightScreen; i++) {
+ View child = getChildAt(i);
+ if (child != null && child instanceof PagedViewCellLayout) {
+ ((PagedViewCellLayout)child).createHardwareLayers();
+ }
drawChild(canvas, getChildAt(i), drawingTime);
}
canvas.restore();
diff --git a/src/com/android/launcher2/PagedViewCellLayout.java b/src/com/android/launcher2/PagedViewCellLayout.java
index 6d1fb55..d64f3c9 100644
--- a/src/com/android/launcher2/PagedViewCellLayout.java
+++ b/src/com/android/launcher2/PagedViewCellLayout.java
@@ -40,6 +40,7 @@
private static int sDefaultCellDimensions = 96;
protected PagedViewCellLayoutChildren mChildren;
private PagedViewCellLayoutChildren mHolographicChildren;
+ private boolean mUseHardwareLayers = false;
public PagedViewCellLayout(Context context) {
this(context, null);
@@ -73,12 +74,29 @@
addView(mHolographicChildren);
}
+ public void enableHardwareLayers() {
+ mUseHardwareLayers = true;
+ }
+
@Override
public void setAlpha(float alpha) {
mChildren.setAlpha(alpha);
mHolographicChildren.setAlpha(1.0f - alpha);
}
+ void destroyHardwareLayers() {
+ if (mUseHardwareLayers) {
+ mChildren.destroyHardwareLayer();
+ mHolographicChildren.destroyHardwareLayer();
+ }
+ }
+ void createHardwareLayers() {
+ if (mUseHardwareLayers) {
+ mChildren.createHardwareLayer();
+ mHolographicChildren.createHardwareLayer();
+ }
+ }
+
@Override
public void cancelLongPress() {
super.cancelLongPress();
@@ -109,6 +127,9 @@
if (child instanceof PagedViewIcon) {
PagedViewIcon pagedViewIcon = (PagedViewIcon) child;
+ if (mUseHardwareLayers) {
+ pagedViewIcon.disableCache();
+ }
mHolographicChildren.addView(pagedViewIcon.getHolographicOutlineView(), index, lp);
}
return true;
diff --git a/src/com/android/launcher2/PagedViewCellLayoutChildren.java b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
index 1359a43..27da02a 100644
--- a/src/com/android/launcher2/PagedViewCellLayoutChildren.java
+++ b/src/com/android/launcher2/PagedViewCellLayoutChildren.java
@@ -18,7 +18,6 @@
import android.content.Context;
import android.graphics.Rect;
-import android.view.MotionEvent;
import android.view.View;
import android.view.ViewGroup;
@@ -39,7 +38,6 @@
public PagedViewCellLayoutChildren(Context context) {
super(context);
- setLayerType(LAYER_TYPE_HARDWARE, null);
}
@Override
@@ -140,6 +138,17 @@
}
}
+ void destroyHardwareLayer() {
+ if (getLayerType() == LAYER_TYPE_HARDWARE) {
+ setLayerType(LAYER_TYPE_NONE, null);
+ }
+ }
+ void createHardwareLayer() {
+ if (getLayerType() == LAYER_TYPE_NONE) {
+ setLayerType(LAYER_TYPE_HARDWARE, null);
+ }
+ }
+
public void enableCenteredContent(boolean enabled) {
mCenterContent = enabled;
}
diff --git a/src/com/android/launcher2/PagedViewIcon.java b/src/com/android/launcher2/PagedViewIcon.java
index ca67d2f..1366619 100644
--- a/src/com/android/launcher2/PagedViewIcon.java
+++ b/src/com/android/launcher2/PagedViewIcon.java
@@ -40,7 +40,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 TextView implements Checkable {
+public class PagedViewIcon extends CachedTextView implements Checkable {
private static final String TAG = "PagedViewIcon";
// holographic outline
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 2b1a4d2..097fbc0 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -1582,7 +1582,7 @@
*/
static class ZoomOutInterpolator implements TimeInterpolator {
private final ZInterpolator zInterpolator = new ZInterpolator(0.2f);
- private final DecelerateInterpolator decelerate = new DecelerateInterpolator(1.5f);
+ private final DecelerateInterpolator decelerate = new DecelerateInterpolator(1.8f);
public float getInterpolation(float input) {
return decelerate.getInterpolation(zInterpolator.getInterpolation(input));
@@ -1817,8 +1817,8 @@
case BOTTOM_VISIBLE:
// all apps
if (animated) {
- mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.49f : 0.46f);
- mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.49f : 0.46f);
+ mWallpaperOffset.setHorizontalCatchupConstant(isLandscape ? 0.65f : 0.65f);
+ mWallpaperOffset.setVerticalCatchupConstant(isLandscape ? 0.65f : 0.65f);
mWallpaperOffset.setOverrideHorizontalCatchupConstant(true);
}
break;