Search in sources :

Example 1 with MediaModel

use of com.moez.QKSMS.model.MediaModel in project qksms by moezbhatti.

the class MessageUtils method viewSimpleSlideshow.

public static void viewSimpleSlideshow(Context context, SlideshowModel slideshow) {
    if (!slideshow.isSimple()) {
        throw new IllegalArgumentException("viewSimpleSlideshow() called on a non-simple slideshow");
    }
    SlideModel slide = slideshow.get(0);
    MediaModel mm = null;
    if (slide.hasImage()) {
        mm = slide.getImage();
    } else if (slide.hasVideo()) {
        mm = slide.getVideo();
    }
    if (mm == null) {
        return;
    }
    Intent intent = new Intent(Intent.ACTION_VIEW);
    intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
    // So we don't see "surrounding" images in Gallery
    intent.putExtra("SingleItemOnly", true);
    String contentType;
    contentType = mm.getContentType();
    intent.setDataAndType(mm.getUri(), contentType);
    context.startActivity(intent);
}
Also used : MediaModel(com.moez.QKSMS.model.MediaModel) Intent(android.content.Intent) SlideModel(com.moez.QKSMS.model.SlideModel)

Aggregations

Intent (android.content.Intent)1 MediaModel (com.moez.QKSMS.model.MediaModel)1 SlideModel (com.moez.QKSMS.model.SlideModel)1