aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java
diff options
context:
space:
mode:
Diffstat (limited to 'src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java')
-rw-r--r--src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java49
1 files changed, 17 insertions, 32 deletions
diff --git a/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java b/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java
index 532ff1cb..e1915e99 100644
--- a/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java
+++ b/src/main/java/de/thedevstack/conversationsplus/utils/UIHelper.java
@@ -1,44 +1,27 @@
package de.thedevstack.conversationsplus.utils;
+import android.content.Context;
+import android.text.format.DateFormat;
+import android.text.format.DateUtils;
+import android.util.Pair;
+
import java.math.BigDecimal;
-import java.text.NumberFormat;
import java.util.ArrayList;
import java.util.Arrays;
-import java.net.URLConnection;
import java.util.Calendar;
import java.util.Date;
-import java.util.HashMap;
import java.util.Locale;
-import java.util.Map;
-import java.util.Map.Entry;
-import java.util.regex.Pattern;
-import java.util.regex.Matcher;
-import de.thedevstack.conversationsplus.Config;
import de.thedevstack.conversationsplus.R;
import de.thedevstack.conversationsplus.entities.Contact;
import de.thedevstack.conversationsplus.entities.Conversation;
-import de.thedevstack.conversationsplus.entities.Presences;
-import de.thedevstack.conversationsplus.entities.Transferable;
import de.thedevstack.conversationsplus.entities.Message;
+import de.thedevstack.conversationsplus.entities.Presence;
+import de.thedevstack.conversationsplus.entities.Transferable;
import de.thedevstack.conversationsplus.xmpp.jid.Jid;
-import android.content.Context;
-import android.text.format.DateFormat;
-import android.text.format.DateUtils;
-import android.text.Spannable.Factory;
-import android.text.style.ImageSpan;
-import android.text.Spannable;
-import android.util.Pair;
-
public class UIHelper {
- 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 ArrayList<String> LOCATION_QUESTIONS = new ArrayList<>(Arrays.asList(
"where are you", //en
"where are you now", //en
@@ -144,7 +127,7 @@ public class UIHelper {
}
public static int getColorForName(String name) {
- if (name.isEmpty()) {
+ if (name == null || name.isEmpty()) {
return 0xFF202020;
}
int colors[] = {0xFFe91e63, 0xFF9c27b0, 0xFF673ab7, 0xFF3f51b5,
@@ -184,7 +167,9 @@ public class UIHelper {
return new Pair<>("",false);
}
} else if (message.getEncryption() == Message.ENCRYPTION_PGP) {
- return new Pair<>(context.getString(R.string.encrypted_message_received),true);
+ return new Pair<>(context.getString(R.string.pgp_message),true);
+ } else if (message.getEncryption() == Message.ENCRYPTION_DECRYPTION_FAILED) {
+ return new Pair<>(context.getString(R.string.decryption_failed), true);
} else if (message.getType() == Message.TYPE_FILE || message.getType() == Message.TYPE_IMAGE) {
if (message.getStatus() == Message.STATUS_RECEIVED) {
return new Pair<>(context.getString(R.string.received_x_file,
@@ -254,15 +239,15 @@ public class UIHelper {
}
}
- public static String getStatusColor(int status) {
+ public static String getStatusColor(Presence.Status status) {
switch (status) {
- case Presences.ONLINE:
- case Presences.CHAT:
+ case ONLINE:
+ case CHAT:
return "#259B23";
- case Presences.AWAY:
- case Presences.XA:
+ case AWAY:
+ case XA:
return "#FF9800";
- case Presences.DND:
+ case DND:
return "#E51C23";
}
return "#CCCCCC";