Upgrade to Pro — share decks privately, control downloads, hide ads and more …

RecyclerView

Sponsored · Ship Features Fearlessly Turn features on and off without deploys. Used by thousands of Ruby developers. →
Avatar for Javernaut Javernaut
December 11, 2014

 RecyclerView

Avatar for Javernaut

Javernaut

December 11, 2014

More Decks by Javernaut

Other Decks in Programming

Transcript

  1. RecyclerView • Delegates view constructing to Adapter • Delegates layout

    logic to LayoutManager • Delegates item animations and decorations
  2. Adapter • Constructs Views from model • With RecyclerView forces

    ViewHolder pattern • Should attach click logic since there is no onItemClickListener
  3. Adapter • notifyItemChanged • notifyItemInserted • notifyItemRemoved • notifyItemMoved Data

    set changes methods • notifyItemRangeChanged • notifyItemRangeInserted • notifyItemRangeRemoved
  4. Visual effects • animateAdd • animateChange • animateMove • animateRemove

    ItemAnimator ItemDecoration • getItemOffsets • onDraw • onDrawOver
  5. Conclusion • Should we start using RV? - Yes •

    Released • Out of box animations, ViewHolder, several LayoutManagers • Dividers absence solves with ItemDecoration
  6. Conclusion • Should we use only RV? - No •

    Doesn’t have ViewPager’s behavior • SwipeToDismiss, Adapter cycling and other 3rd party features should be implemented manually