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 mDirs = ArrayList<Directory>()
private var mDirsIgnoringSearch = ArrayList<Directory>() private var mDirsIgnoringSearch = ArrayList<Directory>()
private var mStoredAnimateGifsInFolders = true private var mStoredAnimateGifs = true
private var mStoredCropThumbnails = true private var mStoredCropThumbnails = true
private var mStoredScrollHorizontally = true private var mStoredScrollHorizontally = true
private var mStoredTextColor = 0 private var mStoredTextColor = 0
@ -198,8 +198,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
refreshMenuItems() refreshMenuItems()
if (mStoredAnimateGifsInFolders != config.animateGifsInFolders) { if (mStoredAnimateGifs != config.animateGifs) {
getRecyclerAdapter()?.updateAnimateGifs(config.animateGifsInFolders) getRecyclerAdapter()?.updateAnimateGifs(config.animateGifs)
} }
if (mStoredCropThumbnails != config.cropThumbnails) { if (mStoredCropThumbnails != config.cropThumbnails) {
@ -438,7 +438,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
mStoredTextColor = getProperTextColor() mStoredTextColor = getProperTextColor()
mStoredPrimaryColor = getProperPrimaryColor() mStoredPrimaryColor = getProperPrimaryColor()
config.apply { config.apply {
mStoredAnimateGifsInFolders = animateGifsInFolders mStoredAnimateGifs = animateGifs
mStoredCropThumbnails = cropThumbnails mStoredCropThumbnails = cropThumbnails
mStoredScrollHorizontally = scrollHorizontally mStoredScrollHorizontally = scrollHorizontally
mStoredStyleString = "$folderStyle$showFolderMediaCount$limitFolderTitle" mStoredStyleString = "$folderStyle$showFolderMediaCount$limitFolderTitle"

View file

@ -55,7 +55,7 @@ class DirectoryAdapter(
private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST private val isListViewType = config.viewTypeFolders == VIEW_TYPE_LIST
private var pinnedFolders = config.pinnedFolders private var pinnedFolders = config.pinnedFolders
private var scrollHorizontally = config.scrollHorizontally private var scrollHorizontally = config.scrollHorizontally
private var animateGifs = config.animateGifsInFolders private var animateGifs = config.animateGifs
private var cropThumbnails = config.cropThumbnails private var cropThumbnails = config.cropThumbnails
private var groupDirectSubfolders = config.groupDirectSubfolders private var groupDirectSubfolders = config.groupDirectSubfolders
private var currentDirectoriesHash = dirs.hashCode() private var currentDirectoriesHash = dirs.hashCode()

View file

@ -3,7 +3,6 @@ package com.simplemobiletools.gallery.pro.dialogs
import android.content.DialogInterface import android.content.DialogInterface
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
import com.simplemobiletools.commons.dialogs.RadioGroupDialog import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.beVisibleIf
import com.simplemobiletools.commons.extensions.getAlertDialogBuilder import com.simplemobiletools.commons.extensions.getAlertDialogBuilder
import com.simplemobiletools.commons.extensions.setupDialogStuff import com.simplemobiletools.commons.extensions.setupDialogStuff
import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.commons.models.RadioItem
@ -23,10 +22,7 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI
dialogFileStyleShowThumbnailFileTypes.isChecked = config.showThumbnailFileTypes dialogFileStyleShowThumbnailFileTypes.isChecked = config.showThumbnailFileTypes
dialogFileStyleMarkFavoriteItems.isChecked = config.markFavoriteItems dialogFileStyleMarkFavoriteItems.isChecked = config.markFavoriteItems
dialogFileStyleRoundedCornersHolder.setOnClickListener { dialogFileStyleRoundedCornersHolder.setOnClickListener { dialogFileStyleRoundedCorners.toggle() }
dialogFileStyleRoundedCorners.toggle()
updateAnimateGifsCheckbox()
}
dialogFileStyleAnimateGifsHolder.setOnClickListener { dialogFileStyleAnimateGifs.toggle() } dialogFileStyleAnimateGifsHolder.setOnClickListener { dialogFileStyleAnimateGifs.toggle() }
dialogFileStyleShowThumbnailVideoDurationHolder.setOnClickListener { dialogFileStyleShowThumbnailVideoDuration.toggle() } dialogFileStyleShowThumbnailVideoDurationHolder.setOnClickListener { dialogFileStyleShowThumbnailVideoDuration.toggle() }
dialogFileStyleShowThumbnailFileTypesHolder.setOnClickListener { dialogFileStyleShowThumbnailFileTypes.toggle() } dialogFileStyleShowThumbnailFileTypesHolder.setOnClickListener { dialogFileStyleShowThumbnailFileTypes.toggle() }
@ -52,7 +48,6 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI
} }
updateThumbnailSpacingText() updateThumbnailSpacingText()
updateAnimateGifsCheckbox()
activity.getAlertDialogBuilder() activity.getAlertDialogBuilder()
.setPositiveButton(com.simplemobiletools.commons.R.string.ok, this) .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) { override fun onClick(dialog: DialogInterface, which: Int) {
config.fileRoundedCorners = binding.dialogFileStyleRoundedCorners.isChecked config.fileRoundedCorners = binding.dialogFileStyleRoundedCorners.isChecked
if (binding.dialogFileStyleRoundedCorners.isChecked) { config.animateGifs = binding.dialogFileStyleAnimateGifs.isChecked
config.animateGifs = false
} else {
config.animateGifs = binding.dialogFileStyleAnimateGifs.isChecked
}
config.showThumbnailVideoDuration = binding.dialogFileStyleShowThumbnailVideoDuration.isChecked config.showThumbnailVideoDuration = binding.dialogFileStyleShowThumbnailVideoDuration.isChecked
config.showThumbnailFileTypes = binding.dialogFileStyleShowThumbnailFileTypes.isChecked config.showThumbnailFileTypes = binding.dialogFileStyleShowThumbnailFileTypes.isChecked
config.markFavoriteItems = binding.dialogFileStyleMarkFavoriteItems.isChecked config.markFavoriteItems = binding.dialogFileStyleMarkFavoriteItems.isChecked
config.thumbnailSpacing = thumbnailSpacing config.thumbnailSpacing = thumbnailSpacing
} }
private fun updateAnimateGifsCheckbox() {
binding.dialogFileStyleAnimateGifs.beVisibleIf(!binding.dialogFileStyleRoundedCorners.isChecked)
}
private fun updateThumbnailSpacingText() { private fun updateThumbnailSpacingText() {
binding.dialogFileStyleSpacing.text = "${thumbnailSpacing}x" binding.dialogFileStyleSpacing.text = "${thumbnailSpacing}x"
} }

View file

@ -20,7 +20,6 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal
private var config = activity.config private var config = activity.config
private val binding = DialogChangeFolderThumbnailStyleBinding.inflate(activity.layoutInflater).apply { private val binding = DialogChangeFolderThumbnailStyleBinding.inflate(activity.layoutInflater).apply {
dialogFolderLimitTitle.isChecked = config.limitFolderTitle dialogFolderLimitTitle.isChecked = config.limitFolderTitle
dialogAnimateGifsInFolders.isChecked = config.animateGifsInFolders
} }
init { init {
@ -32,7 +31,6 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal
setupStyle() setupStyle()
setupMediaCount() setupMediaCount()
updateSample() updateSample()
updateAnimateGifsCheckbox()
} }
} }
} }
@ -41,7 +39,6 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal
val styleRadio = binding.dialogRadioFolderStyle val styleRadio = binding.dialogRadioFolderStyle
styleRadio.setOnCheckedChangeListener { group, checkedId -> styleRadio.setOnCheckedChangeListener { group, checkedId ->
updateSample() updateSample()
updateAnimateGifsCheckbox()
} }
val styleBtn = when (config.folderStyle) { val styleBtn = when (config.folderStyle) {
@ -120,7 +117,10 @@ class ChangeFolderThumbnailStyleDialog(val activity: BaseSimpleActivity, val cal
} }
override fun onClick(dialog: DialogInterface, which: Int) { 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) { val count = when (binding.dialogRadioFolderCountHolder.checkedRadioButtonId) {
R.id.dialog_radio_folder_count_line -> FOLDER_MEDIA_CNT_LINE 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.folderStyle = style
config.showFolderMediaCount = count config.showFolderMediaCount = count
config.limitFolderTitle = binding.dialogFolderLimitTitle.isChecked config.limitFolderTitle = binding.dialogFolderLimitTitle.isChecked
if (style == FOLDER_STYLE_ROUNDED_CORNERS) {
config.animateGifsInFolders = false
} else {
config.animateGifsInFolders = binding.dialogAnimateGifsInFolders.isChecked
}
callback() 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) get() = prefs.getBoolean(ANIMATE_GIFS, false)
set(animateGifs) = prefs.edit().putBoolean(ANIMATE_GIFS, animateGifs).apply() 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 var maxBrightness: Boolean
get() = prefs.getBoolean(MAX_BRIGHTNESS, false) get() = prefs.getBoolean(MAX_BRIGHTNESS, false)
set(maxBrightness) = prefs.edit().putBoolean(MAX_BRIGHTNESS, maxBrightness).apply() 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 LOOP_VIDEOS = "loop_videos"
const val OPEN_VIDEOS_ON_SEPARATE_SCREEN = "open_videos_on_separate_screen" const val OPEN_VIDEOS_ON_SEPARATE_SCREEN = "open_videos_on_separate_screen"
const val ANIMATE_GIFS = "animate_gifs" const val ANIMATE_GIFS = "animate_gifs"
const val ANIMATE_GIFS_IN_FOLDERS = "animate_gifs_in_folders"
const val MAX_BRIGHTNESS = "max_brightness" const val MAX_BRIGHTNESS = "max_brightness"
const val CROP_THUMBNAILS = "crop_thumbnails" const val CROP_THUMBNAILS = "crop_thumbnails"
const val SHOW_THUMBNAIL_VIDEO_DURATION = "show_thumbnail_video_duration" const val SHOW_THUMBNAIL_VIDEO_DURATION = "show_thumbnail_video_duration"

View file

@ -87,13 +87,5 @@
android:paddingBottom="@dimen/activity_margin" android:paddingBottom="@dimen/activity_margin"
android:text="@string/limit_folder_title" /> 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> </LinearLayout>
</ScrollView> </ScrollView>