~singpolyma/cheogram-android

2928cadbbca7ad872ac7ab2279ec5b3ba6a50004 — Stephen Paul Weber 7 months ago 2da56f5
Treat touch-up as click
1 files changed, 15 insertions(+), 1 deletions(-)

M src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java
M src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java => src/main/java/eu/siacs/conversations/ui/adapter/MessageAdapter.java +15 -1
@@ 1020,9 1020,23 @@ public class MessageAdapter extends ArrayAdapter<Message> {
            }
        });
        viewHolder.message_box.setOnTouchListener(swipeDetector);
        viewHolder.messageBody.setOnTouchListener(swipeDetector);
        viewHolder.image.setOnTouchListener(swipeDetector);
        viewHolder.time.setOnTouchListener(swipeDetector);

        // Treat touch-up as click so we don't have to touch twice
        // (touch twice is because it's waiting to see if you double-touch for text selection)
        viewHolder.messageBody.setOnTouchListener((v, event) -> {
            if (event.getAction() == MotionEvent.ACTION_UP) {
                if (MessageAdapter.this.mOnMessageBoxClickedListener != null) {
                    MessageAdapter.this.mOnMessageBoxClickedListener
                        .onContactPictureClicked(message);
                }
            }

            swipeDetector.onTouch(v, event);

            return false;
        });
        viewHolder.messageBody.setOnClickListener(v -> {
            if (MessageAdapter.this.mOnMessageBoxClickedListener != null) {
                MessageAdapter.this.mOnMessageBoxClickedListener