diff --git a/app/src/main/java/io/legado/app/data/dao/RssSourceDao.kt b/app/src/main/java/io/legado/app/data/dao/RssSourceDao.kt index d30b861da..8081068ed 100644 --- a/app/src/main/java/io/legado/app/data/dao/RssSourceDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/RssSourceDao.kt @@ -13,10 +13,10 @@ interface RssSourceDao { @get:Query("SELECT * FROM rssSources") val all: List - @Query("SELECT * FROM rssSources") + @Query("SELECT * FROM rssSources order by customOrder") fun liveAll(): LiveData> - @Query("SELECT * FROM rssSources where sourceName like :key or sourceUrl like :key or sourceGroup like :key") + @Query("SELECT * FROM rssSources where sourceName like :key or sourceUrl like :key or sourceGroup like :key order by customOrder") fun liveSearch(key: String): LiveData> @Query("SELECT * FROM rssSources where enabled = 1") diff --git a/app/src/main/java/io/legado/app/data/entities/RssSource.kt b/app/src/main/java/io/legado/app/data/entities/RssSource.kt index 4537747a1..82f0d4863 100644 --- a/app/src/main/java/io/legado/app/data/entities/RssSource.kt +++ b/app/src/main/java/io/legado/app/data/entities/RssSource.kt @@ -2,11 +2,12 @@ package io.legado.app.data.entities import android.os.Parcelable import androidx.room.Entity +import androidx.room.Index import androidx.room.PrimaryKey import kotlinx.android.parcel.Parcelize @Parcelize -@Entity(tableName = "rssSources") +@Entity(tableName = "rssSources", indices = [(Index(value = ["sourceUrl"], unique = false))]) data class RssSource( @PrimaryKey var sourceUrl: String = "",