Bug 1350718 - Part 2: Remove the add animation for the TabsLayout list. r=maliu, a=gchang
authorTom Klein <twointofive@gmail.com>
Thu, 30 Mar 2017 23:16:19 -0500
changeset 375922 5fd6b9f3af92f8ced6700bd213a038e82988a972
parent 375921 23e8c43d48b36b1306d4d116d9cbfa7ab28a6d81
child 375923 0c01486f23816345b21695f08af48196bcd82347
push id11058
push userryanvm@gmail.com
push dateFri, 14 Apr 2017 20:06:37 +0000
treeherdermozilla-aurora@e53f7f1785eb [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersmaliu, gchang
bugs1350718
milestone54.0a2
Bug 1350718 - Part 2: Remove the add animation for the TabsLayout list. r=maliu, a=gchang 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.
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();
-    }
 }