Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public SubsamplingScaleImageView(Context context, AttributeSet attr) {
setGestureDetector(context);
this.handler = new Handler(new Handler.Callback() {
public boolean handleMessage(Message message) {
if (message.what == MESSAGE_LONG_CLICK && onLongClickListener != null) {
if (message.what == MESSAGE_LONG_CLICK && onLongClickListener != null && isLongClickable()) {
maxTouchCount = 0;
SubsamplingScaleImageView.super.setOnLongClickListener(onLongClickListener);
performLongClick();
Expand Down Expand Up @@ -922,6 +922,13 @@ private boolean onTouchEventInternal(@NonNull MotionEvent event) {
maxTouchCount = 0;
}
return true;
case MotionEvent.ACTION_CANCEL:
handler.removeMessages(MESSAGE_LONG_CLICK);
isQuickScaling = false;
isZooming = false;
isPanning = false;
maxTouchCount = 0;
return true;
}
return false;
}
Expand Down Expand Up @@ -2856,6 +2863,9 @@ public boolean hasImage() {
*/
@Override
public void setOnLongClickListener(OnLongClickListener onLongClickListener) {
if (!isLongClickable()) {
setLongClickable(true);
}
this.onLongClickListener = onLongClickListener;
}

Expand Down