From e5c09690473f3a380921daf40d247d6b1d6880f9 Mon Sep 17 00:00:00 2001 From: arkon Date: Thu, 27 Feb 2020 19:56:04 -0500 Subject: [PATCH] Change system dark mode check User on Discord reported setting wasn't working on his devices. --- .../eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt index 766e575325..a3c36a1cb3 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/activity/BaseActivity.kt @@ -1,10 +1,8 @@ package eu.kanade.tachiyomi.ui.base.activity -import android.app.UiModeManager -import android.content.Context +import android.content.res.Configuration import android.os.Bundle import androidx.appcompat.app.AppCompatActivity -import androidx.appcompat.app.AppCompatDelegate import eu.kanade.tachiyomi.R import eu.kanade.tachiyomi.data.preference.PreferenceValues as Values import eu.kanade.tachiyomi.data.preference.PreferencesHelper @@ -34,8 +32,7 @@ abstract class BaseActivity : AppCompatActivity() { setTheme(when (preferences.themeMode().getOrDefault()) { Values.THEME_MODE_DARK -> darkTheme Values.THEME_MODE_SYSTEM -> { - val mode = getSystemService(Context.UI_MODE_SERVICE) as UiModeManager - if (mode.nightMode == AppCompatDelegate.MODE_NIGHT_YES) { + if (resources.configuration.uiMode and Configuration.UI_MODE_NIGHT_MASK == Configuration.UI_MODE_NIGHT_YES) { darkTheme } else { R.style.Theme_Tachiyomi