Support hiding image caption with press and hold.

This commit is contained in:
Sagar
2025-04-11 21:15:48 +05:30
committed by Cody Henthorne
parent ac1165c8fd
commit 3ff7f89ef6
2 changed files with 8 additions and 0 deletions

View File

@@ -9,6 +9,7 @@ import android.view.View;
import android.widget.FrameLayout;
import androidx.annotation.NonNull;
import androidx.annotation.Nullable;
import androidx.exifinterface.media.ExifInterface;
import com.bumptech.glide.RequestManager;
@@ -80,6 +81,12 @@ public class ZoomingImageView extends FrameLayout {
this.subsamplingImageView.setOnClickListener(v -> ZoomingImageView.this.callOnClick());
}
@Override
public void setOnLongClickListener(@Nullable OnLongClickListener l) {
this.gifView.setOnLongClickListener(l);
this.subsamplingImageView.setOnLongClickListener(l);
}
@SuppressLint("StaticFieldLeak")
public void setImageUri(@NonNull RequestManager requestManager, @NonNull Uri uri, @NonNull String contentType, @NonNull Runnable onMediaReady) {
if (MediaUtil.isGif(contentType)) {

View File

@@ -53,6 +53,7 @@ public final class ImageMediaPreviewFragment extends MediaPreviewFragment {
zoomingImageView.setImageUri(requestManager, uri, contentType, () -> events.onMediaReady());
zoomingImageView.setOnClickListener(v -> events.singleTapOnMedia());
zoomingImageView.setOnLongClickListener(v -> events.singleTapOnMedia());
lifecycleDisposable.add(viewModel.getState().distinctUntilChanged().subscribe(state -> {
zoomingImageView.setAlpha(state.isInSharedAnimation() ? 0f : 1f);