replace some media adapter magic numbers with constants
This commit is contained in:
parent
cb9cf0c90b
commit
78148990f0
1 changed files with 5 additions and 3 deletions
|
@ -28,11 +28,13 @@ 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 {
|
init {
|
||||||
enableInstantLoad()
|
enableInstantLoad()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private val INSTANT_LOAD_DURATION = 1000L
|
||||||
|
private val IMAGE_LOAD_DELAY = 200L
|
||||||
|
|
||||||
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
|
||||||
|
@ -274,7 +276,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||||
loadImageInstantly = true
|
loadImageInstantly = true
|
||||||
Handler().postDelayed({
|
Handler().postDelayed({
|
||||||
loadImageInstantly = false
|
loadImageInstantly = false
|
||||||
}, 1000)
|
}, INSTANT_LOAD_DURATION)
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun setupView(view: View, medium: Medium) {
|
private fun setupView(view: View, medium: Medium) {
|
||||||
|
@ -294,7 +296,7 @@ class MediaAdapter(activity: BaseSimpleActivity, var media: MutableList<Medium>,
|
||||||
if (isVisible) {
|
if (isVisible) {
|
||||||
activity.loadImage(medium.path, medium_thumbnail, scrollHorizontally, animateGifs, cropThumbnails)
|
activity.loadImage(medium.path, medium_thumbnail, scrollHorizontally, animateGifs, cropThumbnails)
|
||||||
}
|
}
|
||||||
}, 200)
|
}, IMAGE_LOAD_DELAY)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isListViewType) {
|
if (isListViewType) {
|
||||||
|
|
Loading…
Reference in a new issue