StfalconImageViewer icon indicating copy to clipboard operation
StfalconImageViewer copied to clipboard

click to dismiss

Open shejishi opened this issue 4 years ago • 3 comments

I want to make him disappear when I click, how can I do it?

shejishi avatar Aug 11 '20 06:08 shejishi

Please, add this functionality

antonshkurenko avatar Apr 05 '21 20:04 antonshkurenko

I used an overlay view to add a close button, which I could then add an OnClickListener to, to close the image viewer:

private StfalconImageViewer<String> imageViewer;

public MyClass(Activity context)
{
    this.pictureDetailsView = context.getLayoutInflater().inflate(R.layout.item_image_overlay_view, null, false);

    this.imageViewer =  new StfalconImageViewer.Builder<>(context, imageUrlList, imageLoader)
            .withStartPosition(0)
            .withOverlayView(pictureDetailsView)
    .build();

    ImageView closeImageView = this.pictureDetailsView.findViewById(R.id.ivCloseImageView);
    closeImageView.setOnClickListener(v ->
    {
        if(imageViewer != null)
        {
            imageViewer.close();
        }
    });
}

item_image_overlay_view.xml <RelativeLayout android:layout_width="match_parent" android:layout_height="match_parent">

<ImageView
    android:id="@+id/ivCloseImageView"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:layout_alignParentTop="true"
    android:layout_marginStart="20dp"
    android:layout_marginTop="20dp"
    android:clickable="true"
    android:focusable="true"
    app:srcCompat="@drawable/ic_close"
    app:tint="@color/mea_background_90" />

StamplerJ avatar Aug 18 '21 08:08 StamplerJ

I think a good way to do this is through . withOverlayView;

custom overlay to recognize click event

chang-guofeng avatar Sep 08 '21 06:09 chang-guofeng