diff options
author | Daniel Gultsch <daniel@gultsch.de> | 2016-08-25 17:30:44 +0200 |
---|---|---|
committer | Christian Schneppe <christian@pix-art.de> | 2016-08-26 20:16:45 +0200 |
commit | 656eca50676e82daf6395b3341c028d7525badc5 (patch) | |
tree | 8e352631c3fa3a6c7fccf90f7517db4865b7a2bd /src/main/java/de/pixart/messenger/utils | |
parent | 6fb2f4f2162a2ffaf83c832fc35070cf103c3d92 (diff) |
offer quick reply on android N
Diffstat (limited to 'src/main/java/de/pixart/messenger/utils')
-rw-r--r-- | src/main/java/de/pixart/messenger/utils/UIHelper.java | 30 |
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 ""; |