how can i swipe and keep the item fill after?
Please never mind my poor English.
I want to swipe an item and keep the animation/transition fill after(not anim back to original state), and then shows action buttons on left/right for clicking.
new SimpleSwipeCallback(this, null, ItemTouchHelper.LEFT, ContextCompat.getColor(this, android.R.color.transparent)) {
@Override
public void onChildDraw(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
if (dX < -200) {
return;
}
super.onChildDraw(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
}
@Override
public void onChildDrawOver(Canvas c, RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, float dX, float dY, int actionState, boolean isCurrentlyActive) {
if (dX < -200) {
return;
}
super.onChildDrawOver(c, recyclerView, viewHolder, dX, dY, actionState, isCurrentlyActive);
}
}
Above code only stop swiping when "dX < -200", but will anim back to original state. also , i don't kow how to add/show buttons on the item when swiping.
Thanks for your help.
@kwf2030 the included Swiping functionality was not meant to be used in the way you try it to implement. It was created to support the functionality you can see inside the sample app.
There are libraries out which are created to support exactly the behavior you want on views, and I suggest you use a lib like this, for this requirement It may is possible to bring in similar functionality to the included swipeCallback. If you want to implement something like this you can open a PR to bring it back to the lib.
thanks
Maybe this lib could be used: https://github.com/VictorAlbertos/SwipeCoordinator
Thanks for all your help, and I found this helpful: https://github.com/daimajia/AndroidSwipeLayout
Great :)