AndroidPdfViewer icon indicating copy to clipboard operation
AndroidPdfViewer copied to clipboard

LongClick doesn't work

Open Bernhardino opened this issue 2 years ago • 3 comments

Although I set pdfView.setLongClickable(true), the OnLongClickListener does not respond to a long Click. Click and OnClickListener work fine.

Bernhardino avatar Aug 29 '23 15:08 Bernhardino

I also set in the .xml
<com.github.barteksc.pdfviewer.PDFView android:longClickable="true" ...

Bernhardino avatar Aug 29 '23 15:08 Bernhardino

I imported the library into my project and observed the following: In DragPinchManager.java, the method onLongPress (line 198) is executed exactly on a LongClick. But somehow the event is passed incorrectly to pdfView.onLongClickListener. I passed the event according to https://guides.codepath.com/android/Creating-Custom-Listeners and voila, everything works fine now... _:)

Bernhardino avatar Sep 02 '23 00:09 Bernhardino

My last post: I must confess, I was wrong. LongClick (which is called LongPress here) works fine. I used the wrong syntax: pdfView.setOnLongPressListener((OnLongPressListener) e -> {..., which worked with a few tweaks (see last post). Only by chance I saw that the correct syntax is pdfView.fromFile(new File(file)).onLongPress(onLongPressListener).load();. Well, the instructions on the site https://github.com/barteksc/AndroidPdfViewer are a bit poor...

Bernhardino avatar Sep 04 '23 02:09 Bernhardino