Skip to content
This repository was archived by the owner on Nov 10, 2025. It is now read-only.

Commit 44c09c9

Browse files
committed
Modify callback to allow scroll handle toggling if onTapListener is not set
Improve javadoc a little bit
1 parent c94c034 commit 44c09c9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/DragPinchManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ public void setSwipeVertical(boolean swipeVertical) {
8383
@Override
8484
public boolean onSingleTapConfirmed(MotionEvent e) {
8585
OnTapListener onTapListener = pdfView.getOnTapListener();
86-
if (onTapListener != null && !onTapListener.onTap(e)) {
86+
if (onTapListener == null || !onTapListener.onTap(e)) {
8787
ScrollHandle ps = pdfView.getScrollHandle();
8888
if (ps != null && !pdfView.documentFitsView()) {
8989
if (!ps.shown()) {

android-pdf-viewer/src/main/java/com/github/barteksc/pdfviewer/listener/OnTapListener.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,16 +18,16 @@
1818
import android.view.MotionEvent;
1919

2020
/**
21-
* Implements this interface to receive events from PDFView
22-
* when a page has been scrolled
21+
* Implement this interface to receive events from PDFView
22+
* when view has been touched
2323
*/
2424
public interface OnTapListener {
2525

2626
/**
27-
* Called when the user has a tap gesture, before processing scroll toggling.
27+
* Called when the user has a tap gesture, before processing scroll handle toggling
2828
*
2929
* @param e MotionEvent that registered as a confirmed single tap
30-
* @return true if the single tap was handled
30+
* @return true if the single tap was handled, false to toggle scroll handle
3131
*/
3232
boolean onTap(MotionEvent e);
3333
}

0 commit comments

Comments
 (0)