diff --git a/app/src/main/java/io/legado/app/base/BaseActivity.kt b/app/src/main/java/io/legado/app/base/BaseActivity.kt index bfa46c4b0..a09f8f1d4 100644 --- a/app/src/main/java/io/legado/app/base/BaseActivity.kt +++ b/app/src/main/java/io/legado/app/base/BaseActivity.kt @@ -1,15 +1,19 @@ package io.legado.app.base +import android.content.Context import android.os.Bundle +import android.util.AttributeSet import android.view.Menu import android.view.MenuItem import android.view.View import android.view.WindowManager +import android.widget.FrameLayout import androidx.appcompat.app.AppCompatActivity import io.legado.app.R import io.legado.app.constant.Theme import io.legado.app.lib.theme.ATH import io.legado.app.lib.theme.ColorUtils +import io.legado.app.lib.theme.backgroundColor import io.legado.app.lib.theme.primaryColor import io.legado.app.utils.applyOpenTint import io.legado.app.utils.applyTint @@ -27,6 +31,20 @@ abstract class BaseActivity( ) : AppCompatActivity(), CoroutineScope by MainScope() { + override fun onCreateView( + parent: View?, + name: String, + context: Context, + attrs: AttributeSet + ): View? { + if (name == "androidx.appcompat.view.menu.ListMenuItemView" && + parent?.parent is FrameLayout + ) { + (parent.parent as View).setBackgroundColor(backgroundColor) + } + return super.onCreateView(parent, name, context, attrs) + } + override fun onCreate(savedInstanceState: Bundle?) { window.decorView.disableAutoFill() initTheme() diff --git a/app/src/main/java/io/legado/app/data/dao/BookDao.kt b/app/src/main/java/io/legado/app/data/dao/BookDao.kt index 3dfaf21fa..9aaf5d3fe 100644 --- a/app/src/main/java/io/legado/app/data/dao/BookDao.kt +++ b/app/src/main/java/io/legado/app/data/dao/BookDao.kt @@ -84,7 +84,7 @@ interface BookDao { @Query("update books set `group` = :newGroupId where `group` = :oldGroupId") fun upGroup(oldGroupId: Int, newGroupId: Int) - @get:Query("select bookUrl, durChapterIndex, durChapterPos, durChapterTime, durChapterTitle from books") + @get:Query("select bookUrl, tocUrl, origin, originName, durChapterIndex, durChapterPos, durChapterTime, durChapterTitle from books") val allBookProgress: List @Query( diff --git a/app/src/main/java/io/legado/app/data/entities/BookProgress.kt b/app/src/main/java/io/legado/app/data/entities/BookProgress.kt index c0d693284..bb9d4e0c5 100644 --- a/app/src/main/java/io/legado/app/data/entities/BookProgress.kt +++ b/app/src/main/java/io/legado/app/data/entities/BookProgress.kt @@ -2,6 +2,9 @@ package io.legado.app.data.entities data class BookProgress( val bookUrl: String, + val tocUrl: String = "", + var origin: String = "", + var originName: String = "", val durChapterIndex: Int, val durChapterPos: Int, val durChapterTime: Long, diff --git a/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt b/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt index ddb4d6ef5..4e09e7c63 100644 --- a/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt +++ b/app/src/main/java/io/legado/app/help/storage/SyncBookProgress.kt @@ -35,11 +35,11 @@ object SyncBookProgress { val json = file.readText() GSON.fromJsonArray(json)?.forEach { App.db.bookDao().upBookProgress( - it.bookUrl, - it.durChapterIndex, - it.durChapterPos, - it.durChapterTime, - it.durChapterTitle + bookUrl = it.bookUrl, + durChapterIndex = it.durChapterIndex, + durChapterPos = it.durChapterPos, + durChapterTime = it.durChapterTime, + durChapterTitle = it.durChapterTitle ) } }