android - CardView halfway swipe in RecyclerView with ItemTouchHelper -


i want show user menu, under cardview, when he/she swipes it; want cardview stop on half-way during swiping;

i've created myitemtocuchhelper class , overrided onchilddraw() method:

  public class myitemtocuchhelper extends itemtouchhelper.simplecallback {          .....          private int mwidth = 128; // value calculated, let's 128  ...  @override     public void onchilddraw(canvas c, recyclerview recyclerview, recyclerview.viewholder viewholder, float dx, float dy, int actionstate, boolean iscurrentlyactive) {          if (dx > mwidth) {             dx = mwidth;         }          super.onchilddraw(c, recyclerview, viewholder, dx, dy, actionstate, iscurrentlyactive);     }     } @override     public float getswipethreshold(recyclerview.viewholder viewholder) {         return 0.01f;     } 

what does, swipe animation stops on point (which wanted do); when view swiped, swipe distance set screen width automaticaly; mean when try swipe back, onchilddraw() method, called dx = 1038.0 @ first time , value decreases continue swipe; no animation playing, before dx reaches mwidth's value. long dx;'s value decreases mwidth's value, animation starts again.

is there way, set example swipeddx specific value? or way around it? want to, start animation user starts swipe view back.

thank in advance


Comments

Popular posts from this blog

sequelize.js - Sequelize group by with association includes id -

android - Robolectric "INTERNET permission is required" -

java - Android raising EPERM (Operation not permitted) when attempting to send UDP packet after network connection -