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 {
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.android.support:multidex:1.0.2'
implementation 'com.google.code.gson:gson:2.8.2'

View File

@ -63,6 +63,7 @@ class SettingsActivity : SimpleActivity() {
setupShowExtendedDetails()
setupHideExtendedDetails()
setupManageExtendedDetails()
setupSkipDeleteConfirmation()
updateTextColors(settings_holder)
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() {
settings_screen_rotation.text = getScreenRotationText()
settings_screen_rotation_holder.setOnClickListener {

View File

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

View File

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

View File

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

View File

@ -895,5 +895,28 @@
android:text="@string/keep_last_modified"/>
</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>
</ScrollView>