diff --git a/app/src/main/java/io/legado/app/data/AppDatabase.kt b/app/src/main/java/io/legado/app/data/AppDatabase.kt index 7e8acb854..dc144493b 100644 --- a/app/src/main/java/io/legado/app/data/AppDatabase.kt +++ b/app/src/main/java/io/legado/app/data/AppDatabase.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 diff --git a/app/src/main/java/io/legado/app/data/dao/ReadRecordDao.kt b/app/src/main/java/io/legado/app/data/dao/ReadRecordDao.kt index 3e964ea73..9363e2a56 100644 --- a/app/src/main/java/io/legado/app/data/dao/ReadRecordDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/ReadRecordDao.kt @@ -10,7 +10,7 @@ interface ReadRecordDao { @get:Query("select * from readRecord") val all: List - @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 @get:Query("select sum(readTime) from readRecord")