only open media preview when there is something to preview.

Fixes #3389
Closes #3412
// FREEBIE
This commit is contained in:
Rhodey Orbits 2015-06-12 12:02:41 -07:00 committed by Moxie Marlinspike
parent f72cd5b0ff
commit aa37d6e7f9

View File

@ -403,7 +403,9 @@ public class ConversationItem extends LinearLayout {
public void onClick(final View v, final Slide slide) { public void onClick(final View v, final Slide slide) {
if (!batchSelected.isEmpty()) { if (!batchSelected.isEmpty()) {
selectionClickListener.onItemClick(null, ConversationItem.this, -1, -1); selectionClickListener.onItemClick(null, ConversationItem.this, -1, -1);
} else if (MediaPreviewActivity.isContentTypeSupported(slide.getContentType())) { } else if (MediaPreviewActivity.isContentTypeSupported(slide.getContentType()) &&
slide.getThumbnailUri() != null)
{
Intent intent = new Intent(context, MediaPreviewActivity.class); Intent intent = new Intent(context, MediaPreviewActivity.class);
intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION); intent.addFlags(Intent.FLAG_GRANT_READ_URI_PERMISSION);
intent.setDataAndType(slide.getUri(), slide.getContentType()); intent.setDataAndType(slide.getUri(), slide.getContentType());
@ -411,7 +413,7 @@ public class ConversationItem extends LinearLayout {
intent.putExtra(MediaPreviewActivity.DATE_EXTRA, messageRecord.getDateReceived()); intent.putExtra(MediaPreviewActivity.DATE_EXTRA, messageRecord.getDateReceived());
context.startActivity(intent); context.startActivity(intent);
} else { } else if (slide.getThumbnailUri() != null) {
AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context); AlertDialogWrapper.Builder builder = new AlertDialogWrapper.Builder(context);
builder.setTitle(R.string.ConversationItem_view_secure_media_question); builder.setTitle(R.string.ConversationItem_view_secure_media_question);
builder.setIconAttribute(R.attr.dialog_alert_icon); builder.setIconAttribute(R.attr.dialog_alert_icon);