AndroidSwipeLayout icon indicating copy to clipboard operation
AndroidSwipeLayout copied to clipboard

Hello

Open UmairAhmed420 opened this issue 6 years ago • 1 comments

is there a way to check if one swipe is already open then before opening 2nd swipe first swipe gets close

UmairAhmed420 avatar Dec 19 '19 08:12 UmairAhmed420

SwipeLayout is just a ViewGroup. So it shouldn't know about other views. You can resolve that logic by yourself For example, if you use RececlerView with many items(viewed by SwipeLayout) you can ask each SwipeLayout is it opened or closed and do your logic:

var closed = 0
for (i in 0..recyclerView.childCount) {
    val view = recyclerView.getChildAt(i)
    if (view is SwipeLayout) {
        if (view.openStatus == SwipeLayout.Status.Open)  {
            closed++
            view.close()
        }
    }
}
Toast.makeText(context, "We closed $closed items", Toast.LENGTH_SHORT).show()

I'm not sure about how resolve situation with Status.Middle in right way

sheckspir avatar Jan 09 '20 21:01 sheckspir