Added Separate option and move Security section and new string

This commit is contained in:
Will
2024-02-17 19:22:58 +01:00
parent 81741535c5
commit 30ea643f25
4 changed files with 71 additions and 32 deletions

View File

@@ -1090,13 +1090,9 @@ class MainActivity : SimpleActivity() {
private fun displayDeleteNotePrompt() {
DeleteNoteDialog(this, mCurrentNote) {
if (config.isAppPasswordProtectionOn) {
handleAppPasswordProtection {
mWasProtectionHandled = it
if (it) {
mIsPasswordProtectionPending = false
if (config.isDeletePasswordProtectionOn) {
handleDeletePasswordProtection {
deleteNote(it, mCurrentNote)
}
}
}
else

View File

@@ -65,6 +65,7 @@ class SettingsActivity : SimpleActivity() {
setupEnableAutomaticBackups()
setupManageAutomaticBackups()
setupAppPasswordProtection()
setupNoteDeletionPasswordProtection()
updateTextColors(binding.settingsNestedScrollview)
arrayOf(
@@ -420,4 +421,26 @@ class SettingsActivity : SimpleActivity() {
}
}
}
private fun setupNoteDeletionPasswordProtection() {
binding.settingsNoteDeletionPasswordProtection.isChecked = config.isDeletePasswordProtectionOn
binding.settingsNoteDeletionPasswordProtectionHolder.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
binding.settingsNoteDeletionPasswordProtection.isChecked = !hasPasswordProtection
config.isDeletePasswordProtectionOn = !hasPasswordProtection
config.deletePasswordHash = if (hasPasswordProtection) "" else hash
config.deleteProtectionType = type
if (config.isDeletePasswordProtectionOn) {
val confirmationTextId = if (config.deleteProtectionType == PROTECTION_FINGERPRINT)
org.fossify.commons.R.string.fingerprint_setup_successfully else org.fossify.commons.R.string.protection_setup_successfully
ConfirmationDialog(this, "", confirmationTextId, org.fossify.commons.R.string.ok, 0) { }
}
}
}
}
}
}

View File

@@ -351,6 +351,51 @@
android:id="@+id/settings_saving_divider"
layout="@layout/divider" />
<include
android:id="@+id/settings_extended_details_divider"
layout="@layout/divider" />
<TextView
android:id="@+id/settings_security_label"
style="@style/SettingsSectionLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security" />
<RelativeLayout
android:id="@+id/settings_app_password_protection_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.fossify.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_app_password_protection"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password_protect_whole_app" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_note_deletion_password_protection_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.fossify.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_note_deletion_password_protection"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password_protect_note_deletion" />
</RelativeLayout>
<include
android:id="@+id/settings_security_divider"
layout="@layout/divider" />
<TextView
android:id="@+id/settings_migrating_label"
style="@style/SettingsSectionLabelStyle"
@@ -412,32 +457,6 @@
</RelativeLayout>
<include
android:id="@+id/settings_extended_details_divider"
layout="@layout/divider" />
<TextView
android:id="@+id/settings_security_label"
style="@style/SettingsSectionLabelStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/security" />
<RelativeLayout
android:id="@+id/settings_app_password_protection_holder"
style="@style/SettingsHolderCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<org.fossify.commons.views.MyAppCompatCheckbox
android:id="@+id/settings_app_password_protection"
style="@style/SettingsCheckboxStyle"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/password_protect_whole_app" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_manage_automatic_backups_holder"
style="@style/SettingsHolderTextViewOneLinerStyle"

View File

@@ -60,6 +60,7 @@
<string name="use_incognito_mode">Use Incognito mode of keyboards</string>
<string name="move_done_checklist_items">Move done checklist items to the bottom</string>
<string name="add_new_checklist_items_top">Add new checklist items at the top</string>
<string name="password_protect_note_deletion">Password protect note deletion</string>
<!-- Checklists -->
<string name="checklist">Checklist</string>