hfhbd
01/19/2022, 10:13 PMSlackbot
01/20/2022, 2:37 PMzain
01/21/2022, 5:58 AModay
01/21/2022, 9:46 AMFreedom
01/21/2022, 10:01 AMAmeen Essa
01/21/2022, 11:20 AMVignesh
01/22/2022, 12:03 PMUmar Ata
01/22/2022, 12:29 PMArun Joseph
01/23/2022, 7:57 AMzain
01/24/2022, 6:14 AMvar
Pure KotlinVivek Modi
01/24/2022, 4:11 PMval string = "Hey 123"
or val string = "Hey How are you 123"
and output string = 123
edward
01/24/2022, 4:24 PMChethan
01/24/2022, 6:07 PMobserver = Observer<Resource<List<DisplayCard>>> {
when (it.status) {
Status.SUCCESS -> {
// setting list to emit card for every 2 minutes once
ambientDisplayViewModel.setListOfCards(it.data ?: emptyList())
// removing observer
ambientDisplayViewModel.ambientCardList.removeObservers(viewLifecycleOwner)
}
Status.LOADING -> {
}
Status.ERROR -> {
ambientDisplayViewModel.refresh(DataSource(loadFromNetwork = false))
}
}
}
With above code , I have received review comments from my peer as below
"Viewmodel callback should come to activity/fragment only when there's an intention to update the view." , Do you agree on this quote ? Do you think that I shouldn't keep callback when I am not making any UITran Thang
01/25/2022, 5:10 AMJoe Altidore
01/25/2022, 6:29 AMdave08
01/25/2022, 2:34 PMMichael Langford
01/25/2022, 4:16 PMMohamed Tamer
01/25/2022, 9:21 PMEimantas Urbonas
01/26/2022, 10:56 AMVivek Modi
01/26/2022, 1:59 PMArilson José de Oliveira Júnior
01/26/2022, 2:04 PMChris Fillmore
01/26/2022, 6:21 PMedward
01/26/2022, 8:40 PMclass ListFragment : Fragment() {
// Using the activityViewModels() Kotlin property delegate from the
// fragment-ktx artifact to retrieve the ViewModel in the activity scope
private val viewModel: ItemViewModel by activityViewModels()
wtf is activityViewModels
?edward
01/26/2022, 10:54 PM> Could not find androidx.fragment.fragment-ktx:1.3.2:.
Required by:
project :app
This doesn't make any sense: https://developer.android.com/studio/build/dependencies#google-mavenColton Idle
01/27/2022, 12:26 AMtonnyl
01/27/2022, 6:07 AMdefaultViewModelCreationExtras
in compose, did I miss something?Abhinav Bhadauria
01/27/2022, 6:30 AMHafs
01/27/2022, 10:06 AMDanish Ansari
01/28/2022, 6:50 AMsealed
class AppState
with 4 states (3 object and 1 one data class having 1 immutable property). It is used in ViewModel
as private MutableLiveData
and exposed to activity as LiveData
I'm using it in compose using LiveData.observeAsState()
Now the issue I'm facing is that when I use the variable State<AppState>
(variable name is appState) using when
block I'm able to access that 1 data classess property but I'm getting compilation error (Smart cast to 'AppState.Success' is impossible, because 'appState' is a property that has open or custom getter)
Code snippet inside threadEimantas Urbonas
01/28/2022, 4:26 PM