Update: Migrate to Paged FastAdapter

This commit is contained in:
machiav3lli
2022-01-13 01:43:40 +01:00
parent f6ff3844ae
commit edc0235119
7 changed files with 113 additions and 37 deletions

View File

@ -2,6 +2,7 @@ package com.looker.droidify.database
import android.database.Cursor
import android.os.CancellationSignal
import androidx.paging.DataSource
import androidx.room.*
import androidx.sqlite.db.SimpleSQLiteQuery
import androidx.sqlite.db.SupportSQLiteQuery
@ -175,14 +176,13 @@ interface ProductDao : BaseDao<Product> {
@RawQuery(observedEntities = [Product::class])
fun queryList(
query: SupportSQLiteQuery
): List<Product>
): DataSource.Factory<Int, Product>
// TODO optimize and simplify
@Transaction
fun queryList(
installed: Boolean, updates: Boolean, searchQuery: String,
section: ProductItem.Section, order: ProductItem.Order, numberOfItems: Int = 0
): List<Product> {
): DataSource.Factory<Int, Product> {
val builder = QueryBuilder()
val signatureMatches = """installed.${ROW_SIGNATURE} IS NOT NULL AND