mirror of
https://git.mihon.tech/mihonapp/mihon
synced 2024-11-21 20:55:41 +03:00
Fix reader transition color scheme in auto background mode (#1487)
This commit is contained in:
parent
5a91d5c611
commit
36d5ee0763
1 changed files with 6 additions and 1 deletions
|
@ -15,6 +15,7 @@ import androidx.core.content.getSystemService
|
||||||
import androidx.core.net.toUri
|
import androidx.core.net.toUri
|
||||||
import com.hippo.unifile.UniFile
|
import com.hippo.unifile.UniFile
|
||||||
import eu.kanade.domain.ui.UiPreferences
|
import eu.kanade.domain.ui.UiPreferences
|
||||||
|
import eu.kanade.domain.ui.model.ThemeMode
|
||||||
import eu.kanade.tachiyomi.BuildConfig
|
import eu.kanade.tachiyomi.BuildConfig
|
||||||
import eu.kanade.tachiyomi.R
|
import eu.kanade.tachiyomi.R
|
||||||
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
|
import eu.kanade.tachiyomi.ui.base.delegate.ThemingDelegate
|
||||||
|
@ -107,9 +108,13 @@ fun Context.createFileInCacheDir(name: String): File {
|
||||||
fun Context.createReaderThemeContext(): Context {
|
fun Context.createReaderThemeContext(): Context {
|
||||||
val preferences = Injekt.get<UiPreferences>()
|
val preferences = Injekt.get<UiPreferences>()
|
||||||
val readerPreferences = Injekt.get<ReaderPreferences>()
|
val readerPreferences = Injekt.get<ReaderPreferences>()
|
||||||
|
val themeMode = preferences.themeMode().get()
|
||||||
val isDarkBackground = when (readerPreferences.readerTheme().get()) {
|
val isDarkBackground = when (readerPreferences.readerTheme().get()) {
|
||||||
1, 2 -> true // Black, Gray
|
1, 2 -> true // Black, Gray
|
||||||
3 -> applicationContext.isNightMode() // Automatic bg uses activity background by default
|
3 -> when (themeMode) { // Automatic bg uses activity background by default
|
||||||
|
ThemeMode.SYSTEM -> applicationContext.isNightMode()
|
||||||
|
else -> themeMode == ThemeMode.DARK
|
||||||
|
}
|
||||||
else -> false // White
|
else -> false // White
|
||||||
}
|
}
|
||||||
val expected = if (isDarkBackground) Configuration.UI_MODE_NIGHT_YES else Configuration.UI_MODE_NIGHT_NO
|
val expected = if (isDarkBackground) Configuration.UI_MODE_NIGHT_YES else Configuration.UI_MODE_NIGHT_NO
|
||||||
|
|
Loading…
Reference in a new issue