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
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