加上exitProcess

This commit is contained in:
Raymond Yang 2023-02-10 10:36:51 +08:00
parent 77df0eb8a5
commit d8d351831c
2 changed files with 10 additions and 7 deletions

View File

@ -12,6 +12,7 @@ class MyApplication : Application(), Application.ActivityLifecycleCallbacks {
override fun onCreate() {
super.onCreate()
instance = this
registerActivityLifecycleCallbacks(this)
}
private var currentActivity: Activity? = null
@ -32,7 +33,7 @@ class MyApplication : Application(), Application.ActivityLifecycleCallbacks {
override fun onActivityDestroyed(p0: Activity) {
if (currentActivity?.equals(p0) == true) {
Log.e("APP", "EXIT...")
Log.e("MyApplication", "EXIT...")
onTerminate()
exitProcess(0)
}

View File

@ -47,14 +47,16 @@ class MainActivity : AppCompatActivity() {
initObservers()
}
override fun onBackPressed() {
super.onBackPressed()
finish()
}
override fun onDestroy() {
super.onDestroy()
MainScope().launch {
for (i in 0 until splitVideoViewAdapter.itemCount) {
splitVideoViewAdapter.destroy(i)
//delay(100)
}
for (i in 0 until splitVideoViewAdapter.itemCount) {
splitVideoViewAdapter.destroy(i)
}
super.onDestroy()
}
private fun initContentView() = binding.apply {