mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-07 08:19:55 +00:00
Improve: Reduce memory allocation on viewmodel startup
This commit is contained in:
parent
ab5c26bec4
commit
77afcf8877
@ -146,7 +146,6 @@ dependencies {
|
|||||||
// Material3
|
// Material3
|
||||||
implementation 'com.google.android.material:material:1.6.0-alpha01'
|
implementation 'com.google.android.material:material:1.6.0-alpha01'
|
||||||
|
|
||||||
|
|
||||||
// FastAdapter
|
// FastAdapter
|
||||||
implementation("com.mikepenz:fastadapter:5.6.0")
|
implementation("com.mikepenz:fastadapter:5.6.0")
|
||||||
implementation("com.mikepenz:fastadapter-extensions-diff:5.6.0")
|
implementation("com.mikepenz:fastadapter-extensions-diff:5.6.0")
|
||||||
|
@ -84,18 +84,16 @@ class MainNavFragmentViewModelX(val db: DatabaseX, source: Source) : ViewModel()
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var productsList: LiveData<PagedList<Product>>
|
private val pagedListConfig by lazy {
|
||||||
|
PagedList.Config.Builder()
|
||||||
init {
|
|
||||||
|
|
||||||
val pagedListConfig = PagedList.Config.Builder()
|
|
||||||
.setPageSize(30)
|
.setPageSize(30)
|
||||||
.setPrefetchDistance(30)
|
.setPrefetchDistance(30)
|
||||||
.setEnablePlaceholders(false)
|
.setEnablePlaceholders(false)
|
||||||
.build()
|
.build()
|
||||||
val request = request(source)
|
}
|
||||||
|
val request = request(source)
|
||||||
productsList = LivePagedListBuilder(
|
val productsList: LiveData<PagedList<Product>> by lazy {
|
||||||
|
LivePagedListBuilder(
|
||||||
db.productDao.queryList(
|
db.productDao.queryList(
|
||||||
installed = request.installed,
|
installed = request.installed,
|
||||||
updates = request.updates,
|
updates = request.updates,
|
||||||
|
Loading…
x
Reference in New Issue
Block a user