|
|
@@ -1,80 +0,0 @@
|
|
|
-package uas.erp.general_wms.application
|
|
|
-
|
|
|
-import android.app.Application
|
|
|
-import android.content.Context
|
|
|
-import android.media.AudioAttributes
|
|
|
-import android.media.SoundPool
|
|
|
-import android.os.Build
|
|
|
-import androidx.multidex.MultiDex
|
|
|
-import com.android.volley.RequestQueue
|
|
|
-import com.android.volley.toolbox.Volley
|
|
|
-import com.facebook.stetho.Stetho
|
|
|
-import uas.erp.general_wms.R
|
|
|
-import uas.erp.general_wms.util.AndroidUtil
|
|
|
-import uas.erp.general_wms.util.FakeX509TrustManager
|
|
|
-import uas.erp.general_wms.util.SoundUtil
|
|
|
-import java.util.*
|
|
|
-import kotlin.properties.Delegates
|
|
|
-
|
|
|
-/**
|
|
|
- * Created by sw on 2025-10-13
|
|
|
- */
|
|
|
-class PdaApplicationKT2 : Application() {
|
|
|
-
|
|
|
- //替代java的静态写法
|
|
|
- companion object {
|
|
|
- private val TAG = "PdaApplicationKT2"
|
|
|
- var context: Context by Delegates.notNull()
|
|
|
- var mRequestQueue: RequestQueue? = null
|
|
|
- var mVersionCode: Int = 1
|
|
|
- var mAudioAttributes: AudioAttributes? = null
|
|
|
- var mSoundPool: SoundPool? = null
|
|
|
- var mSoundMap: HashMap<Integer, Integer>? = null
|
|
|
- //用于限制属性的setter访问权限,使其只能在类内部修改,而getter仍然可以公开访问。
|
|
|
- // 这种机制常用于保护属性的完整性,同时允许外部读取。
|
|
|
- private set
|
|
|
- }
|
|
|
-
|
|
|
- override fun onCreate() {
|
|
|
- super.onCreate()
|
|
|
- context = applicationContext
|
|
|
-
|
|
|
- MultiDex.install(this)
|
|
|
-
|
|
|
- FakeX509TrustManager.allowAllSSL() //去掉SSL证书验证
|
|
|
- if (mRequestQueue == null) {
|
|
|
- mRequestQueue = Volley.newRequestQueue(this)
|
|
|
- }
|
|
|
-
|
|
|
- //Stetho调试工具初始化
|
|
|
- Stetho.initializeWithDefaults(this)
|
|
|
-
|
|
|
- mVersionCode = AndroidUtil.getVersionCode(this)
|
|
|
-
|
|
|
- if (Build.VERSION.SDK_INT >= 21) {
|
|
|
- mAudioAttributes = AudioAttributes.Builder()
|
|
|
- .setUsage(AudioAttributes.USAGE_NOTIFICATION)
|
|
|
- .setContentType(AudioAttributes.CONTENT_TYPE_MUSIC)
|
|
|
- .build()
|
|
|
- mSoundPool = SoundPool.Builder()
|
|
|
- .setAudioAttributes(mAudioAttributes)
|
|
|
- .setMaxStreams(4)
|
|
|
- .build()
|
|
|
- } else {
|
|
|
- mSoundPool = SoundPool(4, AudioAttributes.CONTENT_TYPE_MUSIC, 0)
|
|
|
- }
|
|
|
-
|
|
|
-// mSoundMap = mutableMapOf()
|
|
|
-// mSoundMap.put(SoundUtil.SOUND_ARIEL, mSoundPool.load(this, R.raw.ariel, 1))
|
|
|
-//
|
|
|
-// //友盟统计SDK
|
|
|
-// initUmeng()
|
|
|
-
|
|
|
-
|
|
|
- //还能直接这么使用判断方法
|
|
|
- var aa: Int = 0
|
|
|
- require(aa > 0) { "存款为${aa}" }
|
|
|
-
|
|
|
- }
|
|
|
-
|
|
|
-}
|