From 1f378bffc80c73d23cb62106c912043504ce7fca Mon Sep 17 00:00:00 2001 From: iNPUTmice Date: Wed, 3 Sep 2014 09:15:07 +0200 Subject: [PATCH] made emoticon parsing enableable - default false --- src/eu/siacs/conversations/Config.java | 2 ++ .../siacs/conversations/ui/adapter/ConversationAdapter.java | 6 +++++- src/eu/siacs/conversations/ui/adapter/MessageAdapter.java | 6 +++++- 3 files changed, 12 insertions(+), 2 deletions(-) diff --git a/src/eu/siacs/conversations/Config.java b/src/eu/siacs/conversations/Config.java index 04c8af3d9..6219b6b06 100644 --- a/src/eu/siacs/conversations/Config.java +++ b/src/eu/siacs/conversations/Config.java @@ -16,6 +16,8 @@ public final class Config { public static final Bitmap.CompressFormat AVATAR_FORMAT = Bitmap.CompressFormat.WEBP; public static final int MESSAGE_MERGE_WINDOW = 20; + + public static final boolean PARSE_EMOTICONS = false; private Config() { diff --git a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java index c3ff5b22b..6eb9846ad 100644 --- a/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/ConversationAdapter.java @@ -2,6 +2,7 @@ package eu.siacs.conversations.ui.adapter; import java.util.List; +import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Conversation; import eu.siacs.conversations.entities.Message; @@ -63,7 +64,10 @@ public class ConversationAdapter extends ArrayAdapter { || latestMessage.getType() == Message.TYPE_PRIVATE) { if ((latestMessage.getEncryption() != Message.ENCRYPTION_PGP) && (latestMessage.getEncryption() != Message.ENCRYPTION_DECRYPTION_FAILED)) { - convLastMsg.setText(UIHelper.transformAsciiEmoticons(conv.getLatestMessage().getBody())); + String body = Config.PARSE_EMOTICONS ? UIHelper + .transformAsciiEmoticons(latestMessage.getBody()) + : latestMessage.getBody(); + convLastMsg.setText(body); } else { convLastMsg.setText(activity .getText(R.string.encrypted_message_received)); diff --git a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java index 08388ed84..ccf25a334 100644 --- a/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java +++ b/src/eu/siacs/conversations/ui/adapter/MessageAdapter.java @@ -3,6 +3,7 @@ package eu.siacs.conversations.ui.adapter; import java.util.HashMap; import java.util.List; +import eu.siacs.conversations.Config; import eu.siacs.conversations.R; import eu.siacs.conversations.entities.Contact; import eu.siacs.conversations.entities.Conversation; @@ -215,7 +216,10 @@ public class MessageAdapter extends ArrayAdapter { viewHolder.messageBody.setVisibility(View.VISIBLE); if (message.getBody() != null) { if (message.getType() != Message.TYPE_PRIVATE) { - viewHolder.messageBody.setText(UIHelper.transformAsciiEmoticons(message.getMergedBody())); + String body = Config.PARSE_EMOTICONS ? UIHelper + .transformAsciiEmoticons(message.getMergedBody()) + : message.getMergedBody(); + viewHolder.messageBody.setText(body); } else { String privateMarker; if (message.getStatus() <= Message.STATUS_RECEIVED) {