aboutsummaryrefslogtreecommitdiffstats
path: root/src/main/java/de/pixart/messenger/utils/UIHelper.java
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--src/main/java/de/pixart/messenger/utils/UIHelper.java30
1 files changed, 27 insertions, 3 deletions
diff --git a/src/main/java/de/pixart/messenger/utils/UIHelper.java b/src/main/java/de/pixart/messenger/utils/UIHelper.java
index 7f04c4b7b..7175b381e 100644
--- a/src/main/java/de/pixart/messenger/utils/UIHelper.java
+++ b/src/main/java/de/pixart/messenger/utils/UIHelper.java
@@ -11,7 +11,9 @@ import java.util.Calendar;
import java.util.Date;
import java.util.Locale;
+import de.pixart.messenger.Config;
import de.pixart.messenger.R;
+import de.pixart.messenger.crypto.axolotl.AxolotlService;
import de.pixart.messenger.entities.Contact;
import de.pixart.messenger.entities.Conversation;
import de.pixart.messenger.entities.ListItem;
@@ -19,7 +21,6 @@ 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 {
@@ -74,8 +75,7 @@ public class UIHelper {
} else if (difference < 60 * 2) {
return context.getString(R.string.minute_ago);
} else if (difference < 60 * 15) {
- return context.getString(R.string.minutes_ago,
- Math.round(difference / 60.0));
+ return context.getString(R.string.minutes_ago,Math.round(difference / 60.0));
} else if (today(date)) {
java.text.DateFormat df = DateFormat.getTimeFormat(context);
return df.format(date);
@@ -252,6 +252,30 @@ public class UIHelper {
}
}
+ public static String getMessageHint(Context context, Conversation conversation) {
+ switch (conversation.getNextEncryption()) {
+ case Message.ENCRYPTION_NONE:
+ if (Config.multipleEncryptionChoices()) {
+ return context.getString(R.string.send_unencrypted_message);
+ } else {
+ return context.getString(R.string.send_message_to_x,conversation.getName());
+ }
+ case Message.ENCRYPTION_OTR:
+ return context.getString(R.string.send_otr_message);
+ case Message.ENCRYPTION_AXOLOTL:
+ AxolotlService axolotlService = conversation.getAccount().getAxolotlService();
+ if (axolotlService != null && axolotlService.trustedSessionVerified(conversation)) {
+ return context.getString(R.string.send_omemo_x509_message);
+ } else {
+ return context.getString(R.string.send_omemo_message);
+ }
+ case Message.ENCRYPTION_PGP:
+ return context.getString(R.string.send_pgp_message);
+ default:
+ return "";
+ }
+ }
+
public static String getDisplayedMucCounterpart(final Jid counterpart) {
if (counterpart==null) {
return "";