aboutsummaryrefslogtreecommitdiffstats
path: root/src/eu/siacs/conversations/utils
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2014-09-01 23:58:00 +0200
committerDaniel Gultsch <daniel@gultsch.de>2014-09-01 23:58:00 +0200
commit6291ebf1a34bb423a329f7fbfaa8191db3c4e04a (patch)
tree20d2db4de42d3efe85cdf0feaa728039b3aa6b4d /src/eu/siacs/conversations/utils
parenta7881754f5869860aac058d58838e5da72d3b40d (diff)
parent546082147ae161aa7568277db653655483cd745e (diff)
Merge pull request #380 from emdete/unicode_emoticons
add translation from ascii to unicode emoticons
Diffstat (limited to 'src/eu/siacs/conversations/utils')
-rw-r--r--src/eu/siacs/conversations/utils/UIHelper.java23
1 files changed, 23 insertions, 0 deletions
diff --git a/src/eu/siacs/conversations/utils/UIHelper.java b/src/eu/siacs/conversations/utils/UIHelper.java
index 1f584fe5..69f833f2 100644
--- a/src/eu/siacs/conversations/utils/UIHelper.java
+++ b/src/eu/siacs/conversations/utils/UIHelper.java
@@ -545,4 +545,27 @@ public class UIHelper {
return getContactPicture(account.getJid(), size, context, false);
}
}
+ public static String transformAsciiEmoticons(String body) {
+ if (body != null) {
+ for (String[] r: new String[][]{ // see https://de.wikipedia.org/wiki/Unicodeblock_Smileys
+ {":-?\\)", " 😀 ", },
+ {";-?\\)", " 😉 ", },
+ {":-?D", " 😃 ", },
+ {":-?[Ppb]", " 😋 ", },
+ {"8-?\\)", " 😎 ", },
+ {":-?\\|", " 😐 ", },
+ {":-?[/\\\\]", " 😕 ", },
+ {":-?\\*", " 😗 ", },
+ {":-?[0Oo]", " 😮 ", },
+ {":-?\\(", " 😞 ", },
+ {"\\^\\^", " 😁 ", },
+ }) {
+ String p = r[0];
+ p = "(^" + p + "$|^" + p + " +| +" + p + " +| +" + p + "$)";
+ body = body.replaceAll(p, r[1]);
+ }
+ body = body.trim();
+ }
+ return body;
+ }
}