summaryrefslogtreecommitdiffstats
path: root/src/com
diff options
context:
space:
mode:
authorAdam Cohen <adamcohen@google.com>2010-09-29 13:02:43 -0700
committerAdam Cohen <adamcohen@google.com>2010-09-29 13:04:32 -0700
commit0fb7db5a3771223bc86fdf0e01665e69c1309cc1 (patch)
tree032c664a02611f0820e1d85f21d898844c3e812a /src/com
parentde7658b5e02ae10010e44fcf8d9c5814f54d9eb0 (diff)
downloadandroid_packages_apps_Trebuchet-0fb7db5a3771223bc86fdf0e01665e69c1309cc1.tar.gz
android_packages_apps_Trebuchet-0fb7db5a3771223bc86fdf0e01665e69c1309cc1.tar.bz2
android_packages_apps_Trebuchet-0fb7db5a3771223bc86fdf0e01665e69c1309cc1.zip
Fixing boot stall.
Revert "-Added 3D effect to home screen scrolling" This reverts commit 9415d87eda0cf28b8df1eccde39b0ca1646be3b9. Change-Id: Ib8d6602f5d82884eb1f6cc44c0cc71cc563a3a59
Diffstat (limited to 'src/com')
-rw-r--r--src/com/android/launcher2/CellLayout.java42
-rw-r--r--src/com/android/launcher2/Dimmable.java6
-rw-r--r--src/com/android/launcher2/DimmableAppWidgetHostView.java60
-rw-r--r--src/com/android/launcher2/DimmableBubbleTextView.java57
-rw-r--r--src/com/android/launcher2/PagedView.java14
-rw-r--r--src/com/android/launcher2/SmoothPagedView.java58
-rw-r--r--src/com/android/launcher2/Workspace.java146
7 files changed, 122 insertions, 261 deletions
diff --git a/src/com/android/launcher2/CellLayout.java b/src/com/android/launcher2/CellLayout.java
index 943d61b5d..b35be871f 100644
--- a/src/com/android/launcher2/CellLayout.java
+++ b/src/com/android/launcher2/CellLayout.java
@@ -42,7 +42,7 @@ import android.view.animation.LayoutAnimationController;
import java.util.Arrays;
-public class CellLayout extends ViewGroup implements Dimmable {
+public class CellLayout extends ViewGroup {
static final String TAG = "CellLayout";
private int mCellWidth;
@@ -75,10 +75,8 @@ public class CellLayout extends ViewGroup implements Dimmable {
private float mBackgroundAlpha;
private final Rect mBackgroundLayoutRect = new Rect();
-
private Drawable mBackground;
- private Drawable mBackgroundMini;
- private Drawable mBackgroundMiniHover;
+ private Drawable mBackgroundHover;
// If we're actively dragging something over this screen and it's small,
// mHover is true
private boolean mHover = false;
@@ -139,12 +137,10 @@ public class CellLayout extends ViewGroup implements Dimmable {
if (LauncherApplication.isScreenXLarge()) {
final Resources res = getResources();
- mBackgroundMini = res.getDrawable(R.drawable.mini_home_screen_bg);
- mBackgroundMini.setFilterBitmap(true);
mBackground = res.getDrawable(R.drawable.home_screen_bg);
mBackground.setFilterBitmap(true);
- mBackgroundMiniHover = res.getDrawable(R.drawable.mini_home_screen_bg_hover);
- mBackgroundMiniHover.setFilterBitmap(true);
+ mBackgroundHover = res.getDrawable(R.drawable.mini_home_screen_bg_hover);
+ mBackgroundHover.setFilterBitmap(true);
mDragRectDrawable = res.getDrawable(R.drawable.rounded_rect_green);
mCrosshairsDrawable = res.getDrawable(R.drawable.gardening_crosshairs);
@@ -180,14 +176,7 @@ public class CellLayout extends ViewGroup implements Dimmable {
@Override
public void dispatchDraw(Canvas canvas) {
if (mBackgroundAlpha > 0.0f) {
- Drawable bg;
- if (mHover && getScaleX() < 0.5f) {
- bg = mBackgroundMiniHover;
- } else if (getScaleX() < 0.5f) {
- bg = mBackgroundMini;
- } else {
- bg = mBackground;
- }
+ final Drawable bg = mHover ? mBackgroundHover : mBackground;
bg.setAlpha((int) (mBackgroundAlpha * 255));
bg.draw(canvas);
}
@@ -239,20 +228,6 @@ public class CellLayout extends ViewGroup implements Dimmable {
}
}
- public void setDimmableProgress(float progress) {
- for (int i = 0; i < getChildCount(); i++) {
- Dimmable d = (Dimmable) getChildAt(i);
- d.setDimmableProgress(progress);
- }
- }
-
- public float getDimmableProgress() {
- if (getChildCount() > 0) {
- return ((Dimmable) getChildAt(0)).getDimmableProgress();
- }
- return 0.0f;
- }
-
@Override
public void cancelLongPress() {
super.cancelLongPress();
@@ -606,11 +581,8 @@ public class CellLayout extends ViewGroup implements Dimmable {
if (mBackground != null) {
mBackground.setBounds(mBackgroundLayoutRect);
}
- if (mBackgroundMiniHover != null) {
- mBackgroundMiniHover.setBounds(mBackgroundLayoutRect);
- }
- if (mBackgroundMini != null) {
- mBackgroundMini.setBounds(mBackgroundLayoutRect);
+ if (mBackgroundHover != null) {
+ mBackgroundHover.setBounds(mBackgroundLayoutRect);
}
}
diff --git a/src/com/android/launcher2/Dimmable.java b/src/com/android/launcher2/Dimmable.java
deleted file mode 100644
index df43b3c8e..000000000
--- a/src/com/android/launcher2/Dimmable.java
+++ /dev/null
@@ -1,6 +0,0 @@
-package com.android.launcher2;
-
-public interface Dimmable {
- public void setDimmableProgress(float progress);
- public float getDimmableProgress();
-}
diff --git a/src/com/android/launcher2/DimmableAppWidgetHostView.java b/src/com/android/launcher2/DimmableAppWidgetHostView.java
index 1f512a3f9..7a1d4f9da 100644
--- a/src/com/android/launcher2/DimmableAppWidgetHostView.java
+++ b/src/com/android/launcher2/DimmableAppWidgetHostView.java
@@ -21,21 +21,52 @@ import com.android.launcher.R;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.view.View;
-public class DimmableAppWidgetHostView extends LauncherAppWidgetHostView implements Dimmable {
+public class DimmableAppWidgetHostView extends LauncherAppWidgetHostView {
public DimmableAppWidgetHostView(Context context) {
super(context);
mPaint.setFilterBitmap(true);
}
private final Paint mPaint = new Paint();
+ private int mAlpha;
+ private int mDimmedAlpha;
private Bitmap mDimmedView;
private Canvas mDimmedViewCanvas;
private boolean isDimmedViewUpdatePass;
- private float mDimmableProgress;
+
+ private static float cubic(float r) {
+ return (float) (Math.pow(r-1, 3) + 1);
+ }
+
+ /**
+ * Returns the interpolated holographic highlight alpha for the effect we want when scrolling
+ * pages.
+ */
+ public static float highlightAlphaInterpolator(float r) {
+ final float pivot = 0.3f;
+ if (r < pivot) {
+ return Math.max(0.5f, 0.65f*cubic(r/pivot));
+ } else {
+ return Math.min(1.0f, 0.65f*cubic(1 - (r-pivot)/(1-pivot)));
+ }
+ }
+
+ /**
+ * Returns the interpolated view alpha for the effect we want when scrolling pages.
+ */
+ public static float viewAlphaInterpolator(float r) {
+ final float pivot = 0.6f;
+ if (r < pivot) {
+ return r/pivot;
+ } else {
+ return 1.0f;
+ }
+ }
private void setChildAlpha(float alpha) {
if (getChildCount() > 0) {
@@ -52,18 +83,20 @@ public class DimmableAppWidgetHostView extends LauncherAppWidgetHostView impleme
setChildAlpha(getAlpha());
}
- //@Override
+ @Override
public boolean onSetAlpha(int alpha) {
super.onSetAlpha(alpha);
return true;
}
- public void setDimmableProgress(float progress) {
- mDimmableProgress = progress;
- }
-
- public float getDimmableProgress() {
- return mDimmableProgress;
+ @Override
+ public void setAlpha(float alpha) {
+ final float viewAlpha = viewAlphaInterpolator(alpha);
+ final float dimmedAlpha = highlightAlphaInterpolator(alpha);
+ mAlpha = (int) (viewAlpha * 255);
+ mDimmedAlpha = (int) (dimmedAlpha * 255);
+ super.setAlpha(viewAlpha);
+ setChildAlpha(viewAlpha);
}
private void updateDimmedView() {
@@ -80,14 +113,13 @@ public class DimmableAppWidgetHostView extends LauncherAppWidgetHostView impleme
int dimmedColor = getContext().getResources().getColor(R.color.dimmed_view_color);
mDimmedViewCanvas.drawColor(dimmedColor, PorterDuff.Mode.SRC_IN);
isDimmedViewUpdatePass = false;
- invalidate();
}
@Override
protected void onLayout(boolean changed, int left, int top, int right, int bottom) {
super.onLayout(changed, left, top, right, bottom);
- if (mDimmedView == null && mDimmableProgress > 0.0f) {
+ if (mDimmedView == null && mDimmedAlpha > 0.0f) {
updateDimmedView();
}
}
@@ -102,9 +134,9 @@ public class DimmableAppWidgetHostView extends LauncherAppWidgetHostView impleme
canvas.restore();
setAlpha(alpha);
} else {
- if (mDimmedView != null && mDimmableProgress > 0) {
+ if (mDimmedView != null && mDimmedAlpha > 0) {
// draw the dimmed version of this widget
- mPaint.setAlpha((int) (mDimmableProgress * 255));
+ mPaint.setAlpha(mDimmedAlpha);
canvas.drawBitmap(mDimmedView, 0, 0, mPaint);
}
@@ -112,4 +144,4 @@ public class DimmableAppWidgetHostView extends LauncherAppWidgetHostView impleme
super.dispatchDraw(canvas);
}
}
-}
+} \ No newline at end of file
diff --git a/src/com/android/launcher2/DimmableBubbleTextView.java b/src/com/android/launcher2/DimmableBubbleTextView.java
index cb3b8efd6..66cc97a1b 100644
--- a/src/com/android/launcher2/DimmableBubbleTextView.java
+++ b/src/com/android/launcher2/DimmableBubbleTextView.java
@@ -21,17 +21,18 @@ import com.android.launcher.R;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
+import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.PorterDuff;
import android.util.AttributeSet;
-public class DimmableBubbleTextView extends BubbleTextView implements Dimmable {
+public class DimmableBubbleTextView extends BubbleTextView {
private Paint mDimmedPaint = new Paint();
private int mAlpha;
+ private int mDimmedAlpha;
private Bitmap mDimmedView;
private Canvas mDimmedViewCanvas;
private boolean isDimmedViewUpdatePass;
- private float mDimmableProgress;
public DimmableBubbleTextView(Context context) {
super(context);
@@ -48,12 +49,48 @@ public class DimmableBubbleTextView extends BubbleTextView implements Dimmable {
mDimmedPaint.setFilterBitmap(true);
}
- public void setDimmableProgress(float progress) {
- mDimmableProgress = progress;
+ private static float cubic(float r) {
+ return (float) (Math.pow(r-1, 3) + 1);
}
- public float getDimmableProgress() {
- return mDimmableProgress;
+ /**
+ * Returns the interpolated holographic highlight alpha for the effect we want when scrolling
+ * pages.
+ */
+ public static float highlightAlphaInterpolator(float r) {
+ final float pivot = 0.3f;
+ if (r < pivot) {
+ return Math.max(0.5f, 0.65f*cubic(r/pivot));
+ } else {
+ return Math.min(1.0f, 0.65f*cubic(1 - (r-pivot)/(1-pivot)));
+ }
+ }
+
+ /**
+ * Returns the interpolated view alpha for the effect we want when scrolling pages.
+ */
+ public static float viewAlphaInterpolator(float r) {
+ final float pivot = 0.6f;
+ if (r < pivot) {
+ return r/pivot;
+ } else {
+ return 1.0f;
+ }
+ }
+
+ @Override
+ public boolean onSetAlpha(int alpha) {
+ super.onSetAlpha(alpha);
+ return true;
+ }
+
+ @Override
+ public void setAlpha(float alpha) {
+ final float viewAlpha = viewAlphaInterpolator(alpha);
+ final float dimmedAlpha = highlightAlphaInterpolator(alpha);
+ mAlpha = (int) (viewAlpha * 255);
+ mDimmedAlpha = (int) (dimmedAlpha * 255);
+ super.setAlpha(viewAlpha);
}
@Override
@@ -87,11 +124,13 @@ public class DimmableBubbleTextView extends BubbleTextView implements Dimmable {
super.setAlpha(alpha);
canvas.restore();
} else {
- super.onDraw(canvas);
+ if (mAlpha > 0) {
+ super.onDraw(canvas);
+ }
}
- if (mDimmedView != null && mDimmableProgress > 0) {
- mDimmedPaint.setAlpha((int) (mDimmableProgress * 255));
+ if (mDimmedView != null && mDimmedAlpha > 0) {
+ mDimmedPaint.setAlpha(mDimmedAlpha);
canvas.drawBitmap(mDimmedView, mScrollX, mScrollY, mDimmedPaint);
}
}
diff --git a/src/com/android/launcher2/PagedView.java b/src/com/android/launcher2/PagedView.java
index 4e47acb40..5aec48ebe 100644
--- a/src/com/android/launcher2/PagedView.java
+++ b/src/com/android/launcher2/PagedView.java
@@ -78,7 +78,6 @@ public abstract class PagedView extends ViewGroup {
protected final static int TOUCH_STATE_SCROLLING = 1;
protected final static int TOUCH_STATE_PREV_PAGE = 2;
protected final static int TOUCH_STATE_NEXT_PAGE = 3;
- protected final static float ALPHA_QUANTIZE_LEVEL = 0.01f;
protected int mTouchState = TOUCH_STATE_REST;
@@ -368,6 +367,7 @@ public abstract class PagedView extends ViewGroup {
if (mDirtyPageAlpha || (mTouchState == TOUCH_STATE_SCROLLING) || !mScroller.isFinished()) {
int halfScreenSize = getMeasuredWidth() / 2;
int screenCenter = mScrollX + halfScreenSize;
+
final int childCount = getChildCount();
for (int i = 0; i < childCount; ++i) {
View layout = (View) getChildAt(i);
@@ -391,12 +391,6 @@ public abstract class PagedView extends ViewGroup {
dimAlpha = Math.max(0.0f, Math.min(1.0f, (dimAlpha * dimAlpha)));
float alpha = 1.0f - dimAlpha;
- if (alpha < ALPHA_QUANTIZE_LEVEL) {
- alpha = 0.0f;
- } else if (alpha > 1.0f - ALPHA_QUANTIZE_LEVEL) {
- alpha = 1.0f;
- }
-
if (Float.compare(alpha, layout.getAlpha()) != 0) {
layout.setAlpha(alpha);
}
@@ -406,16 +400,10 @@ public abstract class PagedView extends ViewGroup {
}
}
- protected void screenScrolled(int screenCenter) {
- }
-
@Override
protected void dispatchDraw(Canvas canvas) {
updateAdjacentPagesAlpha();
- int halfScreenSize = getMeasuredWidth() / 2;
- int screenCenter = mScrollX + halfScreenSize;
- screenScrolled(screenCenter);
// Find out which screens are visible; as an optimization we only call draw on them
// As an optimization, this code assumes that all pages have the same width as the 0th
// page.
diff --git a/src/com/android/launcher2/SmoothPagedView.java b/src/com/android/launcher2/SmoothPagedView.java
index 56037ffb8..5f80f2587 100644
--- a/src/com/android/launcher2/SmoothPagedView.java
+++ b/src/com/android/launcher2/SmoothPagedView.java
@@ -26,15 +26,11 @@ public abstract class SmoothPagedView extends PagedView {
private static final float SMOOTHING_SPEED = 0.75f;
private static final float SMOOTHING_CONSTANT = (float) (0.016 / Math.log(SMOOTHING_SPEED));
- private float mBaseLineFlingVelocity;
- private float mFlingVelocityInfluence;
- static final int OVERSHOOT_MODE = 0;
- static final int QUINTIC_MODE = 1;
+ private static final float BASELINE_FLING_VELOCITY = 2500.f;
+ private static final float FLING_VELOCITY_INFLUENCE = 0.4f;
- int mScrollMode;
-
- private Interpolator mScrollInterpolator;
+ private WorkspaceOvershootInterpolator mScrollInterpolator;
private static class WorkspaceOvershootInterpolator implements Interpolator {
private static final float DEFAULT_TENSION = 1.3f;
@@ -60,16 +56,6 @@ public abstract class SmoothPagedView extends PagedView {
}
}
- private static class QuinticInterpolator implements Interpolator {
- public QuinticInterpolator() {
- }
-
- public float getInterpolation(float t) {
- t -= 1.0f;
- return t*t*t*t*t + 1;
- }
- }
-
/**
* Used to inflate the Workspace from XML.
*
@@ -97,27 +83,14 @@ public abstract class SmoothPagedView extends PagedView {
mDeferScrollUpdate = true;
}
- protected int getScrollMode() {
- return OVERSHOOT_MODE;
- }
-
/**
* Initializes various states for this workspace.
*/
@Override
protected void init() {
super.init();
-
- mScrollMode = getScrollMode();
- if (mScrollMode == QUINTIC_MODE) {
- mBaseLineFlingVelocity = 700.0f;
- mFlingVelocityInfluence = 0.8f;
- mScrollInterpolator = new QuinticInterpolator();
- } else { // QUINTIC_MODE
- mBaseLineFlingVelocity = 2500.0f;
- mFlingVelocityInfluence = 0.4f;
- mScrollInterpolator = new WorkspaceOvershootInterpolator();
- }
+ mScrollInterpolator = new WorkspaceOvershootInterpolator();
+ // overwrite the previous mScroller
mScroller = new Scroller(getContext(), mScrollInterpolator);
}
@@ -139,32 +112,25 @@ public abstract class SmoothPagedView extends PagedView {
final int screenDelta = Math.max(1, Math.abs(whichPage - mCurrentPage));
final int newX = getChildOffset(whichPage) - getRelativeChildOffset(whichPage);
final int delta = newX - mScrollX;
- int duration;
- if (mScrollMode == OVERSHOOT_MODE) {
- duration = (screenDelta + 1) * 100;
- } else { // QUINTIC_MODE
- duration = Math.round(Math.abs(delta) * 0.6f);
- }
+ int duration = (screenDelta + 1) * 100;
if (!mScroller.isFinished()) {
mScroller.abortAnimation();
}
- if (mScrollMode == OVERSHOOT_MODE) {
- if (settle) {
- ((WorkspaceOvershootInterpolator) mScrollInterpolator).setDistance(screenDelta);
- } else {
- ((WorkspaceOvershootInterpolator) mScrollInterpolator).disableSettle();
- }
+ if (settle) {
+ mScrollInterpolator.setDistance(screenDelta);
+ } else {
+ mScrollInterpolator.disableSettle();
}
velocity = Math.abs(velocity);
if (velocity > 0) {
- duration += (duration / (velocity / mBaseLineFlingVelocity)) * mFlingVelocityInfluence;
+ duration += (duration / (velocity / BASELINE_FLING_VELOCITY))
+ * FLING_VELOCITY_INFLUENCE;
} else {
duration += 100;
}
-
snapToPage(whichPage, delta, duration);
}
diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java
index 7c3f2ff70..4d820cf80 100644
--- a/src/com/android/launcher2/Workspace.java
+++ b/src/com/android/launcher2/Workspace.java
@@ -33,9 +33,7 @@ import android.content.pm.PackageManager;
import android.content.pm.ProviderInfo;
import android.content.res.Resources;
import android.content.res.TypedArray;
-import android.graphics.Camera;
import android.graphics.Canvas;
-import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
@@ -65,8 +63,8 @@ public class Workspace extends SmoothPagedView
// customization mode
private static final float SHRINK_FACTOR = 0.16f;
- // Y rotation to apply to the workspace screens
- private static final float WORKSPACE_ROTATION = 12.5f;
+ // The maximum Y rotation to apply to the mini home screens
+ private static final float MINI_PAGE_MAX_ROTATION = 25.0f;
// These are extra scale factors to apply to the mini home screens
// so as to achieve the desired transform
@@ -74,18 +72,6 @@ public class Workspace extends SmoothPagedView
private static final float EXTRA_SCALE_FACTOR_1 = 1.0f;
private static final float EXTRA_SCALE_FACTOR_2 = 1.08f;
- private static final int BACKGROUND_FADE_OUT_DELAY = 300;
- private static final int BACKGROUND_FADE_OUT_DURATION = 300;
- private static final int BACKGROUND_FADE_IN_DURATION = 100;
-
- static final int SCROLL_RIGHT = 0;
- static final int SCROLL_LEFT = 1;
-
- // These animators are used to fade the
- private ObjectAnimator<Float> mBackgroundFadeIn;
- private ObjectAnimator<Float> mBackgroundFadeOut;
- private float mBackgroundAlpha = 0;
-
private enum ShrinkPosition { SHRINK_TO_TOP, SHRINK_TO_MIDDLE, SHRINK_TO_BOTTOM };
private final WallpaperManager mWallpaperManager;
@@ -194,15 +180,6 @@ public class Workspace extends SmoothPagedView
}
@Override
- protected int getScrollMode() {
- if (LauncherApplication.isScreenXLarge()) {
- return SmoothPagedView.QUINTIC_MODE;
- } else {
- return SmoothPagedView.OVERSHOOT_MODE;
- }
- }
-
- @Override
public void addView(View child, int index, LayoutParams params) {
if (!(child instanceof CellLayout)) {
throw new IllegalArgumentException("A Workspace can only have CellLayout children.");
@@ -405,14 +382,12 @@ public class Workspace extends SmoothPagedView
enableChildrenCache(mCurrentPage - 1, mCurrentPage + 1);
}
}
- showOutlines();
}
protected void pageEndMoving() {
if (!LauncherApplication.isScreenXLarge()) {
clearChildrenCache();
}
- hideOutlines();
}
@Override
@@ -449,99 +424,6 @@ public class Workspace extends SmoothPagedView
}
}
- private float getScaleXForRotation(float degrees) {
- return (float) (1.0f / Math.cos(Math.PI * degrees / 180.0f));
- }
-
- public void showOutlines() {
- if (mBackgroundFadeOut != null) mBackgroundFadeOut.cancel();
- if (mBackgroundFadeIn != null) mBackgroundFadeIn.cancel();
- mBackgroundFadeIn = new ObjectAnimator<Float>(BACKGROUND_FADE_IN_DURATION, this,
- new PropertyValuesHolder<Float>("backgroundAlpha", 1.0f));
- mBackgroundFadeIn.start();
- }
-
- public void hideOutlines() {
- if (mBackgroundFadeIn != null) mBackgroundFadeIn.cancel();
- if (mBackgroundFadeOut != null) mBackgroundFadeOut.cancel();
- mBackgroundFadeOut = new ObjectAnimator<Float>(BACKGROUND_FADE_OUT_DURATION, this,
- new PropertyValuesHolder<Float>("backgroundAlpha", 0.0f));
- mBackgroundFadeOut.setStartDelay(BACKGROUND_FADE_OUT_DELAY);
- mBackgroundFadeOut.start();
- }
-
- public void setBackgroundAlpha(float alpha) {
- mBackgroundAlpha = alpha;
- for (int i = 0; i < getChildCount(); i++) {
- CellLayout cl = (CellLayout) getChildAt(i);
- cl.setBackgroundAlpha(alpha);
- }
- }
-
- public float getBackgroundAlpha() {
- return mBackgroundAlpha;
- }
-
- @Override
- protected void screenScrolled(int screenCenter) {
- View cur = getChildAt(mCurrentPage);
- View toRight = getChildAt(mCurrentPage + 1);
- View toLeft = getChildAt(mCurrentPage - 1);
-
- for (int i = 0; i < mCurrentPage - 1; i++) {
- View v = getChildAt(i);
- if (v != null) {
- v.setRotationY(WORKSPACE_ROTATION);
- v.setScaleX(getScaleXForRotation(WORKSPACE_ROTATION));
- }
- }
- for (int i = mCurrentPage + 1; i < getChildCount(); i++) {
- View v = getChildAt(i);
- if (v != null) {
- v.setRotationY(-WORKSPACE_ROTATION);
- v.setScaleX(getScaleXForRotation(-WORKSPACE_ROTATION));
- }
- }
-
- int pageWidth = cur.getMeasuredWidth();
- int delta = screenCenter - (mCurrentPage * pageWidth + pageWidth / 2 +
- getRelativeChildOffset(0));
-
- float scrollProgress = Math.abs(delta/(pageWidth*1.0f));
- int scrollDirection = delta > 0 ? SCROLL_LEFT : SCROLL_RIGHT;
-
- float rotation;
-
- if (scrollDirection == SCROLL_RIGHT) {
- rotation = -scrollProgress * WORKSPACE_ROTATION;
- cur.setRotationY(rotation);
- cur.setScaleX(getScaleXForRotation(rotation));
- if (toLeft != null) {
- rotation = WORKSPACE_ROTATION * (1 - scrollProgress);
- toLeft.setRotationY(rotation);
- toLeft.setScaleX(getScaleXForRotation(rotation));
- }
- if (toRight != null) {
- toRight.setRotationY(-WORKSPACE_ROTATION);
- toRight.setScaleX(getScaleXForRotation(WORKSPACE_ROTATION));
- }
- } else {
- rotation = scrollProgress * WORKSPACE_ROTATION;
- cur.setRotationY(rotation);
- cur.setScaleX(getScaleXForRotation(rotation));
-
- if (toRight != null) {
- rotation = -WORKSPACE_ROTATION * (1 - scrollProgress);
- toRight.setRotationY(rotation);
- toRight.setScaleX(getScaleXForRotation(rotation));
- }
- if (toLeft != null) {
- toLeft.setRotationY(WORKSPACE_ROTATION);
- toLeft.setScaleX(getScaleXForRotation(WORKSPACE_ROTATION));
- }
- }
- }
-
protected void onAttachedToWindow() {
super.onAttachedToWindow();
computeScroll();
@@ -742,7 +624,7 @@ public class Workspace extends SmoothPagedView
for (int i = 0; i < screenCount; i++) {
CellLayout cl = (CellLayout) getChildAt(i);
- float rotation = (-i + 2) * WORKSPACE_ROTATION;
+ float rotation = (-i + 2) * MINI_PAGE_MAX_ROTATION / 2.0f;
float rotationScaleX = (float) (1.0f / Math.cos(Math.PI * rotation / 180.0f));
float rotationScaleY = getYScaleForScreen(i);
@@ -754,16 +636,14 @@ public class Workspace extends SmoothPagedView
new PropertyValuesHolder<Float>("scaleX", SHRINK_FACTOR * rotationScaleX),
new PropertyValuesHolder<Float>("scaleY", SHRINK_FACTOR * rotationScaleY),
new PropertyValuesHolder<Float>("backgroundAlpha", 1.0f),
- new PropertyValuesHolder<Float>("dimmableProgress", 1.0f),
new PropertyValuesHolder<Float>("alpha", 0.0f),
new PropertyValuesHolder<Float>("rotationY", rotation)).start();
} else {
cl.setX((int)newX);
cl.setY((int)newY);
- cl.setScaleX(SHRINK_FACTOR * rotationScaleX);
- cl.setScaleY(SHRINK_FACTOR * rotationScaleY);
+ cl.setScaleX(SHRINK_FACTOR);
+ cl.setScaleY(SHRINK_FACTOR);
cl.setBackgroundAlpha(1.0f);
- cl.setDimmableProgress(1.0f);
cl.setAlpha(0.0f);
cl.setRotationY(rotation);
}
@@ -816,14 +696,6 @@ public class Workspace extends SmoothPagedView
for (int i = 0; i < screenCount; i++) {
final CellLayout cl = (CellLayout)getChildAt(i);
float finalAlphaValue = (i == mCurrentPage) ? 1.0f : 0.0f;
- float rotation = 0.0f;
-
- if (i < mCurrentPage) {
- rotation = WORKSPACE_ROTATION;
- } else if (i > mCurrentPage) {
- rotation = -WORKSPACE_ROTATION;
- }
-
if (animated) {
s.playTogether(
new ObjectAnimator<Float>(duration, cl, "translationX", 0.0f),
@@ -832,17 +704,15 @@ public class Workspace extends SmoothPagedView
new ObjectAnimator<Float>(duration, cl, "scaleY", 1.0f),
new ObjectAnimator<Float>(duration, cl, "backgroundAlpha", 0.0f),
new ObjectAnimator<Float>(duration, cl, "alpha", finalAlphaValue),
- new ObjectAnimator<Float>(duration, cl, "dimmableProgress", 0.0f),
- new ObjectAnimator<Float>(duration, cl, "rotationY", rotation));
+ new ObjectAnimator<Float>(duration, cl, "rotationY", 0.0f));
} else {
cl.setTranslationX(0.0f);
cl.setTranslationY(0.0f);
cl.setScaleX(1.0f);
cl.setScaleY(1.0f);
cl.setBackgroundAlpha(0.0f);
- cl.setDimmableProgress(0.0f);
- cl.setAlpha(finalAlphaValue);
- cl.setRotationY(rotation);
+ cl.setAlpha(1.0f);
+ cl.setRotationY(0.0f);
}
}
s.addListener(mUnshrinkAnimationListener);