summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSunny Goyal <sunnygoyal@google.com>2016-06-06 14:20:22 -0700
committerSunny Goyal <sunnygoyal@google.com>2016-06-08 15:13:53 -0700
commit1fa6b9499b4cf435c41e52d76bc74a2ce6121d40 (patch)
tree734cddb28ed5062503180e3ef0c4b471f662efc9
parentab06999a70c773ffbc0aadaf938e0e90f8ca09b2 (diff)
downloadandroid_packages_apps_Trebuchet-1fa6b9499b4cf435c41e52d76bc74a2ce6121d40.tar.gz
android_packages_apps_Trebuchet-1fa6b9499b4cf435c41e52d76bc74a2ce6121d40.tar.bz2
android_packages_apps_Trebuchet-1fa6b9499b4cf435c41e52d76bc74a2ce6121d40.zip
When the active page changes, simulate a scroll change.
This prevents the animation progess from going out of sync of the active page, when the active page changes before the total number of pages change Bug: 29113836 Change-Id: I2b12ea29d64dc98d773e6060de4b655d3f975b5a
-rw-r--r--src/com/android/launcher3/pageindicators/PageIndicatorDots.java12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
index 7d84a0c76..99af93bf6 100644
--- a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
+++ b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
@@ -24,7 +24,6 @@ import android.animation.ValueAnimator;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.content.Context;
import android.graphics.Canvas;
-import android.view.animation.Interpolator;
import android.graphics.Outline;
import android.graphics.Paint;
import android.graphics.Paint.Style;
@@ -33,6 +32,7 @@ import android.util.AttributeSet;
import android.util.Property;
import android.view.View;
import android.view.ViewOutlineProvider;
+import android.view.animation.Interpolator;
import android.view.animation.OvershootInterpolator;
import com.android.launcher3.R;
@@ -224,8 +224,14 @@ public class PageIndicatorDots extends PageIndicator {
@Override
public void setActiveMarker(int activePage) {
- mActivePage = activePage;
- invalidate();
+ if (mActivePage != activePage) {
+ mActivePage = activePage;
+
+ // Simulate a scroll change
+ int totalScroll = mNumPages - 1;
+ int currentScroll = mIsRtl ? (totalScroll - mActivePage) : mActivePage;
+ setScroll(currentScroll, totalScroll);
+ }
}
@Override