added a toggle for always skipping Delete confirmation dialog

This commit is contained in:
tibbi 2018-02-23 23:30:09 +01:00
parent 72ffa243a5
commit 9280533c74
6 changed files with 40 additions and 4 deletions

View file

@ -46,7 +46,7 @@ ext {
} }
dependencies { dependencies {
implementation 'com.simplemobiletools:commons:3.12.22' implementation 'com.simplemobiletools:commons:3.12.24'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0'
implementation 'com.android.support:multidex:1.0.2' implementation 'com.android.support:multidex:1.0.2'
implementation 'com.google.code.gson:gson:2.8.2' implementation 'com.google.code.gson:gson:2.8.2'

View file

@ -63,6 +63,7 @@ class SettingsActivity : SimpleActivity() {
setupShowExtendedDetails() setupShowExtendedDetails()
setupHideExtendedDetails() setupHideExtendedDetails()
setupManageExtendedDetails() setupManageExtendedDetails()
setupSkipDeleteConfirmation()
updateTextColors(settings_holder) updateTextColors(settings_holder)
setupSectionColors() setupSectionColors()
} }
@ -363,6 +364,14 @@ class SettingsActivity : SimpleActivity() {
} }
} }
private fun setupSkipDeleteConfirmation() {
settings_skip_delete_confirmation.isChecked = config.skipDeleteConfirmation
settings_skip_delete_confirmation_holder.setOnClickListener {
settings_skip_delete_confirmation.toggle()
config.skipDeleteConfirmation = settings_skip_delete_confirmation.isChecked
}
}
private fun setupScreenRotation() { private fun setupScreenRotation() {
settings_screen_rotation.text = getScreenRotationText() settings_screen_rotation.text = getScreenRotationText()
settings_screen_rotation_holder.setOnClickListener { settings_screen_rotation_holder.setOnClickListener {

View file

@ -724,7 +724,7 @@ class ViewPagerActivity : SimpleActivity(), ViewPager.OnPageChangeListener, View
} }
private fun checkDeleteConfirmation() { private fun checkDeleteConfirmation() {
if (mSkipConfirmationDialog) { if (mSkipConfirmationDialog || config.skipDeleteConfirmation) {
deleteConfirmed() deleteConfirmed()
} else { } else {
askConfirmDelete() askConfirmDelete()

View file

@ -233,8 +233,12 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: MutableList<Direc
} }
private fun askConfirmDelete() { private fun askConfirmDelete() {
ConfirmationDialog(activity) { if (config.skipDeleteConfirmation) {
deleteFiles() deleteFiles()
} else {
ConfirmationDialog(activity) {
deleteFiles()
}
} }
} }

View file

@ -194,7 +194,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
} }
private fun checkDeleteConfirmation() { private fun checkDeleteConfirmation() {
if (skipConfirmationDialog) { if (skipConfirmationDialog || config.skipDeleteConfirmation) {
deleteFiles() deleteFiles()
} else { } else {
askConfirmDelete() askConfirmDelete()

View file

@ -895,5 +895,28 @@
android:text="@string/keep_last_modified"/> android:text="@string/keep_last_modified"/>
</RelativeLayout> </RelativeLayout>
<RelativeLayout
android:id="@+id/settings_skip_delete_confirmation_holder"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/medium_margin"
android:background="?attr/selectableItemBackground"
android:paddingBottom="@dimen/activity_margin"
android:paddingLeft="@dimen/normal_margin"
android:paddingRight="@dimen/normal_margin"
android:paddingTop="@dimen/activity_margin">
<com.simplemobiletools.commons.views.MySwitchCompat
android:id="@+id/settings_skip_delete_confirmation"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@null"
android:clickable="false"
android:paddingLeft="@dimen/medium_margin"
android:paddingStart="@dimen/medium_margin"
android:text="@string/skip_delete_confirmation"/>
</RelativeLayout>
</LinearLayout> </LinearLayout>
</ScrollView> </ScrollView>