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
am: 1fa6b9499b

Change-Id: Ie7e6487d790510cb794e8f2b13c46b9eccb4f103
diff --git a/src/com/android/launcher3/pageindicators/PageIndicatorDots.java b/src/com/android/launcher3/pageindicators/PageIndicatorDots.java
index 7d84a0c..99af93b 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.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.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 @@
 
     @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