mirror of
https://github.com/mihonapp/mihon.git
synced 2025-11-12 12:08:56 +01:00
Match ReaderActivity theme with the rest of the app (#5450)
* Match ReaderActivity theme with the rest of the app * Fix viewer inset when fullscreen reader is off * Fix incorrect toolbar color after recreate * Remove animated inset * Move isDarkMode to PreferencesHelper
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
package eu.kanade.tachiyomi.data.preference
|
||||
|
||||
import android.content.Context
|
||||
import android.content.res.Configuration
|
||||
import android.os.Environment
|
||||
import androidx.core.content.edit
|
||||
import androidx.core.net.toUri
|
||||
@@ -10,6 +11,7 @@ import com.tfcporciuncula.flow.Preference
|
||||
import eu.kanade.tachiyomi.R
|
||||
import eu.kanade.tachiyomi.data.database.models.Manga
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues.DisplayMode
|
||||
import eu.kanade.tachiyomi.data.preference.PreferenceValues.ThemeMode.*
|
||||
import eu.kanade.tachiyomi.data.track.TrackService
|
||||
import eu.kanade.tachiyomi.data.track.anilist.Anilist
|
||||
import eu.kanade.tachiyomi.ui.reader.setting.OrientationType
|
||||
@@ -84,7 +86,7 @@ class PreferencesHelper(val context: Context) {
|
||||
|
||||
fun showLibraryUpdateErrors() = prefs.getBoolean(Keys.showLibraryUpdateErrors, true)
|
||||
|
||||
fun themeMode() = flowPrefs.getEnum(Keys.themeMode, Values.ThemeMode.system)
|
||||
fun themeMode() = flowPrefs.getEnum(Keys.themeMode, system)
|
||||
|
||||
fun themeLight() = flowPrefs.getEnum(Keys.themeLight, Values.LightThemeVariant.default)
|
||||
|
||||
@@ -322,4 +324,15 @@ class PreferencesHelper(val context: Context) {
|
||||
putInt(Keys.defaultChapterSortByAscendingOrDescending, if (manga.sortDescending()) Manga.CHAPTER_SORT_DESC else Manga.CHAPTER_SORT_ASC)
|
||||
}
|
||||
}
|
||||
|
||||
fun isDarkMode(): Boolean {
|
||||
return when (themeMode().get()) {
|
||||
light -> false
|
||||
dark -> true
|
||||
system -> {
|
||||
context.applicationContext.resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK ==
|
||||
Configuration.UI_MODE_NIGHT_YES
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user