aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/utils
diff options
context:
space:
mode:
authorDaniel Gultsch <daniel@gultsch.de>2016-07-28 22:58:37 +0200
committerChristian Schneppe <christian@pix-art.de>2016-07-29 22:22:09 +0200
commit2d75d6804489337247f133a1b8542860af2066c8 (patch)
treeaced6cb56be7180b0e1af4fd2bfb9c72751d4318 /src/main/java/de/pixart/messenger/utils
parent5764829b086bfc83060783a1a146257e8d153c90 (diff)
show identity type for device selection
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils')
-rw-r--r--src/main/java/de/pixart/messenger/utils/CryptoHelper.java3
-rw-r--r--src/main/java/de/pixart/messenger/utils/UIHelper.java18
2 files changed, 21 insertions, 0 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/CryptoHelper.java b/src/main/java/de/pixart/messenger/utils/CryptoHelper.java
index d043e08b1..012ebf4d0 100644
--- a/src/main/java/de/pixart/messenger/utils/CryptoHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/CryptoHelper.java
@@ -21,6 +21,7 @@ import java.util.Iterator;
import java.util.LinkedHashSet;
import java.util.List;
import java.util.Locale;
+import java.util.regex.Pattern;
import de.pixart.messenger.Config;
import de.pixart.messenger.R;
@@ -31,6 +32,8 @@ import de.pixart.messenger.xmpp.jid.Jid;
public final class CryptoHelper {
public static final String FILETRANSFER = "?FILETRANSFERv1:";
private final static char[] hexArray = "0123456789abcdef".toCharArray();
+
+ public static final Pattern UUID_PATTERN = Pattern.compile("[0-9a-f]{8}-[0-9a-f]{4}-4[0-9a-f]{3}-[89ab][0-9a-f]{3}-[0-9a-f]{12}");
final public static byte[] ONE = new byte[] { 0, 0, 0, 1 };
public static String bytesToHex(byte[] bytes) {
diff --git a/src/main/java/de/pixart/messenger/utils/UIHelper.java b/src/main/java/de/pixart/messenger/utils/UIHelper.java
index 53c1b8a11..7f04c4b7b 100644
--- a/src/main/java/de/pixart/messenger/utils/UIHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/UIHelper.java
@@ -19,6 +19,7 @@ import de.pixart.messenger.entities.Message;
import de.pixart.messenger.entities.Presence;
import de.pixart.messenger.entities.Transferable;
import de.pixart.messenger.xmpp.jid.Jid;
+import de.pixart.messenger.ui.XmppActivity;
public class UIHelper {
@@ -286,4 +287,21 @@ public class UIHelper {
return new ListItem.Tag(context.getString(R.string.presence_online), 0xff259b24);
}
}
+
+ public static String tranlasteType(Context context, String type) {
+ switch (type.toLowerCase()) {
+ case "pc":
+ return context.getString(R.string.type_pc);
+ case "phone":
+ return context.getString(R.string.type_phone);
+ case "tablet":
+ return context.getString(R.string.type_tablet);
+ case "web":
+ return context.getString(R.string.type_web);
+ case "console":
+ return context.getString(R.string.type_console);
+ default:
+ return type;
+ }
+ }
}