diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt index 4e7bff317..7757f501c 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/SettingsActivity.kt @@ -12,6 +12,7 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.commons.helpers.* import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.gallery.pro.R +import com.simplemobiletools.gallery.pro.dialogs.ChangeFileThumbnailStyleDialog import com.simplemobiletools.gallery.pro.dialogs.ChangeFolderThumbnailStyleDialog import com.simplemobiletools.gallery.pro.dialogs.ManageBottomActionsDialog import com.simplemobiletools.gallery.pro.dialogs.ManageExtendedDetailsDialog @@ -53,7 +54,6 @@ class SettingsActivity : SimpleActivity() { setupRememberLastVideo() setupLoopVideos() setupOpenVideosOnSeparateScreen() - setupAnimateGifs() setupMaxBrightness() setupCropThumbnails() setupDarkBackground() @@ -68,8 +68,6 @@ class SettingsActivity : SimpleActivity() { setupAllowRotatingWithGestures() setupShowNotch() setupBottomActions() - setupThumbnailVideoDuration() - setupThumbnailFileTypes() setupFileThumbnailStyle() setupFolderThumbnailStyle() setupKeepLastModified() @@ -231,14 +229,6 @@ class SettingsActivity : SimpleActivity() { } } - private fun setupAnimateGifs() { - settings_animate_gifs.isChecked = config.animateGifs - settings_animate_gifs_holder.setOnClickListener { - settings_animate_gifs.toggle() - config.animateGifs = settings_animate_gifs.isChecked - } - } - private fun setupMaxBrightness() { settings_max_brightness.isChecked = config.maxBrightness settings_max_brightness_holder.setOnClickListener { @@ -255,22 +245,6 @@ class SettingsActivity : SimpleActivity() { } } - private fun setupThumbnailVideoDuration() { - settings_show_thumbnail_video_duration.isChecked = config.showThumbnailVideoDuration - settings_show_thumbnail_video_duration_holder.setOnClickListener { - settings_show_thumbnail_video_duration.toggle() - config.showThumbnailVideoDuration = settings_show_thumbnail_video_duration.isChecked - } - } - - private fun setupThumbnailFileTypes() { - settings_show_thumbnail_file_types.isChecked = config.showThumbnailFileTypes - settings_show_thumbnail_file_types_holder.setOnClickListener { - settings_show_thumbnail_file_types.toggle() - config.showThumbnailFileTypes = settings_show_thumbnail_file_types.isChecked - } - } - private fun setupDarkBackground() { settings_black_background.isChecked = config.blackBackground settings_black_background_holder.setOnClickListener { @@ -401,7 +375,7 @@ class SettingsActivity : SimpleActivity() { private fun setupFileThumbnailStyle() { settings_file_thumbnail_style_holder.setOnClickListener { - + ChangeFileThumbnailStyleDialog(this) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFileThumbnailStyleDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFileThumbnailStyleDialog.kt new file mode 100644 index 000000000..d47a30150 --- /dev/null +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFileThumbnailStyleDialog.kt @@ -0,0 +1,40 @@ +package com.simplemobiletools.gallery.pro.dialogs + +import android.content.DialogInterface +import android.view.View +import androidx.appcompat.app.AlertDialog +import com.simplemobiletools.commons.activities.BaseSimpleActivity +import com.simplemobiletools.commons.extensions.setupDialogStuff +import com.simplemobiletools.gallery.pro.R +import com.simplemobiletools.gallery.pro.extensions.config +import kotlinx.android.synthetic.main.dialog_change_file_thumbnail_style.view.* + +class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogInterface.OnClickListener { + private var config = activity.config + private var view: View + + init { + view = activity.layoutInflater.inflate(R.layout.dialog_change_file_thumbnail_style, null).apply { + dialog_file_style_animate_gifs.isChecked = config.animateGifs + dialog_file_style_show_thumbnail_video_duration.isChecked = config.showThumbnailVideoDuration + dialog_file_style_show_thumbnail_file_types.isChecked = config.showThumbnailFileTypes + + dialog_file_style_animate_gifs_holder.setOnClickListener { dialog_file_style_animate_gifs.toggle() } + dialog_file_style_show_thumbnail_video_duration_holder.setOnClickListener { dialog_file_style_show_thumbnail_video_duration.toggle() } + dialog_file_style_show_thumbnail_file_types_holder.setOnClickListener { dialog_file_style_show_thumbnail_file_types.toggle() } + } + + AlertDialog.Builder(activity) + .setPositiveButton(R.string.ok, this) + .setNegativeButton(R.string.cancel, null) + .create().apply { + activity.setupDialogStuff(view, this) + } + } + + override fun onClick(dialog: DialogInterface, which: Int) { + config.animateGifs = view.dialog_file_style_animate_gifs.isChecked + config.showThumbnailVideoDuration = view.dialog_file_style_show_thumbnail_video_duration.isChecked + config.showThumbnailFileTypes = view.dialog_file_style_show_thumbnail_file_types.isChecked + } +} diff --git a/app/src/main/res/layout/activity_settings.xml b/app/src/main/res/layout/activity_settings.xml index b54160fa3..ae582dca5 100644 --- a/app/src/main/res/layout/activity_settings.xml +++ b/app/src/main/res/layout/activity_settings.xml @@ -320,29 +320,6 @@ android:textAllCaps="true" android:textSize="@dimen/smaller_text_size" /> - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + +