manueldidonna
06/12/2020, 2:15 PMAdapterList . The composable receives a read-only List, each item has a proper equals method. If an item must change, the composable is invoked with a new list.
var items by state { emptyList<Item>() }
AdapterList(items) { item ->
ItemUI(item, onClick = { items = /** new read-only List with only one item changed**/ })
}
Should I replace the MutableState with a ModelList?Zach Klippenstein (he/him) [MOD]
06/12/2020, 2:21 PMAdapterList should support regular immutable `List`s just fine.manueldidonna
06/12/2020, 2:30 PMZach Klippenstein (he/him) [MOD]
06/12/2020, 2:35 PMAdapterList doesn’t actually do any diffing. When you pass a new data list in, it looks at the indices of the data items that are currently on screen and re-invokes your itemCallback for whatever data happens to be at those indices at that point in time. So in terms of time complexity, every update to the data is recomposed in roughly constant time relative to the number of items that can be on the screen at one time, it doesn’t matter how large your list is. So you’re right it’s probably not an AdapterList issue. But it would be good to attach the profiler and look at what methods are actually taking so long.
https://cs.android.com/androidx/platform/frameworks/support/+/androidx-master-dev:ui/ui-foundation/src/main/java/androidx/ui/foundation/AdapterList.kt;l=80?q=adapterlist&ss=androidx%2Fplatform%2Fframeworks%2FsupportZach Klippenstein (he/him) [MOD]
06/12/2020, 2:36 PMmanueldidonna
06/12/2020, 2:39 PMmanueldidonna
06/13/2020, 1:12 AMZach Klippenstein (he/him) [MOD]
06/13/2020, 1:15 AMmanueldidonna
06/13/2020, 1:18 AMmanueldidonna
06/13/2020, 1:22 AMcaelum19
08/01/2020, 7:41 PM