Make password dialog behavior the same as with protected PDFs

This commit is contained in:
Ensar Sarajčić 2023-07-07 16:48:22 +02:00
parent 131adb8c28
commit 7776dd6af4
2 changed files with 5 additions and 3 deletions

View File

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

View File

@ -29,6 +29,7 @@ class DecompressActivity : SimpleActivity() {
private var currentPath = ""
private var uri: Uri? = null
private var password: String? = null
private var passwordDialog: EnterPasswordDialog? = null
override fun onCreate(savedInstanceState: Bundle?) {
isMaterialActivity = true
@ -195,7 +196,7 @@ class DecompressActivity : SimpleActivity() {
if (passwordException.type == Type.WRONG_PASSWORD) {
if (password != null) {
showErrorToast(getString(R.string.invalid_password))
finish()
passwordDialog?.clearPassword()
} else {
askForPassword()
}
@ -216,10 +217,11 @@ class DecompressActivity : SimpleActivity() {
val listItem = ListItem(filename, filename.getFilenameFromPath(), zipEntry.isDirectory, 0, 0L, lastModified, false, false)
allFiles.add(listItem)
}
passwordDialog?.dismiss(notify = false)
}
private fun askForPassword() {
EnterPasswordDialog(
passwordDialog = EnterPasswordDialog(
this,
callback = { newPassword ->
password = newPassword