summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDanesh M <daneshm90@gmail.com>2014-05-08 19:38:35 (GMT)
committerDanesh M <daneshm90@gmail.com>2014-05-08 21:15:38 (GMT)
commite1d8965c302938aeeafeaf456348e57f3f8ec417 (patch)
tree616481a8a0e6e6fdd2c9c127388ed98f146892d4
parentf29645157ef778f245bc5b4f198c85ce585bb482 (diff)
downloadandroid_packages_apps_Trebuchet-e1d8965c302938aeeafeaf456348e57f3f8ec417.zip
android_packages_apps_Trebuchet-e1d8965c302938aeeafeaf456348e57f3f8ec417.tar.gz
android_packages_apps_Trebuchet-e1d8965c302938aeeafeaf456348e57f3f8ec417.tar.bz2
Revert "Trebuchet : Fix overscroll overlay issue"
This reverts commit f29645157ef778f245bc5b4f198c85ce585bb482. Change-Id: Iad637a25ab51ee60bf7a8b3a040abe7d5b709789
-rw-r--r--src/com/android/launcher3/AppsCustomizePagedView.java29
1 files changed, 29 insertions, 0 deletions
diff --git a/src/com/android/launcher3/AppsCustomizePagedView.java b/src/com/android/launcher3/AppsCustomizePagedView.java
index 882cd9d..7e67f7c 100644
--- a/src/com/android/launcher3/AppsCustomizePagedView.java
+++ b/src/com/android/launcher3/AppsCustomizePagedView.java
@@ -233,6 +233,8 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
// Relating to the scroll and overscroll effects
private static float TRANSITION_MAX_ROTATION = 22;
private static final float ALPHA_CUTOFF_THRESHOLD = 0.01f;
+ private boolean mOverscrollTransformsSet;
+ private float mLastOverscrollPivotX;
public static boolean DISABLE_ALL_APPS = false;
@@ -1487,15 +1489,42 @@ public class AppsCustomizePagedView extends PagedViewWithDraggableItems implemen
if (isInOverscroll) {
int index = 0;
+ float pivotX = 0f;
+ final float leftBiasedPivot = 0.35f;
+ final float rightBiasedPivot = 0.65f;
final int lowerIndex = 0;
final int upperIndex = getChildCount() - 1;
final boolean isLeftPage = mOverScrollX < 0;
index = (!isRtl && isLeftPage) || (isRtl && !isLeftPage) ? lowerIndex : upperIndex;
+ pivotX = isLeftPage ? rightBiasedPivot : leftBiasedPivot;
+
View v = getPageAt(index);
+
+ if (!mOverscrollTransformsSet || Float.compare(mLastOverscrollPivotX, pivotX) != 0) {
+ mOverscrollTransformsSet = true;
+ mLastOverscrollPivotX = pivotX;
+ v.setCameraDistance(mDensity * mCameraDistance);
+ v.setPivotX(v.getMeasuredWidth() * pivotX);
+ }
+
float scrollProgress = getScrollProgress(screenCenter, v, index);
float rotation = -TRANSITION_MAX_ROTATION * scrollProgress;
v.setRotationY(rotation);
+ } else {
+ if (mOverscrollTransformsSet) {
+ mOverscrollTransformsSet = false;
+ View v0 = getPageAt(0);
+ View v1 = getPageAt(getChildCount() - 1);
+ v0.setRotationY(0);
+ v1.setRotationY(0);
+ v0.setCameraDistance(mDensity * mCameraDistance);
+ v1.setCameraDistance(mDensity * mCameraDistance);
+ v0.setPivotX(v0.getMeasuredWidth() / 2);
+ v1.setPivotX(v1.getMeasuredWidth() / 2);
+ v0.setPivotY(v0.getMeasuredHeight() / 2);
+ v1.setPivotY(v1.getMeasuredHeight() / 2);
+ }
}
}