Search in sources :

Example 1 with ZoomingImageView

use of org.thoughtcrime.securesms.components.ZoomingImageView in project Signal-Android by WhisperSystems.

the class ImageMediaPreviewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ZoomingImageView zoomingImageView = (ZoomingImageView) inflater.inflate(R.layout.media_preview_image_fragment, container, false);
    GlideRequests glideRequests = GlideApp.with(requireActivity());
    Bundle arguments = requireArguments();
    Uri uri = arguments.getParcelable(DATA_URI);
    String contentType = arguments.getString(DATA_CONTENT_TYPE);
    if (!MediaUtil.isImageType(contentType)) {
        throw new AssertionError("This fragment can only display images");
    }
    // noinspection ConstantConditions
    zoomingImageView.setImageUri(glideRequests, uri, contentType);
    zoomingImageView.setOnClickListener(v -> events.singleTapOnMedia());
    return zoomingImageView;
}
Also used : GlideRequests(org.thoughtcrime.securesms.mms.GlideRequests) Bundle(android.os.Bundle) ZoomingImageView(org.thoughtcrime.securesms.components.ZoomingImageView) Uri(android.net.Uri)

Example 2 with ZoomingImageView

use of org.thoughtcrime.securesms.components.ZoomingImageView in project Signal-Android by signalapp.

the class ImageMediaPreviewFragment method onCreateView.

@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
    ZoomingImageView zoomingImageView = (ZoomingImageView) inflater.inflate(R.layout.media_preview_image_fragment, container, false);
    GlideRequests glideRequests = GlideApp.with(requireActivity());
    Bundle arguments = requireArguments();
    Uri uri = arguments.getParcelable(DATA_URI);
    String contentType = arguments.getString(DATA_CONTENT_TYPE);
    if (!MediaUtil.isImageType(contentType)) {
        throw new AssertionError("This fragment can only display images");
    }
    // noinspection ConstantConditions
    zoomingImageView.setImageUri(glideRequests, uri, contentType);
    zoomingImageView.setOnClickListener(v -> events.singleTapOnMedia());
    return zoomingImageView;
}
Also used : GlideRequests(org.thoughtcrime.securesms.mms.GlideRequests) Bundle(android.os.Bundle) ZoomingImageView(org.thoughtcrime.securesms.components.ZoomingImageView) Uri(android.net.Uri)

Aggregations

Uri (android.net.Uri)2 Bundle (android.os.Bundle)2 ZoomingImageView (org.thoughtcrime.securesms.components.ZoomingImageView)2 GlideRequests (org.thoughtcrime.securesms.mms.GlideRequests)2