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

Paging Library は便利だぞ!

Paging Library は便利だぞ!

#hakata_apk で発表した際のスライドです.
# Android

Hunachi

June 08, 2018
Tweet

More Decks by Hunachi

Other Decks in Programming

Transcript

  1. ࢖͍ํ ᶃ ListAdapter Λ࢖ͬͨ RecyclerView Λ࡞Δɽ ᶄ ListAdapter -> PagedListAdapterʹ͢Δɽ

    ᶅ DataSource ͱ DataSource.Factory Λ࡞Δɽ ᶆ BuilderΛ࡞Δɽ ᶇ ViewModelʹLiveData<PagedList>Λ࡞Δɽ ᶈ submitListΛͯ͠׬੒ʂ Ͳ͏͍͏αΠΫϧͰಈ͔͘͸ɼCodelabͷWrap upʹॻ͍ͯ͋Δ ͷͰࠓճ͸࣮૷ํ๏ͷΈ঺հ͠·͢ɽ
  2. ଓ͖ ▪ DataͷऴΘΓ͸nullͰڭ͑ͯ͋͛Δɽ ▪ ΤϥʔϋϯυϦϯάɼϦτϥΠॲཧ౳͸ɼ Executorͱ͔LiveDataΛ࢖ͬͯؤு ΔʂʢެࣜͷαϯϓϧΛΈΔͱ͍͍ͱࢥ͍·͢ʂʣ ▪ σʔλݩ͕ϖʔδϯάʹରԠ͍ͯ͠Δ৔߹ Ø

    PageKeyedDataSource Λ࢖͏ɽ Ø callbackͷҾ਺͕ ListͱݱࡏͷPageɽ ▪ σʔλݩ͕ϖʔδϯάʹରԠ͍ͯ͠ͳ͍৔߹ Ø ItemKeyedDataSource Λ࢖͏ɽ Ø callbackͷҾ਺͕ Item ͷΈɽ
  3. ▪ )* Demo,/0 ▪ 5 1   #&-4 

    6 ! ▪ "$ ▪ https://github.com/Hunachi/wantedly-coding-challenge-publicNetWork ▪ https://github.com/Hunachi/HunaSchedule2 DataBase!%'(+2 3-.