ananas/app/phone/src/main/java/dev/jdtech/jellyfin/BaseApplication.kt
js6pak 5f7b7eaf63
Add CI (#236)
* Create main.yml

* Run ktlintFormat

* Don't error on translation lint issues

* Fix lint error about POST_NOTIFICATIONS permission

* Increase memory limit to speedup the build

* Only build debug

* refactor: rename `main.yml` to `build.yaml`

* lint: error on `ExtraTranslation`

---------

Co-authored-by: Jarne Demeulemeester <jarnedemeulemeester@gmail.com>
2023-02-11 12:01:02 +01:00

30 lines
962 B
Kotlin

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)
}
}