KotlinConf 2018 - Shaping Your App's Architecture with Kotlin and Architecture Components by Florina
Why Stack Overflow recommends it
Stack Overflow users link it when answering questions about MVVM, ViewModel state and exposing UI models through LiveData in Android apps.
Recommended by 2 people across 2 different months, 2018 to 2020.
What it is
A KotlinConf 2018 talk by Florina Muntenescu, an Android Developer Advocate at Google, on refactoring the open source Plaid app to Kotlin while adopting Android Architecture Components. It shows how Kotlin features such as delegates, lambdas and sealed classes shaped the resulting app architecture.
What people said
Recommends Etienne Lenhart · 2018-12 · Stack Overflow · on “Android - Best Practices for ViewModel State in MVVM?”
@ArchieG.Quiñones It depends on what you consider "recommended". Google's samples often expose multiple LiveData and if that fits your needs, go for it. Once you get to more complex apps with advanced business logic I personally would recommend a single LiveData. That's also what Florina Muntenescu showcases in her talk on app architecture [this video] . But again, it's always good to consult recommendations and then use whatever works for your specific use case.
Recommends gts13 · 2019-04 · Stack Overflow · on “MVVM repository in android”
As others suggested in the comments you should first define the modules of your app and then create the corresponding Repositories. This way you can easily maintain and test your application. I strongly suggest you to have a look on this [LINK] and mostly this video [this video]
Cites toffor · 2018-10 · Stack Overflow · on “CoroutineScope - CompletableDeferred cancellation”
I have two questions about this topic. I will use these in android with use case classes and i try to implement an architecture similar to this [this video] but i need some answers. 1) I have a deferred with async builder and when i cancel job then the other chains cancelled too. This code prints "Call cancelled". But i am not sure that if i am doing correct. fun main(args: Array<String>) = runBlocking<Unit> { val job = GlobalScope.launch { println(getUser()) } job.cancelAndJoin() } suspend fun getUser() = getUserDeferred().await() suspend fun getUserDeferred() = coroutineScope { val request = Request.Builder() .url(" [LINK] ") .build() val call = OkHttpClient().newCall(request) val deferred = as
Cites chrgue · 2020-02 · Stack Overflow · on “How to react on changes within a UiModel when it's exposed via LiveData by the ViewModel?”
I watched this awesome talk by Florina Muntenescu on KontlinConf 2018 where she talked about how they reshaped their app architecture. One part of the talk was how they expose a UiModel ( not ViewModel) via LiveData from the ViewModel. ( watch here [this video] ) She made a example similar to this: class MyViewModel constructor(...) : ViewModel() { private val _uiModel = MutableLiveData<UiModel>() val uiModel: LiveData<UiModel> get() = _uiModel } A view declaration for the ViewModel above could be: <layout> <data> <variable name="viewModel" type="com.demo.ui.MyViewModel" /> </data> <androidx.constraintlayout.widget.ConstraintLayout> <EditText android:id="@+id/text" android:text="@={viewModel.uiMo