From 0aca01517184936e10b71764d778071fa12dd1e7 Mon Sep 17 00:00:00 2001 From: Jay Date: Tue, 4 Feb 2020 17:48:49 -0800 Subject: [PATCH] Fixed Issue of reader not following theme on app relaunch from memory Cache now checks for downloads outside of library too --- .../eu/kanade/tachiyomi/data/download/DownloadCache.kt | 2 +- .../java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt | 8 ++++++++ 2 files changed, 9 insertions(+), 1 deletion(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt index 9b4e0b3e4e..7846e57a43 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/data/download/DownloadCache.kt @@ -126,7 +126,7 @@ class DownloadCache( //rootDir.files = sourceDirs val db:DatabaseHelper by injectLazy() - val mangas = db.getLibraryMangas().executeAsBlocking() + val mangas = db.getMangas().executeAsBlocking() sourceDirs.forEach { sourceValue -> val sourceDir = sourceValue.value diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt index a84b986d84..a7095ab489 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/ReaderActivity.kt @@ -20,6 +20,7 @@ import android.view.WindowManager import android.view.animation.Animation import android.view.animation.AnimationUtils import android.widget.SeekBar +import androidx.appcompat.app.AppCompatDelegate import androidx.biometric.BiometricManager import com.davemorrissey.labs.subscaleview.SubsamplingScaleImageView import com.google.android.material.bottomsheet.BottomSheetDialog @@ -150,6 +151,13 @@ class ReaderActivity : BaseRxActivity(), * Called when the activity is created. Initializes the presenter and configuration. */ override fun onCreate(savedState: Bundle?) { + AppCompatDelegate.setDefaultNightMode( + when (preferences.theme()) { + 1 -> AppCompatDelegate.MODE_NIGHT_NO + 2, 3, 4 -> AppCompatDelegate.MODE_NIGHT_YES + else -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM + } + ) setTheme(when (preferences.readerTheme().getOrDefault()) { 0 -> R.style.Theme_Base_Reader_Light 1 -> R.style.Theme_Base_Reader_Dark