diff options
author | Harsh Shandilya <msfjarvis@gmail.com> | 2019-11-29 14:47:23 +0530 |
---|---|---|
committer | GitHub <noreply@github.com> | 2019-11-29 14:47:23 +0530 |
commit | fdbbb467b2fd15b01f50fd9ef1b3daf849c8ba34 (patch) | |
tree | 3c285f4d715021fd809f641753610ed7a3d9594a | |
parent | 241986e4faddc927b2cc5e2b326cd97d987f5152 (diff) |
LaunchActivity: Optionally delay finish call to allow transition… (#583)
Signed-off-by: Harsh Shandilya <msfjarvis@gmail.com>
-rw-r--r-- | app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt b/app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt index 3b913c12..7f7b304c 100644 --- a/app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt +++ b/app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt @@ -6,6 +6,7 @@ package com.zeapo.pwdstore import android.content.Intent import android.os.Bundle +import android.os.Handler import androidx.appcompat.app.AppCompatActivity import androidx.preference.PreferenceManager import com.zeapo.pwdstore.crypto.PgpActivity @@ -21,7 +22,7 @@ class LaunchActivity : AppCompatActivity() { Authenticator(this) { when (it) { is AuthenticationResult.Success -> { - startTargetActivity() + startTargetActivity(false) } is AuthenticationResult.UnrecoverableError -> { finish() @@ -31,11 +32,11 @@ class LaunchActivity : AppCompatActivity() { } }.authenticate() } else { - startTargetActivity() + startTargetActivity(true) } } - private fun startTargetActivity() { + private fun startTargetActivity(noAuth: Boolean) { if (intent?.getStringExtra("OPERATION") == "DECRYPT") { val decryptIntent = Intent(this, PgpActivity::class.java) decryptIntent.putExtra("NAME", intent.getStringExtra("NAME")) @@ -48,6 +49,6 @@ class LaunchActivity : AppCompatActivity() { startActivity(Intent(this, PasswordStore::class.java)) } overridePendingTransition(android.R.anim.fade_in, android.R.anim.fade_out) - finish() + Handler().postDelayed({ finish() }, if (noAuth) 0L else 500L) } } |