Bug 1350718 - 2. Remove the add animation for the TabsLayout list. r=maliu
authorTom Klein <twointofive@gmail.com>
Thu, 30 Mar 2017 23:16:19 -0500
changeset 558333 63b5915ed9bcd57c128f2424ae68f2226e4cdf15
parent 558332 a3ea0d4a3c2e691fac654ff4e53fbf85ebfbf8bf
child 558334 d544c4b2b56bc52233f263ca8a0b3b6723a81dc5
push id52860
push userbmo:walkingice0204@gmail.com
push dateFri, 07 Apr 2017 13:29:26 +0000
reviewersmaliu
bugs1350718
milestone55.0a1
Bug 1350718 - 2. Remove the add animation for the TabsLayout list. r=maliu Based on what I'm seeing, if you call scrollToPosition and that causes you to "scroll into view" (remember, scrollToPosition doesn't actually scroll, it just redraws the new position) one or more positions, then RecyclerView runs the add animation on all those views "scrolled onto screen", which, for the list view's slide-in-from-the-right add animation, looks silly (I think). [Caveat: RecyclerView sometimes keeps one offscreen view ready to go, which doesn't seem to get the add animation.] In non open-tab-from-another-app-with-the-tabs-tray-already-open operations this was never an issue because either those animations are hidden by the panel being animated into view when the panel opens and we scroll to the selected position [at least that's my guess], or we only scroll by at most one, as in the case of a tab close or undo close. But in the open-a-tab-and-scroll-to-it-while-the-tabs-tray-is-already-open case that we can get with opening a tab from another app, the add animation runs for however many tabs "need to be added" between the current position and the new tab; sometimes the animation still gets hidden if the new tabs get added quickly enough when fennec reloads [again, my guess], but on my device I always see the animations if I open a tab in tab queue and then reopen Fennec by hand, whereas on an emulator I see the animations in additional external-app-open cases as well. MozReview-Commit-ID: J3x0bBLPNyz
mobile/android/base/java/org/mozilla/gecko/tabs/TabsListLayoutAnimator.java
--- a/mobile/android/base/java/org/mozilla/gecko/tabs/TabsListLayoutAnimator.java
+++ b/mobile/android/base/java/org/mozilla/gecko/tabs/TabsListLayoutAnimator.java
@@ -37,29 +37,9 @@ class TabsListLayoutAnimator extends Def
         final View itemView = holder.itemView;
         ViewCompat.animate(itemView)
                 .setDuration(getRemoveDuration())
                 .translationX(itemView.getWidth())
                 .alpha(0)
                 .setListener(new DefaultRemoveVpaListener(holder))
                 .start();
     }
-
-    @Override
-    protected boolean preAnimateAddImpl(RecyclerView.ViewHolder holder) {
-        resetAnimation(holder);
-        final View itemView = holder.itemView;
-        itemView.setTranslationX(itemView.getWidth());
-        itemView.setAlpha(0);
-        return true;
-    }
-
-    @Override
-    protected void animateAddImpl(final RecyclerView.ViewHolder holder) {
-        final View itemView = holder.itemView;
-        ViewCompat.animate(itemView)
-                .setDuration(getAddDuration())
-                .translationX(0)
-                .alpha(1)
-                .setListener(new DefaultAddVpaListener(holder))
-                .start();
-    }
 }