optimized heart render code a bit

This commit is contained in:
Daniel Gultsch 2015-05-10 12:04:11 +02:00
parent 33d1621e3b
commit 239e86a98a
2 changed files with 8 additions and 7 deletions

View File

@ -478,10 +478,7 @@ public class Message extends AbstractEntity {
} }
public boolean bodyIsHeart() { public boolean bodyIsHeart() {
return body != null && return body != null && UIHelper.HEARTS.contains(body.trim());
(body.trim().equals(UIHelper.BLACK_HEART_SUIT)
|| body.trim().equals(UIHelper.HEAVY_BLACK_HEART_SUIT)
|| body.trim().equals(UIHelper.WHITE_HEART_SUIT));
} }
public ImageParams getImageParams() { public ImageParams getImageParams() {

View File

@ -1,6 +1,8 @@
package eu.siacs.conversations.utils; package eu.siacs.conversations.utils;
import java.net.URLConnection; import java.net.URLConnection;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Calendar; import java.util.Calendar;
import java.util.Date; import java.util.Date;
@ -18,9 +20,11 @@ import android.util.Pair;
public class UIHelper { public class UIHelper {
public static String BLACK_HEART_SUIT = "\u2665"; private static String BLACK_HEART_SUIT = "\u2665";
public static String HEAVY_BLACK_HEART_SUIT = "\u2764"; private static String HEAVY_BLACK_HEART_SUIT = "\u2764";
public static String WHITE_HEART_SUIT = "\u2661"; 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 private static final int SHORT_DATE_FLAGS = DateUtils.FORMAT_SHOW_DATE
| DateUtils.FORMAT_NO_YEAR | DateUtils.FORMAT_ABBREV_ALL; | DateUtils.FORMAT_NO_YEAR | DateUtils.FORMAT_ABBREV_ALL;