Bug 1350718 - 2. Remove the add animation for the TabsLayout list. r?maliu draft
authorTom Klein <twointofive@gmail.com>
Thu, 30 Mar 2017 23:16:19 -0500
changeset 557337 a190c4e528811d01be4f0d7773adb406d9c86309
parent 557336 5e4bfd425b8dc3b79e9eff1b00cb310800dae0c7
child 557338 2d664a8df58a3aa7c2f2c9a6db030df7d08ac93a
push id52689
push userbmo:twointofive@gmail.com
push dateThu, 06 Apr 2017 17:27: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();
-    }
 }