From 78148990f090f07d0f859cd2979a31910d5f31a1 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 8 Jan 2018 12:15:57 +0100 Subject: [PATCH] replace some media adapter magic numbers with constants --- .../simplemobiletools/gallery/adapters/MediaAdapter.kt | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt index 0e4477cbf..8833284a5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -28,11 +28,13 @@ import java.util.* class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, val listener: MediaOperationsListener?, val isAGetIntent: Boolean, val allowMultiplePicks: Boolean, recyclerView: MyRecyclerView, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) { - init { enableInstantLoad() } + private val INSTANT_LOAD_DURATION = 1000L + private val IMAGE_LOAD_DELAY = 200L + private val config = activity.config private val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST private var skipConfirmationDialog = false @@ -274,7 +276,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, loadImageInstantly = true Handler().postDelayed({ loadImageInstantly = false - }, 1000) + }, INSTANT_LOAD_DURATION) } private fun setupView(view: View, medium: Medium) { @@ -294,7 +296,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, if (isVisible) { activity.loadImage(medium.path, medium_thumbnail, scrollHorizontally, animateGifs, cropThumbnails) } - }, 200) + }, IMAGE_LOAD_DELAY) } if (isListViewType) {