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
This commit is contained in:
Ensar Sarajčić
2023-07-07 14:43:59 +02:00
parent 85559abbf4
commit 16159b3d84
2 changed files with 7 additions and 3 deletions

View File

@@ -64,7 +64,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:db25f91be3' implementation 'com.github.esensar:Simple-Commons:26a4275f9b'
implementation 'com.github.tibbi:AndroidPdfViewer:e6a533125b' implementation 'com.github.tibbi:AndroidPdfViewer:e6a533125b'
implementation 'com.github.Stericson:RootTools:df729dcb13' implementation 'com.github.Stericson:RootTools:df729dcb13'
implementation 'com.github.Stericson:RootShell:1.6' implementation 'com.github.Stericson:RootShell:1.6'

View File

@@ -27,6 +27,7 @@ import kotlinx.android.synthetic.main.activity_pdf_viewer.top_shadow
class PDFViewerActivity : SimpleActivity() { class PDFViewerActivity : SimpleActivity() {
private var realFilePath = "" private var realFilePath = ""
private var isFullScreen = false private var isFullScreen = false
private var passwordDialog: EnterPasswordDialog? = null
override fun onCreate(savedInstanceState: Bundle?) { override fun onCreate(savedInstanceState: Bundle?) {
showTransparentTop = true showTransparentTop = true
@@ -113,9 +114,9 @@ class PDFViewerActivity : SimpleActivity() {
// already entered a password and it was wrong // already entered a password and it was wrong
if (filePassword != null) { if (filePassword != null) {
showErrorToast(getString(R.string.invalid_password)) showErrorToast(getString(R.string.invalid_password))
finish() passwordDialog?.clearPassword()
} else { } else {
EnterPasswordDialog( passwordDialog = EnterPasswordDialog(
this, this,
callback = { password -> callback = { password ->
loadPdfViewer(uri, password) loadPdfViewer(uri, password)
@@ -130,6 +131,9 @@ class PDFViewerActivity : SimpleActivity() {
finish() finish()
} }
} }
.onLoad {
passwordDialog?.dismiss(notify = false)
}
.load() .load()
showSystemUI(true) showSystemUI(true)