From fdbbb467b2fd15b01f50fd9ef1b3daf849c8ba34 Mon Sep 17 00:00:00 2001 From: Harsh Shandilya Date: Fri, 29 Nov 2019 14:47:23 +0530 Subject: [PATCH] =?UTF-8?q?LaunchActivity:=20Optionally=20delay=20finish?= =?UTF-8?q?=20call=20to=20allow=20transition=E2=80=A6=20(#583)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Harsh Shandilya --- app/src/main/java/com/zeapo/pwdstore/LaunchActivity.kt | 9 +++++---- 1 file 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) } }