Show link of not shown images

This commit is contained in:
M66B 2019-04-24 18:46:46 +02:00
parent 7e8895a368
commit 7e72cea9ac
1 changed files with 12 additions and 6 deletions

View File

@ -1779,12 +1779,18 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
return true; return true;
} }
boolean show_images = properties.getValue("images", id);
if (show_images) {
ImageSpan[] image = buffer.getSpans(off, off, ImageSpan.class); ImageSpan[] image = buffer.getSpans(off, off, ImageSpan.class);
if (image.length > 0 && image[0].getSource() != null) { if (image.length > 0 && image[0].getSource() != null) {
onOpenImage(image[0].getDrawable(), image[0].getSource()); boolean show_images = properties.getValue("images", id);
if (show_images) {
onOpenImage(image[0].getDrawable());
return true; return true;
} else {
Uri uri = Uri.parse(image[0].getSource());
if ("http".equals(uri.getScheme()) || "https".equals(uri.getScheme())) {
onOpenLink(uri);
return true;
}
} }
} }
} }
@ -1905,7 +1911,7 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
} }
} }
private void onOpenImage(Drawable drawable, String source) { private void onOpenImage(Drawable drawable) {
PhotoView pv = new PhotoView(context); PhotoView pv = new PhotoView(context);
pv.setImageDrawable(drawable); pv.setImageDrawable(drawable);