remove separate options to enable animated thumbnails for files and folders

This commit is contained in:
gmasil 2023-09-21 12:55:14 +02:00
parent 6c0913570c
commit 669bfcd904
No known key found for this signature in database
GPG Key ID: 135FC0B941F3ECC7
7 changed files with 11 additions and 56 deletions

View File

@ -77,7 +77,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
private var mDirs = ArrayList<Directory>()
private var mDirsIgnoringSearch = ArrayList<Directory>()
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"

View File

@ -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()

View File

@ -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"
}

View File

@ -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)
}
}

View File

@ -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()

View File

@ -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"

View File

@ -87,13 +87,5 @@
android:paddingBottom="@dimen/activity_margin"
android:text="@string/limit_folder_title" />
<com.simplemobiletools.commons.views.MyAppCompatCheckbox
android:id="@+id/dialog_animate_gifs_in_folders"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/activity_margin"
android:paddingBottom="@dimen/activity_margin"
android:text="@string/animate_gifs" />
</LinearLayout>
</ScrollView>