mirror of
https://github.com/topjohnwu/Magisk.git
synced 2026-01-17 23:26:13 -08:00
Updated modules screen so it displays all the content in one recyclerview
Added "endless" scrolling support - this is done in order to display everything very swiftly and load as user needs it - for the most part we'll download only ~10 items and load the rest as scroll progresses, this accomplishes the illusion that whole list is being populated Added sections and updated repo view
This commit is contained in:
29
app/src/main/java/com/topjohnwu/magisk/data/database/Repo.kt
Normal file
29
app/src/main/java/com/topjohnwu/magisk/data/database/Repo.kt
Normal file
@@ -0,0 +1,29 @@
|
||||
@file:JvmMultifileClass
|
||||
|
||||
package com.topjohnwu.magisk.data.database
|
||||
|
||||
import androidx.room.Dao
|
||||
import androidx.room.Query
|
||||
import com.topjohnwu.magisk.model.entity.module.Repo
|
||||
|
||||
interface RepoBase {
|
||||
|
||||
fun getRepos(offset: Int, limit: Int = 10): List<Repo>
|
||||
|
||||
}
|
||||
|
||||
@Dao
|
||||
interface RepoByUpdatedDao : RepoBase {
|
||||
|
||||
@Query("SELECT * FROM repos ORDER BY last_update DESC LIMIT :limit OFFSET :offset")
|
||||
override fun getRepos(offset: Int, limit: Int): List<Repo>
|
||||
|
||||
}
|
||||
|
||||
@Dao
|
||||
interface RepoByNameDao : RepoBase {
|
||||
|
||||
@Query("SELECT * FROM repos ORDER BY name COLLATE NOCASE LIMIT :limit OFFSET :offset")
|
||||
override fun getRepos(offset: Int, limit: Int): List<Repo>
|
||||
|
||||
}
|
||||
@@ -7,5 +7,8 @@ import com.topjohnwu.magisk.model.entity.module.Repo
|
||||
@Database(version = 6, entities = [Repo::class, RepoEtag::class])
|
||||
abstract class RepoDatabase : RoomDatabase() {
|
||||
|
||||
abstract fun repoDao() : RepoDao
|
||||
abstract fun repoDao(): RepoDao
|
||||
abstract fun repoByUpdatedDao(): RepoByUpdatedDao
|
||||
abstract fun repoByNameDao(): RepoByNameDao
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user