diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2015-05-10 12:04:11 +0200 |
---|---|---|
committer | Daniel Gultsch <daniel@gultsch.de> | 2015-05-10 12:04:11 +0200 |
commit | 239e86a98a4af8ab7ce7f6b96bed0bb4dc9e4bb5 (patch) | |
tree | f2274df57d42fa0d8568fc1f0878bc81270632aa /src | |
parent | 33d1621e3b2c9a34689dfddc71eeb9ee4d91c348 (diff) |
optimized heart render code a bit
Diffstat (limited to 'src')
-rw-r--r-- | src/main/java/eu/siacs/conversations/entities/Message.java | 5 | ||||
-rw-r--r-- | src/main/java/eu/siacs/conversations/utils/UIHelper.java | 10 |
2 files changed, 8 insertions, 7 deletions
diff --git a/src/main/java/eu/siacs/conversations/entities/Message.java b/src/main/java/eu/siacs/conversations/entities/Message.java index 4dac0b98..c87e5518 100644 --- a/src/main/java/eu/siacs/conversations/entities/Message.java +++ b/src/main/java/eu/siacs/conversations/entities/Message.java @@ -478,10 +478,7 @@ public class Message extends AbstractEntity { } public boolean bodyIsHeart() { - return body != null && - (body.trim().equals(UIHelper.BLACK_HEART_SUIT) - || body.trim().equals(UIHelper.HEAVY_BLACK_HEART_SUIT) - || body.trim().equals(UIHelper.WHITE_HEART_SUIT)); + return body != null && UIHelper.HEARTS.contains(body.trim()); } public ImageParams getImageParams() { diff --git a/src/main/java/eu/siacs/conversations/utils/UIHelper.java b/src/main/java/eu/siacs/conversations/utils/UIHelper.java index 2cfd5823..9c62dcbf 100644 --- a/src/main/java/eu/siacs/conversations/utils/UIHelper.java +++ b/src/main/java/eu/siacs/conversations/utils/UIHelper.java @@ -1,6 +1,8 @@ package eu.siacs.conversations.utils; import java.net.URLConnection; +import java.util.ArrayList; +import java.util.Arrays; import java.util.Calendar; import java.util.Date; @@ -18,9 +20,11 @@ import android.util.Pair; public class UIHelper { - public static String BLACK_HEART_SUIT = "\u2665"; - public static String HEAVY_BLACK_HEART_SUIT = "\u2764"; - public static String WHITE_HEART_SUIT = "\u2661"; + private static String BLACK_HEART_SUIT = "\u2665"; + private static String HEAVY_BLACK_HEART_SUIT = "\u2764"; + private static String WHITE_HEART_SUIT = "\u2661"; + + public static final ArrayList<String> HEARTS = new ArrayList<>(Arrays.asList(BLACK_HEART_SUIT,HEAVY_BLACK_HEART_SUIT,WHITE_HEART_SUIT)); private static final int SHORT_DATE_FLAGS = DateUtils.FORMAT_SHOW_DATE | DateUtils.FORMAT_NO_YEAR | DateUtils.FORMAT_ABBREV_ALL; |