VancedManager/app/src/main/java/com/vanced/manager/core/App.kt

26 lines
802 B
Kotlin
Raw Normal View History

package com.vanced.manager.core
import android.app.Application
2020-09-25 17:01:24 +00:00
import androidx.preference.PreferenceManager.getDefaultSharedPreferences
2020-11-03 07:28:18 +00:00
import com.vanced.manager.BuildConfig.*
2021-01-16 17:00:38 +00:00
import com.vanced.manager.utils.loadJson
import com.vanced.manager.utils.managerAccent
import com.vanced.manager.utils.mutableAccentColor
2020-11-15 17:04:23 +00:00
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.SupervisorJob
import kotlinx.coroutines.launch
2021-10-08 11:19:15 +00:00
class App : Application() {
2020-11-02 15:53:12 +00:00
private val prefs by lazy { getDefaultSharedPreferences(this) }
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
2020-11-02 15:53:12 +00:00
override fun onCreate() {
scope.launch { loadJson(this@App) }
2020-09-20 14:41:28 +00:00
super.onCreate()
mutableAccentColor.value = prefs.managerAccent
2020-07-06 11:38:00 +00:00
}
2020-08-12 13:40:13 +00:00
}