startActivityForResult를 사용할 때, 아래처럼 바로 결과를 받아오면 코드가 더 간결하고 읽기 쉬워질 거라는 생각을 여러번 했었다. val intent = Intent(this, AnotherActivity::class.java) val activityResult = startActivityForResult(intent) if (activityResult.resultCode = Activity.RESULT_OK) { //doSomething() } Coroutines에서 지원하는 CompletableDeffered란 녀석을 이용하면 위와 같은 순차적인 코드가 가능해 진다. Activty에 다음 코드를 추가한다. class DefferedActivity: AppCompatActivity()..
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::c..

We are using static items for hero list. What do we do if I want to load data from a service. We are going to use same data but we will use data loader instead of hard coded data. Let's initialise hero data first. We need to provide @OnCreateInitialState annotate function to do this in HeroesComponentSpec. @GroupSectionSpec object HeroesComponentSpec { @OnCreateInitialState fun onCreateInitialSt..