private static void viewMmsMessageAttachment( Context context, Uri msgUri, SlideshowModel slideshow, int requestCode) { boolean isSimple = (slideshow == null) ? false : slideshow.isSimple(); if (isSimple) { // In attachment-editor mode, we only ever have one slide. MessageUtils.viewSimpleSlideshow(context, slideshow); } else { // If a slideshow was provided, save it to disk first. if (slideshow != null) { PduPersister persister = PduPersister.getPduPersister(context); try { PduBody pb = slideshow.toPduBody(); persister.updateParts(msgUri, pb); slideshow.sync(pb); } catch (MmsException e) { Log.e(TAG, "Unable to save message for preview"); return; } } // Launch the slideshow activity to play/view. Intent intent = new Intent(context, SlideshowActivity.class); intent.setData(msgUri); if (requestCode > 0 && context instanceof Activity) { ((Activity) context).startActivityForResult(intent, requestCode); } else { context.startActivity(intent); } } }
public static void viewMmsMessageAttachment( Context context, WorkingMessage msg, int requestCode) { SlideshowModel slideshow = msg.getSlideshow(); if (slideshow == null) { throw new IllegalStateException("msg.getSlideshow() == null"); } if (slideshow.isSimple()) { MessageUtils.viewSimpleSlideshow(context, slideshow); } else { Uri uri = msg.saveAsMms(false); if (uri != null) { // Pass null for the slideshow paramater, otherwise viewMmsMessageAttachment // will persist the slideshow to disk again (we just did that above in saveAsMms) viewMmsMessageAttachment(context, uri, null, requestCode); } } }