diff options
author | Adam Cohen <adamcohen@google.com> | 2013-10-09 14:47:32 -0700 |
---|---|---|
committer | Adam Cohen <adamcohen@google.com> | 2013-10-09 14:48:01 -0700 |
commit | 564a2e7116b026c1d73829e65d47b660b03a3c72 (patch) | |
tree | fc754c1b446bc29bc4acefd73ab07f219522aa02 /src/com/android/launcher3/PagedView.java | |
parent | fbdf42703c02f27105e67776a022db2c080dd5db (diff) | |
download | android_packages_apps_Trebuchet-564a2e7116b026c1d73829e65d47b660b03a3c72.tar.gz android_packages_apps_Trebuchet-564a2e7116b026c1d73829e65d47b660b03a3c72.tar.bz2 android_packages_apps_Trebuchet-564a2e7116b026c1d73829e65d47b660b03a3c72.zip |
Fix custom content state for scroll in RTL (issue 11068877)
Change-Id: I731c55e3e4e01ef42eba94c002d0fde296dd9540
Diffstat (limited to 'src/com/android/launcher3/PagedView.java')
-rw-r--r-- | src/com/android/launcher3/PagedView.java | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/com/android/launcher3/PagedView.java b/src/com/android/launcher3/PagedView.java index c6cf3a3d0..2a339c039 100644 --- a/src/com/android/launcher3/PagedView.java +++ b/src/com/android/launcher3/PagedView.java @@ -1528,6 +1528,19 @@ public abstract class PagedView extends ViewGroup implements ViewGroup.OnHierarc } } + // While layout transitions are occurring, a child's position may stray from its baseline + // position. This method returns the magnitude of this stray at any given time. + public int getLayoutTransitionOffsetForPage(int index) { + if (mPageScrolls == null || index >= mPageScrolls.length || index < 0) { + return 0; + } else { + View child = getChildAt(index); + int scrollOffset = (getViewportWidth() - child.getMeasuredWidth()) / 2; + int baselineX = mPageScrolls[index] + scrollOffset + getViewportOffsetX(); + return (int) (child.getX() - baselineX); + } + } + // This curve determines how the effect of scrolling over the limits of the page dimishes // as the user pulls further and further from the bounds private float overScrollInfluenceCurve(float f) { |