mirror of
				https://github.com/mihonapp/mihon.git
				synced 2025-10-30 22:07:57 +01:00 
			
		
		
		
	Apply default night mode earlier (#5593)
This commit is contained in:
		| @@ -9,6 +9,7 @@ import android.content.Intent | ||||
| import android.content.IntentFilter | ||||
| import android.os.Build | ||||
| import android.webkit.WebView | ||||
| import androidx.appcompat.app.AppCompatDelegate | ||||
| import androidx.core.app.NotificationManagerCompat | ||||
| import androidx.core.content.getSystemService | ||||
| import androidx.lifecycle.Lifecycle | ||||
| @@ -25,7 +26,9 @@ import eu.kanade.tachiyomi.data.coil.ByteBufferFetcher | ||||
| import eu.kanade.tachiyomi.data.coil.MangaCoverFetcher | ||||
| import eu.kanade.tachiyomi.data.coil.TachiyomiImageDecoder | ||||
| import eu.kanade.tachiyomi.data.notification.Notifications | ||||
| import eu.kanade.tachiyomi.data.preference.PreferenceValues | ||||
| import eu.kanade.tachiyomi.data.preference.PreferencesHelper | ||||
| import eu.kanade.tachiyomi.data.preference.asImmediateFlow | ||||
| import eu.kanade.tachiyomi.network.NetworkHelper | ||||
| import eu.kanade.tachiyomi.ui.security.SecureActivityDelegate | ||||
| import eu.kanade.tachiyomi.util.system.notification | ||||
| @@ -96,6 +99,17 @@ open class App : Application(), LifecycleObserver, ImageLoaderFactory { | ||||
|                 } | ||||
|             } | ||||
|             .launchIn(ProcessLifecycleOwner.get().lifecycleScope) | ||||
|  | ||||
|         preferences.themeMode() | ||||
|             .asImmediateFlow { | ||||
|                 AppCompatDelegate.setDefaultNightMode( | ||||
|                     when (it) { | ||||
|                         PreferenceValues.ThemeMode.light -> AppCompatDelegate.MODE_NIGHT_NO | ||||
|                         PreferenceValues.ThemeMode.dark -> AppCompatDelegate.MODE_NIGHT_YES | ||||
|                         PreferenceValues.ThemeMode.system -> AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM | ||||
|                     } | ||||
|                 ) | ||||
|             }.launchIn(ProcessLifecycleOwner.get().lifecycleScope) | ||||
|     } | ||||
|  | ||||
|     override fun attachBaseContext(base: Context) { | ||||
|   | ||||
		Reference in New Issue
	
	Block a user