From 669bfcd904cc72f3775629c5782f2e45352d209c Mon Sep 17 00:00:00 2001 From: gmasil <54176035+gmasil@users.noreply.github.com> Date: Thu, 21 Sep 2023 12:55:14 +0200 Subject: [PATCH] remove separate options to enable animated thumbnails for files and folders --- .../gallery/pro/activities/MainActivity.kt | 8 +++--- .../gallery/pro/adapters/DirectoryAdapter.kt | 2 +- .../dialogs/ChangeFileThumbnailStyleDialog.kt | 17 ++---------- .../ChangeFolderThumbnailStyleDialog.kt | 27 +++---------------- .../gallery/pro/helpers/Config.kt | 4 --- .../gallery/pro/helpers/Constants.kt | 1 - .../dialog_change_folder_thumbnail_style.xml | 8 ------ 7 files changed, 11 insertions(+), 56 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt index 4fcf65b7b..b52bd673e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MainActivity.kt @@ -77,7 +77,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { private var mDirs = ArrayList() private var mDirsIgnoringSearch = ArrayList() - private var mStoredAnimateGifsInFolders = true + private var mStoredAnimateGifs = true private var mStoredCropThumbnails = true private var mStoredScrollHorizontally = true private var mStoredTextColor = 0 @@ -198,8 +198,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { refreshMenuItems() - if (mStoredAnimateGifsInFolders != config.animateGifsInFolders) { - getRecyclerAdapter()?.updateAnimateGifs(config.animateGifsInFolders) + if (mStoredAnimateGifs != config.animateGifs) { + getRecyclerAdapter()?.updateAnimateGifs(config.animateGifs) } if (mStoredCropThumbnails != config.cropThumbnails) { @@ -438,7 +438,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { mStoredTextColor = getProperTextColor() mStoredPrimaryColor = getProperPrimaryColor() config.apply { - mStoredAnimateGifsInFolders = animateGifsInFolders + mStoredAnimateGifs = animateGifs mStoredCropThumbnails = cropThumbnails mStoredScrollHorizontally = scrollHorizontally mStoredStyleString = "$folderStyle$showFolderMediaCount$limitFolderTitle" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index d0382da36..80809b34d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -55,7 +55,7 @@ class DirectoryAdapter( private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST private var pinnedFolders = config.pinnedFolders private var scrollHorizontally = config.scrollHorizontally - private var animateGifs = config.animateGifsInFolders + private var animateGifs = config.animateGifs private var cropThumbnails = config.cropThumbnails private var groupDirectSubfolders = config.groupDirectSubfolders private var currentDirectoriesHash = dirs.hashCode() 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 index 37e4de79f..2070f406d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFileThumbnailStyleDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFileThumbnailStyleDialog.kt @@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.pro.dialogs import android.content.DialogInterface import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.dialogs.RadioGroupDialog -import com.simplemobiletools.commons.extensions.beVisibleIf import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.models.RadioItem @@ -23,10 +22,7 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI dialogFileStyleShowThumbnailFileTypes.isChecked = config.showThumbnailFileTypes dialogFileStyleMarkFavoriteItems.isChecked = config.markFavoriteItems - dialogFileStyleRoundedCornersHolder.setOnClickListener { - dialogFileStyleRoundedCorners.toggle() - updateAnimateGifsCheckbox() - } + dialogFileStyleRoundedCornersHolder.setOnClickListener { dialogFileStyleRoundedCorners.toggle() } dialogFileStyleAnimateGifsHolder.setOnClickListener { dialogFileStyleAnimateGifs.toggle() } dialogFileStyleShowThumbnailVideoDurationHolder.setOnClickListener { dialogFileStyleShowThumbnailVideoDuration.toggle() } dialogFileStyleShowThumbnailFileTypesHolder.setOnClickListener { dialogFileStyleShowThumbnailFileTypes.toggle() } @@ -52,7 +48,6 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI } updateThumbnailSpacingText() - updateAnimateGifsCheckbox() activity.getAlertDialogBuilder() .setPositiveButton(com.simplemobiletools.commons.R.string.ok, this) @@ -64,21 +59,13 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI override fun onClick(dialog: DialogInterface, which: Int) { config.fileRoundedCorners = binding.dialogFileStyleRoundedCorners.isChecked - if (binding.dialogFileStyleRoundedCorners.isChecked) { - config.animateGifs = false - } else { - config.animateGifs = binding.dialogFileStyleAnimateGifs.isChecked - } + config.animateGifs = binding.dialogFileStyleAnimateGifs.isChecked config.showThumbnailVideoDuration = binding.dialogFileStyleShowThumbnailVideoDuration.isChecked config.showThumbnailFileTypes = binding.dialogFileStyleShowThumbnailFileTypes.isChecked config.markFavoriteItems = binding.dialogFileStyleMarkFavoriteItems.isChecked config.thumbnailSpacing = thumbnailSpacing } - private fun updateAnimateGifsCheckbox() { - binding.dialogFileStyleAnimateGifs.beVisibleIf(!binding.dialogFileStyleRoundedCorners.isChecked) - } - private fun updateThumbnailSpacingText() { binding.dialogFileStyleSpacing.text = "${thumbnailSpacing}x" } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFolderThumbnailStyleDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFolderThumbnailStyleDialog.kt index aea93587f..06173bafa 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFolderThumbnailStyleDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/dialogs/ChangeFolderThumbnailStyleDialog.kt @@ -20,7 +20,6 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal private var config = activity.config private val binding = DialogChangeFolderThumbnailStyleBinding.inflate(activity.layoutInflater).apply { dialogFolderLimitTitle.isChecked = config.limitFolderTitle - dialogAnimateGifsInFolders.isChecked = config.animateGifsInFolders } init { @@ -32,7 +31,6 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal setupStyle() setupMediaCount() updateSample() - updateAnimateGifsCheckbox() } } } @@ -41,7 +39,6 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal val styleRadio = binding.dialogRadioFolderStyle styleRadio.setOnCheckedChangeListener { group, checkedId -> updateSample() - updateAnimateGifsCheckbox() } val styleBtn = when (config.folderStyle) { @@ -120,7 +117,10 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal } override fun onClick(dialog: DialogInterface, which: Int) { - val style = getStyle() + val style = when (binding.dialogRadioFolderStyle.checkedRadioButtonId) { + R.id.dialog_radio_folder_square -> FOLDER_STYLE_SQUARE + else -> FOLDER_STYLE_ROUNDED_CORNERS + } val count = when (binding.dialogRadioFolderCountHolder.checkedRadioButtonId) { R.id.dialog_radio_folder_count_line -> FOLDER_MEDIA_CNT_LINE @@ -131,25 +131,6 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal config.folderStyle = style config.showFolderMediaCount = count config.limitFolderTitle = binding.dialogFolderLimitTitle.isChecked - - if (style == FOLDER_STYLE_ROUNDED_CORNERS) { - config.animateGifsInFolders = false - } else { - config.animateGifsInFolders = binding.dialogAnimateGifsInFolders.isChecked - } - callback() } - - private fun getStyle(): Int { - return when (binding.dialogRadioFolderStyle.checkedRadioButtonId) { - R.id.dialog_radio_folder_square -> FOLDER_STYLE_SQUARE - else -> FOLDER_STYLE_ROUNDED_CORNERS - } - } - - private fun updateAnimateGifsCheckbox() { - val style = getStyle() - binding.dialogAnimateGifsInFolders.beVisibleIf(style != FOLDER_STYLE_ROUNDED_CORNERS) - } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt index a3928f47b..b50e69740 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Config.kt @@ -164,10 +164,6 @@ class Config(context: Context) : BaseConfig(context) { get() = prefs.getBoolean(ANIMATE_GIFS, false) set(animateGifs) = prefs.edit().putBoolean(ANIMATE_GIFS, animateGifs).apply() - var animateGifsInFolders: Boolean - get() = prefs.getBoolean(ANIMATE_GIFS_IN_FOLDERS, false) - set(animateGifsInFolders) = prefs.edit().putBoolean(ANIMATE_GIFS_IN_FOLDERS, animateGifsInFolders).apply() - var maxBrightness: Boolean get() = prefs.getBoolean(MAX_BRIGHTNESS, false) set(maxBrightness) = prefs.edit().putBoolean(MAX_BRIGHTNESS, maxBrightness).apply() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt index 830e861e6..d5af5d1a3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/helpers/Constants.kt @@ -18,7 +18,6 @@ const val REMEMBER_LAST_VIDEO_POSITION = "remember_last_video_position" const val LOOP_VIDEOS = "loop_videos" const val OPEN_VIDEOS_ON_SEPARATE_SCREEN = "open_videos_on_separate_screen" const val ANIMATE_GIFS = "animate_gifs" -const val ANIMATE_GIFS_IN_FOLDERS = "animate_gifs_in_folders" const val MAX_BRIGHTNESS = "max_brightness" const val CROP_THUMBNAILS = "crop_thumbnails" const val SHOW_THUMBNAIL_VIDEO_DURATION = "show_thumbnail_video_duration" diff --git a/app/src/main/res/layout/dialog_change_folder_thumbnail_style.xml b/app/src/main/res/layout/dialog_change_folder_thumbnail_style.xml index 6592ab580..e29763f1a 100644 --- a/app/src/main/res/layout/dialog_change_folder_thumbnail_style.xml +++ b/app/src/main/res/layout/dialog_change_folder_thumbnail_style.xml @@ -87,13 +87,5 @@ android:paddingBottom="@dimen/activity_margin" android:text="@string/limit_folder_title" /> - -