티스토리 뷰

Android/Litho

8. Stop Loading

Kaboomba 2019. 11. 10. 21:02

From the previous blog, how can we dismiss loadin spinner after data has been loaded.

SectionLifecycle.dispatchLoadingEvent

We can send loading event to GroupSection to stop loading. We can simple add one line of code to onDataLoaded().

HeroesComponent.dispatchLoadingEvent(c, false, LoadingEvent.LoadingState.SUCCEEDED, null)  

Your onDataLoaded() will look like following now.

@OnEvent(HeroModel::class)  
fun onDataLoaded(c: SectionContext, @FromEvent heroes: List<Hero>) {  
    HeroesComponent.onUpdateData(c, heroes)  
    HeroesComponent.dispatchLoadingEvent(c, false, LoadingEvent.LoadingState.SUCCEEDED, null)  
}

Now, it's working fine.

'Android > Litho' 카테고리의 다른 글

6. StateValue  (0) 2019.11.10
5. HeroItemSpec  (0) 2019.11.10
4. GroupSection Spec LifeCycle  (0) 2019.11.09
3. Sample Application - HeroesComponentSpec  (0) 2019.11.09
2. Sample Application - Intialisation  (0) 2019.11.09
댓글
공지사항
최근에 올라온 글
최근에 달린 댓글
Total
Today
Yesterday
링크
«   2025/01   »
1 2 3 4
5 6 7 8 9 10 11
12 13 14 15 16 17 18
19 20 21 22 23 24 25
26 27 28 29 30 31
글 보관함