33 lines
1.0 KiB
Kotlin
33 lines
1.0 KiB
Kotlin
package com.example.defenseapplication
|
|
|
|
import android.app.Application
|
|
import android.content.Context
|
|
import bean.LoginBean
|
|
import com.blankj.utilcode.util.Utils
|
|
import com.example.defenseapplication.bean.BaseInfo
|
|
import com.example.defenseapplication.utils.ApiConfig
|
|
import com.example.defenseapplication.utils.LanguageHeaderManager
|
|
import com.example.defenseapplication.utils.LanguageUtil
|
|
import com.example.defenseapplication.utils.UserinfoUtil
|
|
import com.google.gson.Gson
|
|
|
|
class MyApplication : Application() {
|
|
|
|
override fun onCreate() {
|
|
super.onCreate()
|
|
Utils.init(this) // 初始化 AndroidUtilCode
|
|
|
|
var token = UserinfoUtil.getUserInfo()?.access_token;
|
|
if (token != null) {
|
|
ApiConfig.authToken = token
|
|
};
|
|
LanguageHeaderManager.init(this)
|
|
}
|
|
|
|
override fun attachBaseContext(base: Context) {
|
|
// 在应用启动时应用语言设置
|
|
val context = LanguageUtil.attachBaseContext(base)
|
|
super.attachBaseContext(context)
|
|
}
|
|
}
|