diff options
author | Christian Schneppe <christian@pix-art.de> | 2019-02-09 20:04:49 +0100 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2019-02-09 20:04:49 +0100 |
commit | 835100d5f4ee36815e8b967cb97e54a4b355165a (patch) | |
tree | d566da2e1d460814a9012840edbd74e5a7608560 /src/main/java/de | |
parent | a10d57e618713940c4a750d1f858a693569c0f0e (diff) |
small fixes for web preview
make links clickable and don't use transform links toLowerCase()
Diffstat (limited to '')
-rw-r--r-- | src/main/java/de/pixart/messenger/entities/Message.java | 4 | ||||
-rw-r--r-- | src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java | 5 |
2 files changed, 6 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/entities/Message.java b/src/main/java/de/pixart/messenger/entities/Message.java index 178a8e425..c8850c278 100644 --- a/src/main/java/de/pixart/messenger/entities/Message.java +++ b/src/main/java/de/pixart/messenger/entities/Message.java @@ -786,9 +786,9 @@ public class Message extends AbstractEntity implements AvatarService.Avatarable } public synchronized boolean isWebUri() { - String url = body.toLowerCase().trim(); + String url = body.trim(); if (isWebUri == null) { - isWebUri = URLUtil.isValidUrl(url) && Patterns.WEB_URL.matcher(url).matches(); + isWebUri = URLUtil.isValidUrl(url) && Patterns.WEB_URL.matcher(url).matches() && !url.contains(" "); } return isWebUri; } diff --git a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java index 897e37e85..3f77070a4 100644 --- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java +++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java @@ -673,7 +673,7 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie viewHolder.gifImage.setVisibility(View.GONE); boolean showLinksInside = activity.getPreferences().getBoolean(SHOW_LINKS_INSIDE, activity.getResources().getBoolean(R.bool.show_links_inside)); viewHolder.messageBody.setVisibility(View.VISIBLE); - Editable body = new SpannableStringBuilder(message.getBody().toLowerCase()); + Editable body = new SpannableStringBuilder(message.getBody()); if (darkBackground) { viewHolder.messageBody.setTextAppearance(getContext(), R.style.TextAppearance_Conversations_Body1_OnDark); } else { @@ -682,6 +682,9 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie MyLinkify.addLinks(body, false); viewHolder.messageBody.setAutoLinkMask(0); viewHolder.messageBody.setText(EmojiWrapper.transform(body)); + viewHolder.messageBody.setTextIsSelectable(true); + viewHolder.messageBody.setMovementMethod(ClickableMovementMethod.getInstance()); + listSelectionManager.onUpdate(viewHolder.messageBody, message); if (showLinksInside) { viewHolder.richlinkview.setVisibility(View.VISIBLE); viewHolder.richlinkview.setLink(body.toString(), new ViewListener() { |