Skip to content

Commit

Permalink
Respect longClickable attribute
Browse files Browse the repository at this point in the history
  • Loading branch information
talklittle committed Jun 11, 2021
1 parent 173e421 commit 475cb0d
Showing 1 changed file with 4 additions and 1 deletion.
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 @@ -2856,6 +2856,9 @@ public boolean hasImage() {
*/
@Override
public void setOnLongClickListener(OnLongClickListener onLongClickListener) {
if (!isLongClickable()) {
setLongClickable(true);
}
this.onLongClickListener = onLongClickListener;
}

Expand Down

0 comments on commit 475cb0d

Please sign in to comment.