You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

44 lines
915 B
Kotlin

package com.common.commonlib
import android.annotation.SuppressLint
import android.app.Application
import android.content.Context
import com.common.commonlib.log.Logger.d
import com.common.commonlib.utils.BaseUtils
import com.tencent.mmkv.MMKV
import okhttp3.logging.HttpLoggingInterceptor
/**
* 基础Application
*
* @author wangym
* @since 2021/7/28
*/
@SuppressLint("StaticFieldLeak")
open class CommonApplication : Application() {
override fun onCreate() {
super.onCreate()
intLibs(this)
}
private fun intLibs(context: Context) {
commonContext = context
// 初始化MMKV
MMKV.initialize(this)
initNet()
}
private fun initNet() {
BaseUtils.enableFullLog()
}
companion object {
private var commonContext: Context? = null
fun getContext(): Context? {
return commonContext
}
}
}