https://kotlinlang.org logo
#android-architecture
Title
# android-architecture
f

Florian

10/21/2020, 1:33 PM
when you use
LiveData<Resource<T>>
, doesn't the fragment have to make too many decisions? I.e. what to do for each result
j

Javier

10/21/2020, 1:34 PM
You can see this Resource like a State
sealed class
message has been deleted
But probably should be better if you map the Resource/s to a
sealed class
which describes the UI state
f

Florian

10/21/2020, 1:37 PM
but what about the typical sealed class Resource that just contains Success, Error, and Loading? Should the fragment make the decision what to do in each case? I thought that kind of logic belongs into the ViewModel
j

Javier

10/21/2020, 1:40 PM
It is similar to that sealed class if you removes OnNextScreen and rename Form to Success, with simple screens maybe there is no problem in understand what is happening with these three states, but with complex screen that resource can be difficult to understand
2 Views