Fix activity leak on Android Q
This commit is contained in:
@@ -80,7 +80,7 @@ dependencies {
|
||||
implementation 'androidx.viewpager2:viewpager2:1.1.0-alpha01'
|
||||
implementation 'androidx.preference:preference-ktx:1.1.1'
|
||||
implementation 'androidx.work:work-runtime-ktx:2.5.0'
|
||||
implementation 'com.google.android.material:material:1.3.0-rc01'
|
||||
implementation 'com.google.android.material:material:1.3.0'
|
||||
//noinspection LifecycleAnnotationProcessorWithJava8
|
||||
kapt 'androidx.lifecycle:lifecycle-compiler:2.3.0-rc01'
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package org.koitharu.kotatsu.base.ui
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import android.view.MenuItem
|
||||
@@ -97,4 +98,16 @@ abstract class BaseActivity<B : ViewBinding> : AppCompatActivity(), OnApplyWindo
|
||||
super.onSupportActionModeFinished(mode)
|
||||
window?.statusBarColor = getThemeColor(android.R.attr.statusBarColor)
|
||||
}
|
||||
|
||||
override fun onBackPressed() {
|
||||
if ( // https://issuetracker.google.com/issues/139738913
|
||||
Build.VERSION.SDK_INT == Build.VERSION_CODES.Q &&
|
||||
isTaskRoot &&
|
||||
supportFragmentManager.backStackEntryCount == 0
|
||||
) {
|
||||
finishAfterTransition()
|
||||
} else {
|
||||
super.onBackPressed()
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user