diff --git a/app/build.gradle b/app/build.gradle
index 664509f03..158049f58 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -48,7 +48,7 @@ android {
}
dependencies {
- implementation 'com.simplemobiletools:commons:5.2.15'
+ implementation 'com.simplemobiletools:commons:5.2.17'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'androidx.multidex:multidex:2.0.0'
implementation 'it.sephiroth.android.exif:library:1.0.1'
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt
index 84719102c..d2ab4df1f 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt
@@ -117,7 +117,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
showFilterMediaDialog()
}
- mIsPasswordProtectionPending = config.appPasswordProtectionOn
+ mIsPasswordProtectionPending = config.isAppPasswordProtectionOn
setupLatestMediaId()
// notify some users about the Clock app
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt
index 502975d2d..c50d01c1a 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/SettingsActivity.kt
@@ -55,6 +55,7 @@ class SettingsActivity : SimpleActivity() {
setupHideSystemUI()
setupHiddenItemPasswordProtection()
setupAppPasswordProtection()
+ setupFileDeletionPasswordProtection()
setupDeleteEmptyFolders()
setupAllowPhotoGestures()
setupAllowVideoGestures()
@@ -236,19 +237,19 @@ class SettingsActivity : SimpleActivity() {
}
private fun setupHiddenItemPasswordProtection() {
- settings_hidden_item_password_protection.isChecked = config.isPasswordProtectionOn
+ settings_hidden_item_password_protection.isChecked = config.isHiddenPasswordProtectionOn
settings_hidden_item_password_protection_holder.setOnClickListener {
- val tabToShow = if (config.isPasswordProtectionOn) config.protectionType else SHOW_ALL_TABS
- SecurityDialog(this, config.passwordHash, tabToShow) { hash, type, success ->
+ val tabToShow = if (config.isHiddenPasswordProtectionOn) config.hiddenProtectionType else SHOW_ALL_TABS
+ SecurityDialog(this, config.hiddenPasswordHash, tabToShow) { hash, type, success ->
if (success) {
- val hasPasswordProtection = config.isPasswordProtectionOn
+ val hasPasswordProtection = config.isHiddenPasswordProtectionOn
settings_hidden_item_password_protection.isChecked = !hasPasswordProtection
- config.isPasswordProtectionOn = !hasPasswordProtection
- config.passwordHash = if (hasPasswordProtection) "" else hash
- config.protectionType = type
+ config.isHiddenPasswordProtectionOn = !hasPasswordProtection
+ config.hiddenPasswordHash = if (hasPasswordProtection) "" else hash
+ config.hiddenProtectionType = type
- if (config.isPasswordProtectionOn) {
- val confirmationTextId = if (config.protectionType == PROTECTION_FINGERPRINT)
+ if (config.isHiddenPasswordProtectionOn) {
+ val confirmationTextId = if (config.hiddenProtectionType == PROTECTION_FINGERPRINT)
R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully
ConfirmationDialog(this, "", confirmationTextId, R.string.ok, 0) { }
}
@@ -258,18 +259,18 @@ class SettingsActivity : SimpleActivity() {
}
private fun setupAppPasswordProtection() {
- settings_app_password_protection.isChecked = config.appPasswordProtectionOn
+ settings_app_password_protection.isChecked = config.isAppPasswordProtectionOn
settings_app_password_protection_holder.setOnClickListener {
- val tabToShow = if (config.appPasswordProtectionOn) config.appProtectionType else SHOW_ALL_TABS
+ val tabToShow = if (config.isAppPasswordProtectionOn) config.appProtectionType else SHOW_ALL_TABS
SecurityDialog(this, config.appPasswordHash, tabToShow) { hash, type, success ->
if (success) {
- val hasPasswordProtection = config.appPasswordProtectionOn
+ val hasPasswordProtection = config.isAppPasswordProtectionOn
settings_app_password_protection.isChecked = !hasPasswordProtection
- config.appPasswordProtectionOn = !hasPasswordProtection
+ config.isAppPasswordProtectionOn = !hasPasswordProtection
config.appPasswordHash = if (hasPasswordProtection) "" else hash
config.appProtectionType = type
- if (config.appPasswordProtectionOn) {
+ if (config.isAppPasswordProtectionOn) {
val confirmationTextId = if (config.appProtectionType == PROTECTION_FINGERPRINT)
R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully
ConfirmationDialog(this, "", confirmationTextId, R.string.ok, 0) { }
@@ -279,6 +280,28 @@ class SettingsActivity : SimpleActivity() {
}
}
+ private fun setupFileDeletionPasswordProtection() {
+ settings_file_deletion_password_protection.isChecked = config.isDeletePasswordProtectionOn
+ settings_file_deletion_password_protection_holder.setOnClickListener {
+ val tabToShow = if (config.isDeletePasswordProtectionOn) config.deleteProtectionType else SHOW_ALL_TABS
+ SecurityDialog(this, config.deletePasswordHash, tabToShow) { hash, type, success ->
+ if (success) {
+ val hasPasswordProtection = config.isDeletePasswordProtectionOn
+ settings_file_deletion_password_protection.isChecked = !hasPasswordProtection
+ config.isDeletePasswordProtectionOn = !hasPasswordProtection
+ config.deletePasswordHash = if (hasPasswordProtection) "" else hash
+ config.deleteProtectionType = type
+
+ if (config.isDeletePasswordProtectionOn) {
+ val confirmationTextId = if (config.deleteProtectionType == PROTECTION_FINGERPRINT)
+ R.string.fingerprint_setup_successfully else R.string.protection_setup_successfully
+ ConfirmationDialog(this, "", confirmationTextId, R.string.ok, 0) { }
+ }
+ }
+ }
+ }
+ }
+
private fun setupDeleteEmptyFolders() {
settings_delete_empty_folders.isChecked = config.deleteEmptyFolders
settings_delete_empty_folders_holder.setOnClickListener {
diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
index d7f5812a4..eee326af9 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ViewPagerActivity.kt
@@ -270,7 +270,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
if (intent.extras?.containsKey(IS_VIEW_INTENT) == true) {
if (isShowHiddenFlagNeeded()) {
- if (!config.isPasswordProtectionOn) {
+ if (!config.isHiddenPasswordProtectionOn) {
config.temporarilyShowHidden = true
}
}
diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml
index f2271780d..480a71a42 100644
--- a/app/src/main/res/layout/activity_settings.xml
+++ b/app/src/main/res/layout/activity_settings.xml
@@ -945,6 +945,30 @@
+
+
+
+
+
+