Fix selection mode instance issue

This commit is contained in:
J-Jamet committed 2022-04-07 13:22:19 +02:00
1 parent 108b8df280
commit 7e70b59a59
3 files changed
+12 -4

No files matched your search

@@ -224,7 +224,9 @@ class EntrySelectionLauncherActivity : DatabaseModeActivity() {
})
}
// New task needed because don't launch from an Activity context
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or Intent.FLAG_ACTIVITY_CLEAR_TASK
intent.flags = Intent.FLAG_ACTIVITY_NEW_TASK or
Intent.FLAG_ACTIVITY_CLEAR_TASK or
Intent.FLAG_ACTIVITY_EXCLUDE_FROM_RECENTS
context.startActivity(intent)
}
}
@@ -1,5 +1,6 @@
package com.kunzisoft.keepass.activities.legacy
import android.os.Build
import android.os.Bundle
import android.os.Handler
import android.os.Looper
@@ -97,9 +98,13 @@ abstract class DatabaseModeActivity : DatabaseActivity() {
// To move the app in background and return to the main app
moveTaskToBack(true)
// To remove this instance in the OS app selector
Handler(Looper.getMainLooper()).postDelayed({
finish()
}, 500)
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
finishAndRemoveTask()
} else {
Handler(Looper.getMainLooper()).postDelayed({
finish()
}, 500)
}
}
override fun onCreate(savedInstanceState: Bundle?) {