package dev.jdtech.jellyfin import android.app.Application import androidx.appcompat.app.AppCompatDelegate import com.google.android.material.color.DynamicColors import dagger.hilt.android.HiltAndroidApp import javax.inject.Inject import timber.log.Timber @HiltAndroidApp class BaseApplication : Application() { @Inject lateinit var appPreferences: AppPreferences override fun onCreate() { super.onCreate() if (BuildConfig.DEBUG) { Timber.plant(Timber.DebugTree()) } when (appPreferences.theme) { "system" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_FOLLOW_SYSTEM) "light" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_NO) "dark" -> AppCompatDelegate.setDefaultNightMode(AppCompatDelegate.MODE_NIGHT_YES) } if (appPreferences.dynamicColors) DynamicColors.applyToActivitiesIfAvailable(this) } }