Infinum Android Talks #18 - Create fun lists by Ivan Marić

17
We're an independent design & development agency.

Transcript of Infinum Android Talks #18 - Create fun lists by Ivan Marić

We're an independent design & development agency.

Create fun lists (fun for the user)

IVAN MARIĆ

RECYCLER VIEW

Replaces ListView and GridView

Force usage of ViewHolder pattern

More work for a developer

MANUAL WORK

No dividers

No onItemClickListener

LayoutManager

ANIMATIONS

http://stackoverflow.com/questions/3928193/how-to-animate-addition-or-removal-of-android-listview-rows

HOW ANIMATION WORKS

RecyclerView.ItemAnimator

DefaultItemAnimator

animateAppearance() → notifyItemInserted(int)

animateChange() → notifyItemChanged(int)

animateDisappearance() → notifyItemRemoved(int)

animatePersistence() → notifyItemMoved(int, int)

RecyclerView.ItemAnimator RecyclerView.Adapter

SIMPLE ITEM ANIMATOR

animateAdd

animateMove

animateChange

animateRemove

https://github.com/wasabeef/recyclerview-animators

BEFORE YOU START TO CODE

21 Animators

5 Adapters

3000+ stars

DO’S AND DON’TS

PREPARE HOLDER FOR ANIMATION

Initialize view properties before animation start

When saving for run pending

RESET ANIMATIONS

endAnimation(ViewHolder)

Missing views

Ghost Views

ALWAYS CALL DISPATCH END

dispatchMoveFinished

dispatchAddFinished

dispatchRemoveFinished

dispatchChangeFinished

WATCH ANIMATIONS ORDER

runPendingAnimations

Depends on the desired behaviour

Animation start delay

DECORATOR ANIMATIONS

Dividers draw over the items

Animate in the ItemDecoration

Move decoration into the view

PREDICTIVE ANIMATIONS

Animate holder currently not visible

Could cause problems with multiple view types

Option to turn off

Any questions? [email protected] IVAN MARIĆ

Visit infinum.co or find us on social networks:

infinum.co infinumco infinumco infinum