mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-06-07 00:09: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
|
||||
implementation 'com.google.android.material:material:1.6.0-alpha01'
|
||||
|
||||
|
||||
// FastAdapter
|
||||
implementation("com.mikepenz:fastadapter: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>>
|
||||
|
||||
init {
|
||||
|
||||
val pagedListConfig = PagedList.Config.Builder()
|
||||
private val pagedListConfig by lazy {
|
||||
PagedList.Config.Builder()
|
||||
.setPageSize(30)
|
||||
.setPrefetchDistance(30)
|
||||
.setEnablePlaceholders(false)
|
||||
.build()
|
||||
val request = request(source)
|
||||
|
||||
productsList = LivePagedListBuilder(
|
||||
}
|
||||
val request = request(source)
|
||||
val productsList: LiveData<PagedList<Product>> by lazy {
|
||||
LivePagedListBuilder(
|
||||
db.productDao.queryList(
|
||||
installed = request.installed,
|
||||
updates = request.updates,
|
||||
|
Loading…
x
Reference in New Issue
Block a user