Commit 6facfc10 authored by David Trainor's avatar David Trainor Committed by Commit Bot

Allow Downloads Home v2 RecyclerView to reuse holders

It turns out that only setting the change animation duration to 0
doesn't tell the default ItemAnimator that it can reuse ViewHolders.
This is because it still attempts to animate between the old and new
ViewHolder Views.  Setting a payload seems to bypass this as well
though.

This patch disables change animations completely for the Download Home
v2 RecyclerView ItemAnimator.

Change-Id: I633b6408a73c55da26a608d07ec564bf82737ee5
Reviewed-on: https://chromium-review.googlesource.com/c/1260125Reviewed-by: default avatarTheresa <twellington@chromium.org>
Commit-Queue: David Trainor <dtrainor@chromium.org>
Cr-Commit-Position: refs/heads/master@{#596727}
parent bac08105
......@@ -7,6 +7,7 @@ package org.chromium.chrome.browser.download.home.list;
import android.content.Context;
import android.graphics.Rect;
import android.support.annotation.Nullable;
import android.support.v7.widget.DefaultItemAnimator;
import android.support.v7.widget.GridLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.support.v7.widget.RecyclerView.ItemDecoration;
......@@ -77,7 +78,7 @@ class DateOrderedListView {
mView = new RecyclerView(context);
mView.setHasFixedSize(true);
mView.getItemAnimator().setChangeDuration(0);
((DefaultItemAnimator) mView.getItemAnimator()).setSupportsChangeAnimations(false);
mView.getItemAnimator().setMoveDuration(0);
mView.setLayoutManager(new GridLayoutManagerImpl(context));
mView.addItemDecoration(new ItemDecorationImpl());
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment