From b6b8bba666d6b6fab1462386165c84e2a41e5e85 Mon Sep 17 00:00:00 2001 From: Hardcore Sushi Date: Thu, 21 Apr 2022 10:46:31 +0200 Subject: [PATCH] Save checkbox state if opening volume fails --- app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt b/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt index 2dac188..37aa014 100644 --- a/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt +++ b/app/src/main/java/sushi/hardcore/droidfs/MainActivity.kt @@ -520,10 +520,12 @@ class MainActivity : BaseActivity(), VolumeAdapter.Listener { ) } - private fun askForPassword(volume: Volume, position: Int) { + private fun askForPassword(volume: Volume, position: Int, savePasswordHash: Boolean = false) { val dialogBinding = DialogOpenVolumeBinding.inflate(layoutInflater) if (!usfFingerprint || fingerprintProtector == null || volume.encryptedHash != null) { dialogBinding.checkboxSavePassword.visibility = View.GONE + } else { + dialogBinding.checkboxSavePassword.isChecked = savePasswordHash } dialogBinding.checkboxDefaultOpen.isChecked = defaultVolumeName == volume.name val dialog = CustomAlertDialogBuilder(this, themeValue) @@ -594,7 +596,7 @@ class MainActivity : BaseActivity(), VolumeAdapter.Listener { .setMessage(R.string.open_volume_failed_msg) .setPositiveButton(R.string.ok, null) .setOnDismissListener { - askForPassword(volume, position) + askForPassword(volume, position, savePasswordHash) } .show() }