fix thumbnail displaying
This commit is contained in:
parent
03aa0afaca
commit
cabf495b38
2 changed files with 9 additions and 8 deletions
|
@ -42,7 +42,7 @@ ext {
|
||||||
}
|
}
|
||||||
|
|
||||||
dependencies {
|
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.theartofdev.edmodo:android-image-cropper:2.6.0'
|
||||||
implementation 'com.android.support:multidex:1.0.2'
|
implementation 'com.android.support:multidex:1.0.2'
|
||||||
implementation 'com.google.code.gson:gson:2.8.2'
|
implementation 'com.google.code.gson:gson:2.8.2'
|
||||||
|
|
|
@ -28,25 +28,26 @@ import java.util.*
|
||||||
class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>, val listener: MediaOperationsListener?, val isAGetIntent: Boolean,
|
class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>, val listener: MediaOperationsListener?, val isAGetIntent: Boolean,
|
||||||
val allowMultiplePicks: Boolean, recyclerView: MyRecyclerView, fastScroller: FastScroller? = null,
|
val allowMultiplePicks: Boolean, recyclerView: MyRecyclerView, fastScroller: FastScroller? = null,
|
||||||
itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
|
itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick) {
|
||||||
init {
|
|
||||||
enableInstantLoad()
|
|
||||||
}
|
|
||||||
|
|
||||||
private val INSTANT_LOAD_DURATION = 1000L
|
private val INSTANT_LOAD_DURATION = 3000L
|
||||||
private val IMAGE_LOAD_DELAY = 200L
|
private val IMAGE_LOAD_DELAY = 100L
|
||||||
|
|
||||||
private val config = activity.config
|
private val config = activity.config
|
||||||
private val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST
|
private val isListViewType = config.viewTypeFiles == VIEW_TYPE_LIST
|
||||||
private var skipConfirmationDialog = false
|
private var skipConfirmationDialog = false
|
||||||
private var visibleItemPaths = ArrayList<String>()
|
private var visibleItemPaths = ArrayList<String>()
|
||||||
private var delayHandler = Handler(Looper.getMainLooper())
|
|
||||||
private var loadImageInstantly = false
|
private var loadImageInstantly = false
|
||||||
|
private var delayHandler = Handler(Looper.getMainLooper())
|
||||||
|
|
||||||
private var scrollHorizontally = config.scrollHorizontally
|
private var scrollHorizontally = config.scrollHorizontally
|
||||||
private var animateGifs = config.animateGifs
|
private var animateGifs = config.animateGifs
|
||||||
private var cropThumbnails = config.cropThumbnails
|
private var cropThumbnails = config.cropThumbnails
|
||||||
private var displayFilenames = config.displayFileNames
|
private var displayFilenames = config.displayFileNames
|
||||||
|
|
||||||
|
init {
|
||||||
|
enableInstantLoad()
|
||||||
|
}
|
||||||
|
|
||||||
override fun getActionMenuId() = R.menu.cab_media
|
override fun getActionMenuId() = R.menu.cab_media
|
||||||
|
|
||||||
override fun prepareItemSelection(view: View) {
|
override fun prepareItemSelection(view: View) {
|
||||||
|
@ -274,7 +275,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||||
|
|
||||||
private fun enableInstantLoad() {
|
private fun enableInstantLoad() {
|
||||||
loadImageInstantly = true
|
loadImageInstantly = true
|
||||||
Handler().postDelayed({
|
delayHandler.postDelayed({
|
||||||
loadImageInstantly = false
|
loadImageInstantly = false
|
||||||
}, INSTANT_LOAD_DURATION)
|
}, INSTANT_LOAD_DURATION)
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue