diff --git a/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewPagerIndicator.java b/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewPagerIndicator.java index 20f4d72fdc..27b2f804c3 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewPagerIndicator.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/AvatarPreviewPagerIndicator.java @@ -364,10 +364,6 @@ public void onRelease() { postInvalidateOnAnimation(); } - @Override - public void onClick() { - } - @Override public void onPhotosLoaded() { } diff --git a/TMessagesProj/src/main/java/org/telegram/ui/Components/ProfileGalleryView.java b/TMessagesProj/src/main/java/org/telegram/ui/Components/ProfileGalleryView.java index 982da733d8..eb779ec00c 100644 --- a/TMessagesProj/src/main/java/org/telegram/ui/Components/ProfileGalleryView.java +++ b/TMessagesProj/src/main/java/org/telegram/ui/Components/ProfileGalleryView.java @@ -97,6 +97,8 @@ public class ProfileGalleryView extends CircularViewPager implements Notificatio private int imagesLayerNum; + private long lastDownTime; + public void setHasActiveVideo(boolean hasActiveVideo) { this.hasActiveVideo = hasActiveVideo; } @@ -129,7 +131,7 @@ public interface Callback { void onRelease(); - void onClick(); + default void onClick() {}; void onPhotosLoaded(); @@ -411,6 +413,22 @@ public void setAnimatedFileMaybe(AnimatedFileDrawable drawable) { @Override public boolean onTouchEvent(MotionEvent ev) { + // nekox: long click + switch (ev.getAction()) { + case MotionEvent.ACTION_DOWN: + lastDownTime = System.currentTimeMillis(); + isDownReleased = false; + case MotionEvent.ACTION_MOVE: + break; + case MotionEvent.ACTION_UP: + long pressDuration = System.currentTimeMillis() - lastDownTime; + if (pressDuration >= 5000 && !isDownReleased) { + isDownReleased = true; + callback.onClick(); + } + break; + } + if (adapter == null) { return false; } @@ -1227,10 +1245,6 @@ public void onAnimationReady(ImageReceiver imageReceiver) { item.imageView.setRoundRadius(roundTopRadius, roundTopRadius, roundBottomRadius, roundBottomRadius); - item.imageView.setOnClickListener(__ -> { - callback.onClick(); - }); - item.imageView.setTag(realPosition); return item;