Use inline image viewer for unlinked images only

This commit is contained in:
M66B 2019-04-24 09:27:03 +02:00
parent aa463b3701
commit 8543f43c0f
1 changed files with 10 additions and 11 deletions

View File

@ -1769,24 +1769,23 @@ public class AdapterMessage extends RecyclerView.Adapter<AdapterMessage.ViewHold
int line = layout.getLineForVertical(y);
int off = layout.getOffsetForHorizontal(line, x);
boolean show_images = properties.getValue("images", id);
URLSpan[] link = buffer.getSpans(off, off, URLSpan.class);
if (link.length > 0) {
String url = link[0].getURL();
Uri uri = Uri.parse(url);
if (uri.getScheme() == null)
uri = Uri.parse("https://" + url);
onOpenLink(uri);
return true;
}
boolean show_images = properties.getValue("images", id);
if (show_images) {
ImageSpan[] image = buffer.getSpans(off, off, ImageSpan.class);
if (image.length > 0) {
onOpenImage(image[0].getDrawable(), image[0].getSource());
return true;
}
} else {
URLSpan[] link = buffer.getSpans(off, off, URLSpan.class);
if (link.length > 0) {
String url = link[0].getURL();
Uri uri = Uri.parse(url);
if (uri.getScheme() == null)
uri = Uri.parse("https://" + url);
onOpenLink(uri);
return true;
}
}
}