ViewHolder — Fancy Reserve Re add to ViewGroup hide from LM for each disappearing child animate child onAnimationFinished onViewDetachedFromWindow cache or recycle ItemAnimator
are licensed by CC 3.0 BY Why it didn’t cache? • Too many ViewHolders of the same type How come? • Animate cross fade for all views • notifyItemChanged(0, getItemCount)) How to fix? • Granular updates (notifyDataSetChanged(3)) • pool.setMaxRecycledViews(type, count)
3.0 BY Drag and Swipe ItemTouchHelper - supports both swipe and drag, together if you please - per ViewHolder val callback = SimpleItemTouchHelperCallback(adapter) val touchHelper = ItemTouchHelper(callback) touchHelper.attachToRecyclerView(recyclerView) https://medium.com/@ipaulpro/drag-and-swipe-with-recyclerview-b9456d2b1aaf
3.0 BY DiffUtil • calculates the difference between two given lists • O(N) space to find adds and removes • O(N + D^2) time • plus O(N^2) time to detect moves random UUID Strings, Nexus 5X with M: • 100 items and 10 modifications: avg: 0.39 ms, median: 0.35 ms • 100 items and 100 modifications: 3.82 ms, median: 3.75 ms • 100 items and 100 modifications without moves: 2.09 ms, median: 2.06 ms • 1000 items and 50 modifications: avg: 4.67 ms, median: 4.59 ms • 1000 items and 50 modifications without moves: avg: 3.59 ms, median: 3.50 ms • 1000 items and 200 modifications: 27.07 ms, median: 26.92 ms • 1000 items and 200 modifications without moves: 13.54 ms, median: 13.36 ms https://developer.android.com/reference/android/support/v7/util/DiffUtil.html
3.0 BY More info • RecyclerView ins and outs by Adam Powell & Yigit Boyar — https://youtu.be/LqBlYJTfLP4 • Pro RecyclerView by Yigit Boyar— https://youtu.be/KhLVD6iiZQs • Radical RecyclerView by Lisa Wray — https://youtu.be/TS_J0Qw4zl0 • 032. RecyclerView 13000 by Артур Василов — https://youtu.be/860_Y5TXh1Y