SwipeListView icon indicating copy to clipboard operation
SwipeListView copied to clipboard

listView.addHeaderView(normalHeaderView);

Open liufsd opened this issue 11 years ago • 5 comments

  listView.addHeaderView(normalHeaderView);

swipe wrong.you can try it.

liufsd avatar Feb 21 '14 08:02 liufsd

when i swipe position o it will show i swipe item 1. how to solve it ??? Thanks.

liufsd avatar Feb 21 '14 08:02 liufsd

Wow, I have touched this library for a while. I think the problem comes from this code in SwipeToDeleteListView.java :

private void setDraggedItem(MotionEvent event) {
    int position = pointToPosition((int) event.getX(), (int) event.getY());
    ItemState itemState = adapter.getItemState(position);
    if(itemState != null && itemState.getState() == State.Normal) {
        draggedItemPosition = position;
        itemState.setState(State.Dragged);
    }
}

pointToPosition might take into account headers and it shouldn't.

Could you investigate and post a Pull Request if you find a solution ?

yDelouis avatar Feb 21 '14 12:02 yDelouis

YES。you got it. i also solved it. thanks.

liufsd avatar Feb 21 '14 12:02 liufsd

Could you post a PR or the code to solve this issue ?

yDelouis avatar Feb 21 '14 13:02 yDelouis

sorry,i only update this code on my project, maybe you can change here: int position = pointToPosition((int) event.getX(), (int) event.getY()); you know ,when user add HeaderView .the item position will start 1,but the HeaderView not allow to swipe,so you can just update code here.(such as :position -= 1//if the view has HeaderView.) That's my solution. Thanks.

liufsd avatar Feb 21 '14 14:02 liufsd