OSDN Git Service

Adding workaround to jump in wallpaper offsets.
authorWinson <winsonc@google.com>
Tue, 2 Aug 2016 19:03:34 +0000 (12:03 -0700)
committerArne Coucheron <arco68@gmail.com>
Fri, 26 May 2017 22:15:02 +0000 (00:15 +0200)
- Just skip the animation if we are animating to the same wallpaper
  offset (which is the case when we are adding from all apps)

Bug: 28587903
Change-Id: Ib7b1828c1b099a665d68c22cb33ee62693f33f35

src/com/android/launcher3/Workspace.java

index 7252ca4..0672286 100644 (file)
@@ -1536,8 +1536,9 @@ public class Workspace extends PagedView
             scheduleUpdate();
             mFinalOffset = Math.max(0f, Math.min(x, 1.0f));
             if (getNumScreensExcludingEmptyAndCustom() != mNumScreens) {
-                if (mNumScreens > 0) {
-                    // Don't animate if we're going from 0 screens
+                if (mNumScreens > 0 && Float.compare(mCurrentOffset, mFinalOffset) != 0) {
+                    // Don't animate if we're going from 0 screens, or if the final offset is the same
+                    // as the current offset
                     animateToFinal();
                 }
                 mNumScreens = getNumScreensExcludingEmptyAndCustom();