diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt
index 2a773ec0a..22e6b5434 100644
--- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt
+++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/activities/MediaActivity.kt
@@ -732,7 +732,7 @@ class MediaActivity : SimpleActivity(), MediaOperationsListener {
val viewType = config.getFolderViewType(if (mShowAll) SHOW_ALL else mPath)
if (viewType == VIEW_TYPE_GRID) {
val spanCount = config.mediaColumnCnt
- val spacing = 2
+ val spacing = config.thumbnailSpacing
media_grid.addItemDecoration(GridSpacingItemDecoration(spanCount, spacing, config.scrollHorizontally))
}
}
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 d47a30150..8fcf1a6e7 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
@@ -4,14 +4,18 @@ import android.content.DialogInterface
import android.view.View
import androidx.appcompat.app.AlertDialog
import com.simplemobiletools.commons.activities.BaseSimpleActivity
+import com.simplemobiletools.commons.dialogs.RadioGroupDialog
import com.simplemobiletools.commons.extensions.setupDialogStuff
+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
private var view: View
+ private var thumbnailSpacing = config.thumbnailSpacing
init {
view = activity.layoutInflater.inflate(R.layout.dialog_change_file_thumbnail_style, null).apply {
@@ -22,7 +26,24 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI
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() }
+
+ 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"))
+
+ RadioGroupDialog(activity, items, thumbnailSpacing) {
+ thumbnailSpacing = it as Int
+ updateThumbnailSpacingText()
+ }
+ }
}
+ updateThumbnailSpacingText()
AlertDialog.Builder(activity)
.setPositiveButton(R.string.ok, this)
@@ -36,5 +57,12 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI
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
+ config.thumbnailSpacing = thumbnailSpacing
+ }
+
+ private fun updateThumbnailSpacingText() {
+ val number = thumbnailSpacing * 0.5
+ val format = DecimalFormat("0.#")
+ view.dialog_file_style_spacing.text = "${format.format(number)}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 2384f7298..1cf352cdc 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
@@ -507,4 +507,8 @@ class Config(context: Context) : BaseConfig(context) {
var limitFolderTitle: Boolean
get() = prefs.getBoolean(LIMIT_FOLDER_TITLE, false)
set(limitFolderTitle) = prefs.edit().putBoolean(LIMIT_FOLDER_TITLE, limitFolderTitle).apply()
+
+ var thumbnailSpacing: Int
+ get() = prefs.getInt(THUMBNAIL_SPACING, 2)
+ set(thumbnailSpacing) = prefs.edit().putInt(THUMBNAIL_SPACING, thumbnailSpacing).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 df613f6f8..91b060de3 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
@@ -86,6 +86,7 @@ const val WERE_FAVORITES_MIGRATED = "were_favorites_migrated"
const val FOLDER_THUMBNAIL_STYLE = "folder_thumbnail_style"
const val FOLDER_MEDIA_COUNT = "folder_media_count"
const val LIMIT_FOLDER_TITLE = "folder_limit_title"
+const val THUMBNAIL_SPACING = "thumbnail_spacing"
// slideshow
const val SLIDESHOW_INTERVAL = "slideshow_interval"
diff --git a/app/src/main/res/layout/dialog_change_file_thumbnail_style.xml b/app/src/main/res/layout/dialog_change_file_thumbnail_style.xml
index 511370a94..06c8deff2 100644
--- a/app/src/main/res/layout/dialog_change_file_thumbnail_style.xml
+++ b/app/src/main/res/layout/dialog_change_file_thumbnail_style.xml
@@ -13,15 +13,46 @@
android:paddingTop="@dimen/normal_margin">
+ android:paddingBottom="@dimen/bigger_margin">
+
+
+
+
+
+
+
+
+ android:padding="@dimen/normal_margin">
+ android:padding="@dimen/normal_margin">