daimajia / daimajia/AndroidSwipeLayout
swipeLayout.addSwipeListener methods called multiple times
- Dominant language
- Java
- Stars
- 12.3k
- Forks
- 2.6k
- PR merge metrics
- No merged PRs in 30d
Description
When i swipe, the onOpen methods is called multiple times. It varies every time.
Sometimes, it's called once, sometimes twice, most times thrice or more.
Could you please help?
```
public class ItemListAdapter extends ArrayAdapter {
Context cContext;
/ * //return the SwipeLayout resource id in the layout.
public int getSwipeLayoutResourceId(int position) {
}*/
@Override
public View getView(final int position, View convertView, ViewGroup parent) {
viewHolder.swipeLayout.addSwipeListener(new SwipeLayout.SwipeListener() {
@Override
public void onClose(SwipeLayout layout) {
//when the SurfaceView totally cover the BottomView.
// Log.i("swipelayout", "onClose");
}
@Override
public void onUpdate(SwipeLayout layout, int leftOffset, int topOffset) {
//you are swiping.
Log.i("swipelayout", "onUpdate " + " " + leftOffset + " " + topOffset);
}
@Override
public void onStartOpen(SwipeLayout layout) {
// Log.i("swipelayout", "onStartOpen");
}
@Override
public void onOpen(final SwipeLayout layout) {
if (layout.getOpenStatus() == SwipeLayout.Status.Open && layout.isSwipeEnabled()) {
layout.postDelayed(new Runnable() {
@Override
public void run() {
layout.close();
if (layout.getDragEdge() == SwipeLayout.DragEdge.Left) {
Log.i("swipelayout", "DELETE Item");
} else if (layout.getDragEdge() == SwipeLayout.DragEdge.Right) {
Log.i("swipelayout", "Item PAID");
paidItem(ItemObject);
}
}
}, 500);
}
}
@Override
public void onStartClose(SwipeLayout layout) {
Log.i("swipelayout", "onStartClose");
}
@Override
public void onHandRelease(final SwipeLayout layout, final float xvel, final float yvel) {
//when user's hand released.
Log.i("swipelayout", "onHandRelease " + " " + xvel + " " + yvel);
}
});
}
public class ViewHolder {
...
}
```
}
Contributor guide
No contributing guide indexed for this repository
Assessment
This issue has not been assessed yet.