Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Swiped items don't returns to initial state #15

Open
k0ber opened this issue Feb 20, 2017 · 3 comments
Open

Swiped items don't returns to initial state #15

k0ber opened this issue Feb 20, 2017 · 3 comments

Comments

@k0ber
Copy link

k0ber commented Feb 20, 2017

I have three views inside item layout - first is layout with remove button, second is item info layout, and the last one is progress bar, and in this case my swiped items don't returns to initial state.

When I moved progress to second layout, it started to work, but I want to have progress above this layout, not inside.

@Heycz
Copy link

Heycz commented Mar 31, 2017

it has some problem when mDx>threshold
my solustion is:

ItemTouchHelperExtension
private void select(ViewHolder selected, int actionState) {
.....
switch (swipeDir) {
case LEFT:
case RIGHT:
case START:
case END:
targetTranslateY = 0;
final boolean isOpen = prevSelected.itemView.getTag(R.id.item_touch_swipe_state) != null;
if (isOpen) {
prevSelected.itemView.setTag(R.id.item_touch_swipe_state, null);
targetTranslateX = 0;
} else {
prevSelected.itemView.setTag(R.id.item_touch_swipe_state, true);
targetTranslateX = Math.signum(mDx) * getSwipeWidth();
}
break;
case UP:
case DOWN:
targetTranslateX = 0;
targetTranslateY = Math.signum(mDy) * mRecyclerView.getHeight();
break;
default:
prevSelected.itemView.setTag(R.id.item_touch_swipe_state, null);
targetTranslateX = 0;
targetTranslateY = 0;
}
....
}
private void closeOpenedPreItem{
mPreOpened.itemView.setTag(R.id.item_touch_swipe_state, null);
}

@ToDou
Copy link
Member

ToDou commented Apr 24, 2017

Try version 1.0.4

@vineyugave
Copy link

Make sure your mPreOpenedItem is closed before refreshing UI by doing adapter.notifyDataSetChanged() etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants