From bd6059218808954af38066741de6e7215504c063 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 21 Jan 2021 10:52:15 +0100 Subject: [PATCH] simplify thumbnail spacing calculations --- .../dialogs/ChangeFileThumbnailStyleDialog.kt | 19 ++++++++----------- .../gallery/pro/helpers/Config.kt | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) 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 6c4b33092..5498c66b8 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 @@ -10,7 +10,6 @@ import com.simplemobiletools.commons.models.RadioItem import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.extensions.config import kotlinx.android.synthetic.main.dialog_change_file_thumbnail_style.view.* -import java.text.DecimalFormat class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogInterface.OnClickListener { private var config = activity.config @@ -32,13 +31,13 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI dialog_file_style_spacing_holder.setOnClickListener { val items = arrayListOf( RadioItem(0, "0x"), - RadioItem(1, "0.5x"), - RadioItem(2, "1x"), - RadioItem(4, "2x"), - RadioItem(8, "4x"), - RadioItem(16, "8x"), - RadioItem(32, "16x"), - RadioItem(64, "32x")) + RadioItem(1, "1x"), + RadioItem(2, "2x"), + RadioItem(4, "4x"), + RadioItem(8, "8x"), + RadioItem(16, "16x"), + RadioItem(32, "32x"), + RadioItem(64, "64x")) RadioGroupDialog(activity, items, thumbnailSpacing) { thumbnailSpacing = it as Int @@ -66,8 +65,6 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI } private fun updateThumbnailSpacingText() { - val number = thumbnailSpacing * 0.5 - val format = DecimalFormat("0.#") - view.dialog_file_style_spacing.text = "${format.format(number)}x" + view.dialog_file_style_spacing.text = "${thumbnailSpacing}x" } } 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 960559e33..bc5e2f9a2 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 @@ -509,7 +509,7 @@ class Config(context: Context) : BaseConfig(context) { set(limitFolderTitle) = prefs.edit().putBoolean(LIMIT_FOLDER_TITLE, limitFolderTitle).apply() var thumbnailSpacing: Int - get() = prefs.getInt(THUMBNAIL_SPACING, 2) + get() = prefs.getInt(THUMBNAIL_SPACING, 1) set(thumbnailSpacing) = prefs.edit().putInt(THUMBNAIL_SPACING, thumbnailSpacing).apply() var fileRoundedCorners: Boolean