mirror of
https://github.com/Aviortheking/Neo-Store.git
synced 2025-04-23 19:32:16 +00:00
Clean up & TODOs
This commit is contained in:
parent
f6bdb57ab1
commit
82e42b2611
@ -9,7 +9,6 @@ import com.looker.droidify.*
|
||||
import com.looker.droidify.database.entity.*
|
||||
import com.looker.droidify.entity.Order
|
||||
import com.looker.droidify.entity.Section
|
||||
import io.reactivex.rxjava3.core.Flowable
|
||||
|
||||
interface BaseDao<T> {
|
||||
@Insert
|
||||
@ -52,9 +51,6 @@ interface RepositoryDao : BaseDao<Repository> {
|
||||
@get:Query("SELECT * FROM repository ORDER BY _id ASC")
|
||||
val allLive: LiveData<List<Repository>>
|
||||
|
||||
@get:Query("SELECT * FROM repository ORDER BY _id ASC")
|
||||
val allFlowable: Flowable<List<Repository>>
|
||||
|
||||
@get:Query("SELECT _id FROM repository WHERE enabled == 0 ORDER BY _id ASC")
|
||||
val allDisabled: List<Long>
|
||||
|
||||
|
@ -43,6 +43,7 @@ import kotlinx.coroutines.flow.onEach
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
// TODO clean up and replace dropped functions from AppDetailFragment
|
||||
class AppSheetX() : FullscreenBottomSheetDialogFragment(), AppDetailAdapter.Callbacks {
|
||||
companion object {
|
||||
private const val EXTRA_PACKAGE_NAME = "packageName"
|
||||
|
@ -39,7 +39,7 @@ class ExploreFragment : MainNavFragmentX() {
|
||||
|
||||
override fun setupAdapters() {
|
||||
appsItemAdapter = PagedModelAdapter<Product, VAppItem>(PRODUCT_ASYNC_DIFFER_CONFIG) {
|
||||
it.item?.let { item -> VAppItem(item, repositories[it.repository_id]) }
|
||||
VAppItem(it.item, repositories[it.repository_id])
|
||||
}
|
||||
appsFastAdapter = FastAdapter.with(appsItemAdapter)
|
||||
appsFastAdapter?.setHasStableIds(true)
|
||||
|
@ -42,11 +42,10 @@ class InstalledFragment : MainNavFragmentX() {
|
||||
|
||||
override fun setupAdapters() {
|
||||
installedItemAdapter = PagedModelAdapter<Product, VAppItem>(PRODUCT_ASYNC_DIFFER_CONFIG) {
|
||||
it.item?.let { item -> VAppItem(item, repositories[it.repository_id]) }
|
||||
VAppItem(it.item, repositories[it.repository_id])
|
||||
}
|
||||
updatedItemAdapter = PagedModelAdapter<Product, HAppItem>(PRODUCT_ASYNC_DIFFER_CONFIG) {
|
||||
// TODO filter for only updated apps and add placeholder
|
||||
it.item?.let { item -> HAppItem(item, repositories[it.repository_id]) }
|
||||
HAppItem(it.item, repositories[it.repository_id])
|
||||
}
|
||||
installedFastAdapter = FastAdapter.with(installedItemAdapter)
|
||||
installedFastAdapter?.setHasStableIds(true)
|
||||
|
@ -43,11 +43,11 @@ class LatestFragment : MainNavFragmentX() {
|
||||
|
||||
override fun setupAdapters() {
|
||||
updatedItemAdapter = PagedModelAdapter<Product, VAppItem>(PRODUCT_ASYNC_DIFFER_CONFIG) {
|
||||
it.item?.let { item -> VAppItem(item, repositories[it.repository_id]) }
|
||||
VAppItem(it.item, repositories[it.repository_id])
|
||||
}
|
||||
newItemAdapter = PagedModelAdapter<Product, HAppItem>(PRODUCT_ASYNC_DIFFER_CONFIG) {
|
||||
// TODO filter for only new apps and add placeholder
|
||||
it.item?.let { item -> HAppItem(item, repositories[it.repository_id]) }
|
||||
HAppItem(it.item, repositories[it.repository_id])
|
||||
}
|
||||
updatedFastAdapter = FastAdapter.with(updatedItemAdapter)
|
||||
updatedFastAdapter?.setHasStableIds(true)
|
||||
|
@ -63,10 +63,8 @@ class PrefsRepositoriesFragment : BaseNavFragment() {
|
||||
reposFastAdapter?.onLongClickListener =
|
||||
{ _: View?, _: IAdapter<RepoItem>?, item: RepoItem?, _: Int? ->
|
||||
item?.item?.let {
|
||||
RepositorySheetX(it.id).showNow(
|
||||
parentFragmentManager,
|
||||
"Repository ${it.id}"
|
||||
)
|
||||
RepositorySheetX(it.id)
|
||||
.showNow(parentFragmentManager, "Repository ${it.id}")
|
||||
}
|
||||
false
|
||||
}
|
||||
|
@ -1,7 +1,6 @@
|
||||
package com.looker.droidify.ui.viewmodels
|
||||
|
||||
import androidx.lifecycle.*
|
||||
import androidx.paging.DataSource
|
||||
import androidx.paging.LivePagedListBuilder
|
||||
import androidx.paging.PagedList
|
||||
import com.looker.droidify.content.Preferences
|
||||
@ -18,7 +17,6 @@ import kotlinx.coroutines.flow.SharingStarted
|
||||
import kotlinx.coroutines.flow.StateFlow
|
||||
import kotlinx.coroutines.flow.stateIn
|
||||
import kotlinx.coroutines.launch
|
||||
import kotlinx.coroutines.withContext
|
||||
|
||||
class MainNavFragmentViewModelX(val db: DatabaseX, primarySource: Source, secondarySource: Source) :
|
||||
ViewModel() {
|
||||
@ -125,26 +123,6 @@ class MainNavFragmentViewModelX(val db: DatabaseX, primarySource: Source, second
|
||||
repositories.addSource(db.repositoryDao.allLive, repositories::setValue)
|
||||
}
|
||||
|
||||
fun fillList(source: Source) {
|
||||
viewModelScope.launch(Dispatchers.Default) {
|
||||
// productsList = query(request(source))
|
||||
}
|
||||
}
|
||||
|
||||
private suspend fun query(request: Request): DataSource.Factory<Int, Product> {
|
||||
return withContext(Dispatchers.Default) {
|
||||
db.productDao
|
||||
.queryList(
|
||||
installed = request.installed,
|
||||
updates = request.updates,
|
||||
searchQuery = request.searchQuery,
|
||||
section = request.section,
|
||||
order = request.order,
|
||||
numberOfItems = request.numberOfItems
|
||||
)
|
||||
}
|
||||
}
|
||||
|
||||
fun setSection(newSection: Section, perform: () -> Unit) {
|
||||
viewModelScope.launch {
|
||||
if (newSection != sections.value) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user