From cabf495b38b2440f219d42d4e7b9572c65f72ef3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Mon, 8 Jan 2018 20:48:52 +0100 Subject: [PATCH] fix thumbnail displaying --- app/build.gradle | 2 +- .../gallery/adapters/MediaAdapter.kt | 15 ++++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 59d935211..ae1ceb7b4 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -42,7 +42,7 @@ ext { } dependencies { - implementation 'com.simplemobiletools:commons:3.6.6' + implementation 'com.simplemobiletools:commons:3.6.12' implementation 'com.theartofdev.edmodo:android-image-cropper:2.6.0' implementation 'com.android.support:multidex:1.0.2' implementation 'com.google.code.gson:gson:2.8.2' 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 8833284a5..1a8463e8e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/MediaAdapter.kt @@ -28,25 +28,26 @@ 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 INSTANT_LOAD_DURATION = 3000L + private val IMAGE_LOAD_DELAY = 100L private val config = activity.config private val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST private var skipConfirmationDialog = false private var visibleItemPaths = ArrayList() - private var delayHandler = Handler(Looper.getMainLooper()) private var loadImageInstantly = false + private var delayHandler = Handler(Looper.getMainLooper()) private var scrollHorizontally = config.scrollHorizontally private var animateGifs = config.animateGifs private var cropThumbnails = config.cropThumbnails private var displayFilenames = config.displayFileNames + init { + enableInstantLoad() + } + override fun getActionMenuId() = R.menu.cab_media override fun prepareItemSelection(view: View) { @@ -274,7 +275,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList, private fun enableInstantLoad() { loadImageInstantly = true - Handler().postDelayed({ + delayHandler.postDelayed({ loadImageInstantly = false }, INSTANT_LOAD_DURATION) }