mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
simplify thumbnail spacing calculations
This commit is contained in:
parent
c68f8522b8
commit
bd60592188
2 changed files with 9 additions and 12 deletions
|
@ -10,7 +10,6 @@ import com.simplemobiletools.commons.models.RadioItem
|
||||||
import com.simplemobiletools.gallery.pro.R
|
import com.simplemobiletools.gallery.pro.R
|
||||||
import com.simplemobiletools.gallery.pro.extensions.config
|
import com.simplemobiletools.gallery.pro.extensions.config
|
||||||
import kotlinx.android.synthetic.main.dialog_change_file_thumbnail_style.view.*
|
import kotlinx.android.synthetic.main.dialog_change_file_thumbnail_style.view.*
|
||||||
import java.text.DecimalFormat
|
|
||||||
|
|
||||||
class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogInterface.OnClickListener {
|
class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogInterface.OnClickListener {
|
||||||
private var config = activity.config
|
private var config = activity.config
|
||||||
|
@ -32,13 +31,13 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI
|
||||||
dialog_file_style_spacing_holder.setOnClickListener {
|
dialog_file_style_spacing_holder.setOnClickListener {
|
||||||
val items = arrayListOf(
|
val items = arrayListOf(
|
||||||
RadioItem(0, "0x"),
|
RadioItem(0, "0x"),
|
||||||
RadioItem(1, "0.5x"),
|
RadioItem(1, "1x"),
|
||||||
RadioItem(2, "1x"),
|
RadioItem(2, "2x"),
|
||||||
RadioItem(4, "2x"),
|
RadioItem(4, "4x"),
|
||||||
RadioItem(8, "4x"),
|
RadioItem(8, "8x"),
|
||||||
RadioItem(16, "8x"),
|
RadioItem(16, "16x"),
|
||||||
RadioItem(32, "16x"),
|
RadioItem(32, "32x"),
|
||||||
RadioItem(64, "32x"))
|
RadioItem(64, "64x"))
|
||||||
|
|
||||||
RadioGroupDialog(activity, items, thumbnailSpacing) {
|
RadioGroupDialog(activity, items, thumbnailSpacing) {
|
||||||
thumbnailSpacing = it as Int
|
thumbnailSpacing = it as Int
|
||||||
|
@ -66,8 +65,6 @@ class ChangeFileThumbnailStyleDialog(val activity: BaseSimpleActivity) : DialogI
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun updateThumbnailSpacingText() {
|
private fun updateThumbnailSpacingText() {
|
||||||
val number = thumbnailSpacing * 0.5
|
view.dialog_file_style_spacing.text = "${thumbnailSpacing}x"
|
||||||
val format = DecimalFormat("0.#")
|
|
||||||
view.dialog_file_style_spacing.text = "${format.format(number)}x"
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -509,7 +509,7 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
set(limitFolderTitle) = prefs.edit().putBoolean(LIMIT_FOLDER_TITLE, limitFolderTitle).apply()
|
set(limitFolderTitle) = prefs.edit().putBoolean(LIMIT_FOLDER_TITLE, limitFolderTitle).apply()
|
||||||
|
|
||||||
var thumbnailSpacing: Int
|
var thumbnailSpacing: Int
|
||||||
get() = prefs.getInt(THUMBNAIL_SPACING, 2)
|
get() = prefs.getInt(THUMBNAIL_SPACING, 1)
|
||||||
set(thumbnailSpacing) = prefs.edit().putInt(THUMBNAIL_SPACING, thumbnailSpacing).apply()
|
set(thumbnailSpacing) = prefs.edit().putInt(THUMBNAIL_SPACING, thumbnailSpacing).apply()
|
||||||
|
|
||||||
var fileRoundedCorners: Boolean
|
var fileRoundedCorners: Boolean
|
||||||
|
|
Loading…
Reference in a new issue