AndroidSwipeLayout
AndroidSwipeLayout copied to clipboard
Hello
is there a way to check if one swipe is already open then before opening 2nd swipe first swipe gets close
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