修复阅读记录排序

pull/433/head
gedoor 4 years ago
parent 7f45efed00
commit 6a10d276f1
  1. 8
      app/src/main/java/io/legado/app/data/AppDatabase.kt
  2. 2
      app/src/main/java/io/legado/app/data/dao/ReadRecordDao.kt

@ -10,6 +10,7 @@ import io.legado.app.App
import io.legado.app.constant.AppConst
import io.legado.app.data.dao.*
import io.legado.app.data.entities.*
import java.util.*
@Database(
@ -46,7 +47,14 @@ abstract class AppDatabase: RoomDatabase() {
.build()
private val dbCallback = object : Callback() {
override fun onCreate(db: SupportSQLiteDatabase) {
super.onCreate(db)
db.setLocale(Locale.CHINESE)
}
override fun onOpen(db: SupportSQLiteDatabase) {
db.setLocale(Locale.CHINESE)
db.execSQL(
"""
insert into book_groups(groupId, groupName, 'order', show) select ${AppConst.bookGroupAllId}, '全部', -10, 1

@ -10,7 +10,7 @@ interface ReadRecordDao {
@get:Query("select * from readRecord")
val all: List<ReadRecord>
@get:Query("select bookName, sum(readTime) as readTime from readRecord group by bookName order by bookName")
@get:Query("select bookName, sum(readTime) as readTime from readRecord group by bookName order by bookName collate localized")
val allShow: List<ReadRecordShow>
@get:Query("select sum(readTime) from readRecord")

Loading…
Cancel
Save