Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 2d58471e authored by Winson Chung's avatar Winson Chung
Browse files

Reducing calls to onCreateViewHolder due to animating children.

Bug 21133230

Change-Id: Ib5be0766d1ea56976195e33526d7595a16672eef
parent 2a1580ca
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -118,6 +118,7 @@ public class WidgetCell extends LinearLayout implements OnLayoutChangeListener {
        if (DEBUG) {
            Log.d(TAG, "reset called on:" + mWidgetName.getText());
        }
        mWidgetImage.animate().cancel();
        mWidgetImage.setImageDrawable(null);
        mWidgetName.setText(null);
        mWidgetDims.setText(null);
+9 −0
Original line number Diff line number Diff line
@@ -185,6 +185,15 @@ public class WidgetsListAdapter extends Adapter<WidgetsRowViewHolder> {
        }
    }

    @Override
    public boolean onFailedToRecycleView(WidgetsRowViewHolder holder) {
        // If child views are animating, then the RecyclerView may choose not to recycle the view,
        // causing extraneous onCreateViewHolder() calls.  It is safe in this case to continue
        // recycling this view, and take care in onViewRecycled() to cancel any existing
        // animations.
        return true;
    }

    @Override
    public long getItemId(int pos) {
        return pos;