Hello guys. I need to reveal the view in the background when the user clicks on the cell but still support the swipe. Seems the library does not provide a mechanism to do this. My idea has been to simulate a touch event but I'm doing something wrong because it does not work. Below the code I'm using. In advance thanks for any clarification and/or idea about how I can achieve this:
SwipeableItemClickListener swipeableItemClickListener = new SwipeableItemClickListener(this, (view, position) -> {
Rect rectf = new Rect();
view.getLocalVisibleRect(rectf);
long time = System.currentTimeMillis();
long deltaX = 70;
float xCoord = rectf.width() / 2;
float yCoord = rectf.bottom / 2;
int action;
for (int i = 0; i < 5; i++) {
if (i == 0) {
action = MotionEvent.ACTION_MOVE;
} else if (i == 4) {
action = MotionEvent.ACTION_UP;
} else {
action = MotionEvent.ACTION_CANCEL;
}
MotionEvent motionEvent = MotionEvent.obtain(
(time = time + 100),
(time = time + 100),
action,
(xCoord = xCoord + deltaX),
yCoord,
0
);
view.dispatchTouchEvent(motionEvent);
}
});
Hello guys. I need to reveal the view in the background when the user clicks on the cell but still support the swipe. Seems the library does not provide a mechanism to do this. My idea has been to simulate a touch event but I'm doing something wrong because it does not work. Below the code I'm using. In advance thanks for any clarification and/or idea about how I can achieve this: