aboutsummaryrefslogtreecommitdiffstats
path: root/src/main
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java50
-rw-r--r--src/main/res/values/themes.xml4
2 files changed, 30 insertions, 24 deletions
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 19bf6734f..6040017d6 100644
--- a/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
+++ b/src/main/java/de/pixart/messenger/ui/adapter/MessageAdapter.java
@@ -110,33 +110,39 @@ public class MessageAdapter extends ArrayAdapter<Message> implements CopyTextVie
+ "|(?:\\%[a-fA-F0-9]{2}))+");
boolean isResendable = false;
- private static final Linkify.TransformFilter WEBURL_TRANSFORM_FILTER = new Linkify.TransformFilter() {
- @Override
- public String transformUrl(Matcher matcher, String url) {
- if (url == null) {
- return null;
- }
- final String lcUrl = url.toLowerCase(Locale.US);
- if (lcUrl.startsWith("http://") || lcUrl.startsWith("https://")) {
- return url;
- } else {
- return "http://" + url;
- }
+ private static final Linkify.TransformFilter WEBURL_TRANSFORM_FILTER = (matcher, url) -> {
+ if (url == null) {
+ return null;
}
- };
- private static final Linkify.MatchFilter WEBURL_MATCH_FILTER = new Linkify.MatchFilter() {
- @Override
- public boolean acceptMatch(CharSequence cs, int start, int end) {
- return start < 1 || (cs.charAt(start - 1) != '@' && cs.charAt(start - 1) != '.' && !cs.subSequence(Math.max(0, start - 3), start).equals("://"));
+ final String lcUrl = url.toLowerCase(Locale.US);
+ if (lcUrl.startsWith("http://") || lcUrl.startsWith("https://")) {
+ return removeTrailingBracket(url);
+ } else {
+ return "http://" + removeTrailingBracket(url);
}
};
- private static final Linkify.MatchFilter XMPPURI_MATCH_FILTER = new Linkify.MatchFilter() {
- @Override
- public boolean acceptMatch(CharSequence s, int start, int end) {
- XmppUri uri = new XmppUri(s.subSequence(start, end).toString());
- return uri.isJidValid();
+ private static String removeTrailingBracket(final String url) {
+ int numOpenBrackets = 0;
+ for (char c : url.toCharArray()) {
+ if (c == '(') {
+ ++numOpenBrackets;
+ } else if (c == ')') {
+ --numOpenBrackets;
+ }
+ }
+ if (numOpenBrackets != 0 && url.charAt(url.length() - 1) == ')') {
+ return url.substring(0, url.length() - 1);
+ } else {
+ return url;
}
+ }
+
+ private static final Linkify.MatchFilter WEBURL_MATCH_FILTER = (cs, start, end) -> start < 1 || (cs.charAt(start - 1) != '@' && cs.charAt(start - 1) != '.' && !cs.subSequence(Math.max(0, start - 3), start).equals("://"));
+
+ private static final Linkify.MatchFilter XMPPURI_MATCH_FILTER = (s, start, end) -> {
+ XmppUri uri = new XmppUri(s.subSequence(start, end).toString());
+ return uri.isJidValid();
};
private final XmppActivity activity;
diff --git a/src/main/res/values/themes.xml b/src/main/res/values/themes.xml
index 8a4b7f787..f2e3460bd 100644
--- a/src/main/res/values/themes.xml
+++ b/src/main/res/values/themes.xml
@@ -159,8 +159,8 @@
</style>
<style name="ConversationsTheme.FullScreen" parent="@style/Theme.AppCompat.Light">
- <item name="colorPrimary">@color/primary500</item>
- <item name="colorPrimaryDark">@color/primary700</item>
+ <item name="colorPrimary">@color/primary</item>
+ <item name="colorPrimaryDark">@color/primary_dark</item>
<item name="android:windowNoTitle">true</item>
<item name="android:windowActionBar">false</item>
<item name="android:windowFullscreen">true</item>