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 {
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 'it.sephiroth.android.exif:library:1.0.1'
implementation 'pl.droidsonroids.gif:android-gif-drawable:1.2.22'

View File

@ -1189,7 +1189,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
if (currAdapter == null || forceRecreate) {
initZoomListener()
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 path = clickedDir.path
if (clickedDir.subfoldersCount == 1 || !config.groupDirectSubfolders) {

View File

@ -14,6 +14,7 @@ import android.view.ViewGroup
import android.widget.RelativeLayout
import androidx.recyclerview.widget.ItemTouchHelper
import androidx.recyclerview.widget.RecyclerView
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
import com.bumptech.glide.Glide
import com.google.gson.Gson
import com.simplemobiletools.commons.activities.BaseSimpleActivity
@ -54,7 +55,7 @@ import kotlin.collections.ArrayList
import kotlin.collections.HashMap
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 {
private val config = activity.config
@ -826,7 +827,11 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList<Directo
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
}
}