stop pull-to-refresh while drag & dropping

This commit is contained in:
tibbi 2021-05-13 11:32:34 +02:00
parent ec5fd3d088
commit 4841666e18
3 changed files with 10 additions and 5 deletions

View File

@ -78,7 +78,7 @@ android {
} }
dependencies { dependencies {
implementation 'com.github.SimpleMobileTools:Simple-Commons:99a97f2e16' implementation 'com.github.SimpleMobileTools:Simple-Commons:94718a76cb'
implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0' implementation 'com.theartofdev.edmodo:android-image-cropper:2.8.0'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22' implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'

View File

@ -1189,7 +1189,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
if (currAdapter == null || forceRecreate) { if (currAdapter == null || forceRecreate) {
initZoomListener() initZoomListener()
val fastscroller = if (config.scrollHorizontally) directories_horizontal_fastscroller else directories_vertical_fastscroller val fastscroller = if (config.scrollHorizontally) directories_horizontal_fastscroller else directories_vertical_fastscroller
DirectoryAdapter(this, dirsToShow, this, directories_grid, isPickIntent(intent) || isGetAnyContentIntent(intent), fastscroller) { DirectoryAdapter(this, dirsToShow, this, directories_grid, isPickIntent(intent) || isGetAnyContentIntent(intent), directories_refresh_layout, fastscroller) {
val clickedDir = it as Directory val clickedDir = it as Directory
val path = clickedDir.path val path = clickedDir.path
if (clickedDir.subfoldersCount == 1 || !config.groupDirectSubfolders) { if (clickedDir.subfoldersCount == 1 || !config.groupDirectSubfolders) {

View File

@ -14,6 +14,7 @@ import android.view.ViewGroup
import android.widget.RelativeLayout import android.widget.RelativeLayout
import androidx.recyclerview.widget.ItemTouchHelper import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.bumptech.glide.Glide import com.bumptech.glide.Glide
import com.google.gson.Gson import com.google.gson.Gson
import com.simplemobiletools.commons.activities.BaseSimpleActivity import com.simplemobiletools.commons.activities.BaseSimpleActivity
@ -54,7 +55,7 @@ import kotlin.collections.ArrayList
import kotlin.collections.HashMap import kotlin.collections.HashMap
class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView, class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directory>, val listener: DirectoryOperationsListener?, recyclerView: MyRecyclerView,
val isPickIntent: Boolean, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit) : val isPickIntent: Boolean, val swipeRefreshLayout: SwipeRefreshLayout? = null, fastScroller: FastScroller? = null, itemClick: (Any) -> Unit) :
MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick), ItemTouchHelperContract { MyRecyclerViewAdapter(activity, recyclerView, fastScroller, itemClick), ItemTouchHelperContract {
private val config = activity.config private val config = activity.config
@ -826,7 +827,11 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
notifyItemMoved(fromPosition, toPosition) notifyItemMoved(fromPosition, toPosition)
} }
override fun onRowClear(myViewHolder: ViewHolder?) {} override fun onRowSelected(myViewHolder: ViewHolder?) {
swipeRefreshLayout?.isEnabled = false
override fun onRowSelected(myViewHolder: ViewHolder?) {} }
override fun onRowClear(myViewHolder: ViewHolder?) {
swipeRefreshLayout?.isEnabled = true
}
} }