Search in sources :

Example 1 with SlideModel

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

the class MessageUtils method removeThumbnailsFromCache.

public static void removeThumbnailsFromCache(SlideshowModel slideshow) {
    if (slideshow != null) {
        ThumbnailManager thumbnailManager = QKSMSApp.getApplication().getThumbnailManager();
        boolean removedSomething = false;
        Iterator<SlideModel> iterator = slideshow.iterator();
        while (iterator.hasNext()) {
            SlideModel slideModel = iterator.next();
            if (slideModel.hasImage()) {
                thumbnailManager.removeThumbnail(slideModel.getImage().getUri());
                removedSomething = true;
            } else if (slideModel.hasVideo()) {
                thumbnailManager.removeThumbnail(slideModel.getVideo().getUri());
                removedSomething = true;
            }
        }
        if (removedSomething) {
            // HACK: the keys to the thumbnail cache are the part uris, such as mms/part/3
            // Because the part table doesn't have auto-increment ids, the part ids are reused
            // when a message or thread is deleted. For now, we're clearing the whole thumbnail
            // cache so we don't retrieve stale images when part ids are reused. This will be
            // fixed in the next release in the mms provider.
            QKSMSApp.getApplication().getThumbnailManager().clearBackingStore();
        }
    }
}
Also used : ThumbnailManager(com.moez.QKSMS.common.google.ThumbnailManager) SlideModel(com.moez.QKSMS.model.SlideModel)

Example 2 with SlideModel

use of com.moez.QKSMS.model.SlideModel 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)

Example 3 with SlideModel

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

the class MmsThumbnailPresenter method present.

@Override
public void present(ItemLoadedCallback callback) {
    mOnLoadedCallback = callback;
    SlideModel slide = ((SlideshowModel) mModel).get(0);
    if (slide != null) {
        presentFirstSlide((SlideViewInterface) mView, slide);
    }
}
Also used : SlideshowModel(com.moez.QKSMS.model.SlideshowModel) SlideModel(com.moez.QKSMS.model.SlideModel)

Aggregations

SlideModel (com.moez.QKSMS.model.SlideModel)3 Intent (android.content.Intent)1 ThumbnailManager (com.moez.QKSMS.common.google.ThumbnailManager)1 MediaModel (com.moez.QKSMS.model.MediaModel)1 SlideshowModel (com.moez.QKSMS.model.SlideshowModel)1