Always remove task

This commit is contained in:
vvb2060
2022-06-09 19:39:43 +08:00
committed by John Wu
parent cae58c8790
commit 42606efe56
4 changed files with 13 additions and 10 deletions

View File

@@ -27,6 +27,7 @@
android:name=".ui.surequest.SuRequestActivity"
android:directBootAware="true"
android:exported="false"
android:taskAffinity=""
tools:ignore="AppLinkUrlError">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

View File

@@ -24,13 +24,9 @@ open class SuRequestActivity : UIActivity<ActivityRequestBinding>() {
override val layoutRes: Int = R.layout.activity_request
override val viewModel: SuRequestViewModel by viewModel()
override fun onBackPressed() {
viewModel.denyPressed()
}
override fun onCreate(savedInstanceState: Bundle?) {
supportRequestWindowFeature(Window.FEATURE_NO_TITLE)
lockOrientation()
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED
window.addFlags(WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON)
window.addFlags(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.S) {
@@ -62,7 +58,11 @@ open class SuRequestActivity : UIActivity<ActivityRequestBinding>() {
return theme
}
private fun lockOrientation() {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LOCKED
override fun onBackPressed() {
viewModel.denyPressed()
}
override fun finish() {
super.finishAndRemoveTask()
}
}