diff options
-rw-r--r-- | src/main/java/de/pixart/messenger/services/NotificationService.java | 30 | ||||
-rw-r--r-- | src/main/res/values-ar/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-az/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-bg/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-ca/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-de/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-es/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-fr/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-it/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-nl/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-pl/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-ru/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values-zh/strings.xml | 1 | ||||
-rw-r--r-- | src/main/res/values/strings.xml | 2 |
14 files changed, 16 insertions, 28 deletions
diff --git a/src/main/java/de/pixart/messenger/services/NotificationService.java b/src/main/java/de/pixart/messenger/services/NotificationService.java index 4d8c39d22..cc79f7b6a 100644 --- a/src/main/java/de/pixart/messenger/services/NotificationService.java +++ b/src/main/java/de/pixart/messenger/services/NotificationService.java @@ -15,14 +15,12 @@ import android.media.AudioAttributes; import android.media.RingtoneManager; import android.net.Uri; import android.os.Build; -import android.os.DeadSystemException; import android.os.SystemClock; import android.preference.PreferenceManager; import android.support.annotation.RequiresApi; import android.support.v4.app.NotificationCompat; import android.support.v4.app.NotificationCompat.BigPictureStyle; import android.support.v4.app.NotificationCompat.Builder; -import android.support.v4.app.NotificationCompat.CarExtender.UnreadConversation; import android.support.v4.app.NotificationManagerCompat; import android.support.v4.app.Person; import android.support.v4.app.RemoteInput; @@ -32,7 +30,6 @@ import android.text.SpannableString; import android.text.style.StyleSpan; import android.util.DisplayMetrics; import android.util.Log; -import android.util.Pair; import java.io.File; import java.io.IOException; @@ -320,7 +317,7 @@ public class NotificationService { if (!notify(message)) { if (this.mIsInForeground && isScreenOn && this.mOpenConversation == message.getConversation()) { mXmppConnectionService.vibrate(); - } + } Log.d(Config.LOGTAG, message.getConversation().getAccount().getJid().asBareJid() + ": suppressing notification because turned off"); return; } @@ -482,10 +479,7 @@ public class NotificationService { private Builder buildMultipleConversation(final boolean notify, final boolean quietHours) { final Builder mBuilder = new NotificationCompat.Builder(mXmppConnectionService, quietHours ? "quiet_hours" : (notify ? "messages" : "silent_messages")); final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); - style.setBigContentTitle(notifications.size() - + " " - + mXmppConnectionService - .getString(R.string.unread_conversations)); + style.setBigContentTitle(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); final StringBuilder names = new StringBuilder(); Conversation conversation = null; for (final ArrayList<Message> messages : notifications.values()) { @@ -510,10 +504,8 @@ public class NotificationService { if (names.length() >= 2) { names.delete(names.length() - 2, names.length()); } - mBuilder.setContentTitle(notifications.size() - + " " - + mXmppConnectionService - .getString(R.string.unread_conversations)); + mBuilder.setContentTitle(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); + mBuilder.setTicker(mXmppConnectionService.getString(R.string.x_unread_conversations, notifications.size())); mBuilder.setContentText(names.toString()); mBuilder.setStyle(style); if (conversation != null) { @@ -638,8 +630,11 @@ public class NotificationService { CharSequence text = getMergedBodies(tmp); bigPictureStyle.setSummaryText(text); builder.setContentText(text); + builder.setTicker(text); } else { - builder.setContentText(UIHelper.getFileDescriptionString(mXmppConnectionService, message)); + final String description = UIHelper.getFileDescriptionString(mXmppConnectionService, message); + builder.setContentText(description); + builder.setTicker(description); } builder.setStyle(bigPictureStyle); } catch (final IOException e) { @@ -696,7 +691,9 @@ public class NotificationService { } else { if (messages.get(0).getConversation().getMode() == Conversation.MODE_SINGLE) { builder.setStyle(new NotificationCompat.BigTextStyle().bigText(getMergedBodies(messages))); - builder.setContentText(UIHelper.getMessagePreview(mXmppConnectionService, messages.get(messages.size() - 1)).first); + final CharSequence preview = UIHelper.getMessagePreview(mXmppConnectionService, messages.get(messages.size() - 1)).first; + builder.setContentText(preview); + builder.setTicker(preview); builder.setNumber(messages.size()); } else { final NotificationCompat.InboxStyle style = new NotificationCompat.InboxStyle(); @@ -714,8 +711,11 @@ public class NotificationService { styledString = new SpannableString(name + ": " + messages.get(0).getBody()); styledString.setSpan(new StyleSpan(Typeface.BOLD), 0, name.length(), 0); builder.setContentText(styledString); + builder.setTicker(styledString); } else { - builder.setContentText(mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages, count, count)); + final String text = mXmppConnectionService.getResources().getQuantityString(R.plurals.x_messages, count, count); + builder.setContentText(text); + builder.setTicker(text); } } } diff --git a/src/main/res/values-ar/strings.xml b/src/main/res/values-ar/strings.xml index 71cfc7f31..51ff53197 100644 --- a/src/main/res/values-ar/strings.xml +++ b/src/main/res/values-ar/strings.xml @@ -26,7 +26,6 @@ <string name="just_now">الآن</string> <string name="minute_ago">منذ دقيقة</string> <string name="minutes_ago">منذ %d دقيقة</string> - <string name="unread_conversations">محادثات غير مقروءة</string> <string name="sending">الإرسال جارٍ…</string> <string name="message_decrypting">جارٍ فك تشفير الرسالة. الرجاء الإنتظار…</string> <string name="pgp_message">OpenPGP رسالة مشفرة</string> diff --git a/src/main/res/values-az/strings.xml b/src/main/res/values-az/strings.xml index f0ddb2b0d..c5f164a35 100644 --- a/src/main/res/values-az/strings.xml +++ b/src/main/res/values-az/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">elə indicə</string> <string name="minute_ago">1 dəq əvvəl</string> <string name="minutes_ago">%d dəq əvvəl</string> - <string name="unread_conversations">oxunmamış danışıq</string> <string name="sending">göndərilir…</string> <string name="message_decrypting">Mesaj şifrəsi açılır. Zəhmət olmasa gözləyin…</string> <string name="pgp_message">OpenPGP şifrələnmiş mesaj</string> diff --git a/src/main/res/values-bg/strings.xml b/src/main/res/values-bg/strings.xml index 71754f14c..3cd03a3c5 100644 --- a/src/main/res/values-bg/strings.xml +++ b/src/main/res/values-bg/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">току що</string> <string name="minute_ago">преди 1 минута</string> <string name="minutes_ago">преди %ld минути</string> - <string name="unread_conversations">непрочетени разговори</string> <string name="sending">изпращане…</string> <string name="message_decrypting">Разсифрова писмото. Чакаи...</string> <string name="pgp_message">Криптирано писмо със OpenPGP</string> diff --git a/src/main/res/values-ca/strings.xml b/src/main/res/values-ca/strings.xml index 54c637711..bf9d277a4 100644 --- a/src/main/res/values-ca/strings.xml +++ b/src/main/res/values-ca/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">ara mateix</string> <string name="minute_ago"> fa 1 minut</string> <string name="minutes_ago">fa %d minuts</string> - <string name="unread_conversations">converses no llegides</string> <string name="sending">enviant…</string> <string name="message_decrypting">Desxifrant missatge. Si us plau, espera...</string> <string name="pgp_message">Missatge xifrat amb OpenPGP</string> diff --git a/src/main/res/values-de/strings.xml b/src/main/res/values-de/strings.xml index 28f686eb2..59991ba9b 100644 --- a/src/main/res/values-de/strings.xml +++ b/src/main/res/values-de/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">gerade</string> <string name="minute_ago">vor einer Minute</string> <string name="minutes_ago">vor %d Minuten</string> - <string name="unread_conversations">ungelesene Unterhaltungen</string> <string name="sending">wird gesendet…</string> <string name="message_decrypting">Nachricht wird entschlüsselt. Bitte warten …</string> <string name="pgp_message">OpenPGP-verschlüsselte Nachricht</string> diff --git a/src/main/res/values-es/strings.xml b/src/main/res/values-es/strings.xml index d07072f8e..d914fee52 100644 --- a/src/main/res/values-es/strings.xml +++ b/src/main/res/values-es/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">ahora mismo</string> <string name="minute_ago">hace 1 min</string> <string name="minutes_ago">hace %d min</string> - <string name="unread_conversations">conversaciones no leídas</string> <string name="sending">enviando…</string> <string name="message_decrypting">Descifrando mensaje. Por favor, espera...</string> <string name="pgp_message">Mensaje cifrado con OpenPGP</string> diff --git a/src/main/res/values-fr/strings.xml b/src/main/res/values-fr/strings.xml index 7b70a4804..0b5f5638b 100644 --- a/src/main/res/values-fr/strings.xml +++ b/src/main/res/values-fr/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">à l’instant</string> <string name="minute_ago">Il y a 1 minute</string> <string name="minutes_ago">Il y a %d minutes</string> - <string name="unread_conversations">conversations non lues</string> <string name="sending">Envoi…</string> <string name="message_decrypting">Déchiffrement du message. Veuillez patienter...</string> <string name="pgp_message">Message chiffré avec OpenPGP</string> diff --git a/src/main/res/values-it/strings.xml b/src/main/res/values-it/strings.xml index c30e14fba..b59114e08 100644 --- a/src/main/res/values-it/strings.xml +++ b/src/main/res/values-it/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">adesso</string> <string name="minute_ago">1 min fa</string> <string name="minutes_ago">%d min fa</string> - <string name="unread_conversations">conversazioni non lette</string> <string name="sending">invio…</string> <string name="message_decrypting">Decifrazione messaggio. Attendere prego...</string> <string name="pgp_message">Messaggio cifrato con OpenPGP</string> diff --git a/src/main/res/values-nl/strings.xml b/src/main/res/values-nl/strings.xml index 02a16f1f2..ddd82cdf3 100644 --- a/src/main/res/values-nl/strings.xml +++ b/src/main/res/values-nl/strings.xml @@ -26,7 +26,6 @@ <string name="just_now">zojuist</string> <string name="minute_ago">1 min. geleden</string> <string name="minutes_ago">%d min. geleden</string> - <string name="unread_conversations">ongelezen gesprekken</string> <string name="sending">versturen…</string> <string name="message_decrypting">Bericht aan het ontsleutelen. Even geduld…</string> <string name="pgp_message">OpenPGP-versleuteld bericht</string> diff --git a/src/main/res/values-pl/strings.xml b/src/main/res/values-pl/strings.xml index 408369f89..ad8b43714 100644 --- a/src/main/res/values-pl/strings.xml +++ b/src/main/res/values-pl/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">przed chwilą</string> <string name="minute_ago">minutę temu</string> <string name="minutes_ago">%d minut temu</string> - <string name="unread_conversations">nieprzeczytane konwersacje</string> <string name="sending">wysyłanie...</string> <string name="message_decrypting">Odszyfrowywanie wiadomości. To zajmie tylko chwilę...</string> <string name="pgp_message">Wiadomość zaszyfrowana OpenPGP</string> diff --git a/src/main/res/values-ru/strings.xml b/src/main/res/values-ru/strings.xml index 887dd7436..136a398ec 100644 --- a/src/main/res/values-ru/strings.xml +++ b/src/main/res/values-ru/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">только что</string> <string name="minute_ago">1 мин. назад</string> <string name="minutes_ago">%d мин. назад</string> - <string name="unread_conversations">непрочитанные диалоги</string> <string name="sending">отправка…</string> <string name="message_decrypting">Расшифровка сообщения. Пожалуйста подождите…</string> <string name="pgp_message">Зашифрованное OpenPGP сообщение</string> diff --git a/src/main/res/values-zh/strings.xml b/src/main/res/values-zh/strings.xml index 8b1260fec..6ceb080ec 100644 --- a/src/main/res/values-zh/strings.xml +++ b/src/main/res/values-zh/strings.xml @@ -27,7 +27,6 @@ <string name="just_now">刚刚</string> <string name="minute_ago">1 分钟前</string> <string name="minutes_ago">%d 分钟前</string> - <string name="unread_conversations">未读会话</string> <string name="sending">正在发送……</string> <string name="message_decrypting">解密消息中,请稍等……</string> <string name="pgp_message">OpenPGP 加密信息</string> diff --git a/src/main/res/values/strings.xml b/src/main/res/values/strings.xml index a4892dece..b6218464d 100644 --- a/src/main/res/values/strings.xml +++ b/src/main/res/values/strings.xml @@ -26,7 +26,7 @@ <string name="just_now">just now</string> <string name="minute_ago">1 min ago</string> <string name="minutes_ago">%d mins ago</string> - <string name="unread_conversations">unread conversations</string> + <string name="x_unread_conversations">%d unread conversations</string> <string name="sending">sending…</string> <string name="message_decrypting">Decrypting message. Please wait…</string> <string name="pgp_message">OpenPGP encrypted message</string> |