Merge pull request #479 from Agustyn98/skip_delete_confirm

Option to skip the delete confirmation
This commit is contained in:
Tibor Kaputa 2021-06-13 22:09:05 +02:00 committed by GitHub
commit 59d6749ce6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 33 additions and 1 deletions

View File

@ -38,6 +38,7 @@ class SettingsActivity : SimpleActivity() {
setupAppPasswordProtection()
setupFileDeletionPasswordProtection()
setupKeepLastModified()
setupDeleteConfirmation()
setupEnableRootAccess()
updateTextColors(settings_holder)
setupSectionColors()
@ -206,6 +207,14 @@ class SettingsActivity : SimpleActivity() {
}
}
private fun setupDeleteConfirmation() {
settings_delete_confirmation.isChecked = config.skipDeleteConfirmation
settings_delete_confirmation_holder.setOnClickListener {
settings_delete_confirmation.toggle()
config.skipDeleteConfirmation = settings_delete_confirmation.isChecked
}
}
private fun setupEnableRootAccess() {
settings_enable_root_access_holder.beVisibleIf(config.isRootAvailable)
settings_enable_root_access.isChecked = config.enableRootAccess

View File

@ -123,7 +123,7 @@ class ItemsAdapter(activity: SimpleActivity, var listItems: MutableList<ListItem
R.id.cab_compress -> compressSelection()
R.id.cab_decompress -> decompressSelection()
R.id.cab_select_all -> selectAll()
R.id.cab_delete -> askConfirmDelete()
R.id.cab_delete -> if (config.skipDeleteConfirmation) deleteFiles() else askConfirmDelete()
}
}

View File

@ -239,6 +239,29 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/settings_delete_confirmation_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingStart="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin"
android:paddingEnd="@dimen/normal_margin"
android:paddingBottom="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_delete_confirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingStart="@dimen/medium_margin"
android:text="@string/skip_delete_confirmation"
app:switchPadding="@dimen/medium_margin" />
</RelativeLayout>
<com.simplemobiletools.commons.views.MyTextView
android:id="@+id/security_label"
android:layout_width="wrap_content"