2020-06-21 19:24:14 +00:00
|
|
|
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
|
2021-02-28 10:13:21 +00:00
|
|
|
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
|
2020-06-21 19:24:14 +00:00
|
|
|
|
2021-10-08 11:19:15 +00:00
|
|
|
class App : Application() {
|
2020-06-21 19:24:14 +00:00
|
|
|
|
2020-11-02 15:53:12 +00:00
|
|
|
private val prefs by lazy { getDefaultSharedPreferences(this) }
|
2020-11-15 13:22:17 +00:00
|
|
|
private val scope = CoroutineScope(SupervisorJob() + Dispatchers.IO)
|
2020-11-02 15:53:12 +00:00
|
|
|
|
2020-06-21 19:24:14 +00:00
|
|
|
override fun onCreate() {
|
2020-11-15 00:26:07 +00:00
|
|
|
scope.launch { loadJson(this@App) }
|
2020-09-20 14:41:28 +00:00
|
|
|
super.onCreate()
|
2021-02-28 10:13:21 +00:00
|
|
|
mutableAccentColor.value = prefs.managerAccent
|
2020-07-06 11:38:00 +00:00
|
|
|
}
|
|
|
|
|
2020-08-12 13:40:13 +00:00
|
|
|
}
|