From 16159b3d84faf1d94f98a7d195f418dcf8540871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ensar=20Saraj=C4=8Di=C4=87?= Date: Fri, 7 Jul 2023 14:43:59 +0200 Subject: [PATCH] Keep password dialog displayed until correct password is entered or cancelled This requires updates to Simple-Commons to be merged first https://github.com/SimpleMobileTools/Simple-Commons/pull/1725 --- app/build.gradle | 2 +- .../filemanager/pro/activities/PDFViewerActivity.kt | 8 ++++++-- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 6ee0a7d0..e5bfbf5a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -64,7 +64,7 @@ android { } dependencies { - implementation 'com.github.SimpleMobileTools:Simple-Commons:db25f91be3' + implementation 'com.github.esensar:Simple-Commons:26a4275f9b' implementation 'com.github.tibbi:AndroidPdfViewer:e6a533125b' implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootShell:1.6' diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt index 949c60e7..f6ff9559 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/pro/activities/PDFViewerActivity.kt @@ -27,6 +27,7 @@ import kotlinx.android.synthetic.main.activity_pdf_viewer.top_shadow class PDFViewerActivity : SimpleActivity() { private var realFilePath = "" private var isFullScreen = false + private var passwordDialog: EnterPasswordDialog? = null override fun onCreate(savedInstanceState: Bundle?) { showTransparentTop = true @@ -113,9 +114,9 @@ class PDFViewerActivity : SimpleActivity() { // already entered a password and it was wrong if (filePassword != null) { showErrorToast(getString(R.string.invalid_password)) - finish() + passwordDialog?.clearPassword() } else { - EnterPasswordDialog( + passwordDialog = EnterPasswordDialog( this, callback = { password -> loadPdfViewer(uri, password) @@ -130,6 +131,9 @@ class PDFViewerActivity : SimpleActivity() { finish() } } + .onLoad { + passwordDialog?.dismiss(notify = false) + } .load() showSystemUI(true)