From e92c6eca557a75fdd4322637d0f2b26e9e7f7e2a Mon Sep 17 00:00:00 2001 From: pacien Date: Thu, 29 Mar 2018 15:11:20 +0200 Subject: Fix back button behaviour on status screen --- .../main/java/org/pacien/tincapp/activities/StartActivity.kt | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'app/src/main/java') diff --git a/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt b/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt index 6e74891..64d2d43 100644 --- a/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt +++ b/app/src/main/java/org/pacien/tincapp/activities/StartActivity.kt @@ -147,7 +147,7 @@ class StartActivity : BaseActivity() { override fun onResume() { super.onResume() - if (TincVpnService.isConnected()) openStatusActivity() + if (TincVpnService.isConnected()) openStatusActivity(false) broadcastMapper.register() } @@ -174,6 +174,10 @@ class StartActivity : BaseActivity() { connectDialog?.dismiss() } - private fun openStatusActivity() = - startActivity(Intent(this, StatusActivity::class.java)) + private fun openStatusActivity(transition: Boolean = true) = + startActivity( + Intent(this, StatusActivity::class.java) + .addFlags(Intent.FLAG_ACTIVITY_NEW_TASK) + .addFlags(Intent.FLAG_ACTIVITY_CLEAR_TASK) + .apply { if (!transition) addFlags(Intent.FLAG_ACTIVITY_NO_ANIMATION) }) } -- cgit v1.2.3