From aed1d64e4342dcf5fb4ebf63eeaa57ec89abdea0 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 20 Jun 2017 20:51:30 +0200 Subject: [PATCH] make drag selection at recyclerview disabled by default --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 1 + .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 1 + .../simplemobiletools/gallery/views/MyScalableRecyclerView.kt | 3 ++- 3 files changed, 4 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 5b2d10852..609a3e6b1 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -239,6 +239,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { directories_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) } + directories_grid.isDragSelectionEnabled = true directories_grid.isZoomingEnabled = true layoutManager.spanCount = config.dirColumnCnt MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index be48e9082..d7d586000 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -315,6 +315,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { media_refresh_layout.layoutParams = FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT) } + media_grid.isDragSelectionEnabled = true media_grid.isZoomingEnabled = true layoutManager.spanCount = config.mediaColumnCnt MyScalableRecyclerView.mListener = object : MyScalableRecyclerView.MyScalableRecyclerViewListener { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MyScalableRecyclerView.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MyScalableRecyclerView.kt index aeab0cf4e..b9a9c2a2e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/views/MyScalableRecyclerView.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/views/MyScalableRecyclerView.kt @@ -12,6 +12,7 @@ import com.simplemobiletools.gallery.R class MyScalableRecyclerView : RecyclerView { private val AUTO_SCROLL_DELAY = 25L var isZoomingEnabled = false + var isDragSelectionEnabled = false private var mScaleDetector: ScaleGestureDetector @@ -157,7 +158,7 @@ class MyScalableRecyclerView : RecyclerView { } fun setDragSelectActive(initialSelection: Int) { - if (dragSelectActive) + if (dragSelectActive || !isDragSelectionEnabled) return lastDraggedIndex = -1