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