mirror of
https://github.com/ArcaneChat/android.git
synced 2026-07-03 14:05:24 +02:00
Refactor: Use android plural handling
This commit is contained in:
@@ -55,6 +55,8 @@ import java.util.List;
|
||||
|
||||
public class NotificationsController {
|
||||
|
||||
private Context mContext;
|
||||
|
||||
public static final String EXTRA_VOICE_REPLY = "extra_voice_reply";
|
||||
|
||||
private DispatchQueue notificationsQueue = new DispatchQueue("notificationsQueue");
|
||||
@@ -104,6 +106,7 @@ public class NotificationsController {
|
||||
}
|
||||
|
||||
public NotificationsController() {
|
||||
mContext = ApplicationLoader.applicationContext;
|
||||
notificationManager = NotificationManagerCompat.from(ApplicationLoader.applicationContext);
|
||||
SharedPreferences preferences = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Context.MODE_PRIVATE);
|
||||
inChatSoundEnabled = preferences.getBoolean("EnableInChatSound", true);
|
||||
@@ -1117,10 +1120,10 @@ public class NotificationsController {
|
||||
|
||||
String detailText;
|
||||
if (pushDialogs.size() == 1) {
|
||||
detailText = LocaleController.formatPluralString("NewMessages", total_unread_count);
|
||||
detailText = mContext.getResources().getQuantityString(R.plurals.NewMessages, total_unread_count, total_unread_count);
|
||||
} else {
|
||||
detailText = LocaleController.formatString("NotificationMessagesPeopleDisplayOrder", R.string.NotificationMessagesPeopleDisplayOrder,
|
||||
LocaleController.formatPluralString("NewMessages", total_unread_count),
|
||||
mContext.getResources().getQuantityString(R.plurals.NewMessages, total_unread_count, total_unread_count),
|
||||
LocaleController.formatPluralString("FromChats", pushDialogs.size()));
|
||||
}
|
||||
|
||||
|
||||
@@ -3198,7 +3198,7 @@ public class ChatActivity extends BaseFragment implements NotificationCenter.Not
|
||||
else if (view instanceof ChatUnreadCell)
|
||||
{
|
||||
ChatUnreadCell unreadCell = (ChatUnreadCell) view;
|
||||
unreadCell.setText(LocaleController.formatPluralString("NewMessages", markerUnreadCount));
|
||||
unreadCell.setText(mContext.getResources().getQuantityString(R.plurals.NewMessages, markerUnreadCount, markerUnreadCount));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -347,12 +347,10 @@
|
||||
<string name="Members_few">%1$d Mitglieder</string>
|
||||
<string name="Members_many">%1$d Mitglieder</string>
|
||||
<string name="Members_other">%1$d Mitglieder</string>
|
||||
<string name="NewMessages_zero">keine neuen Nachrichten</string>
|
||||
<string name="NewMessages_one">%1$d neue Nachricht</string>
|
||||
<string name="NewMessages_two">%1$d neue Nachrichten</string>
|
||||
<string name="NewMessages_few">%1$d neue Nachrichten</string>
|
||||
<string name="NewMessages_many">%1$d neue Nachrichten</string>
|
||||
<string name="NewMessages_other">%1$d neue Nachrichten</string>
|
||||
<plurals name="NewMessages">
|
||||
<item quantity="one">%d neue Nachricht</item>
|
||||
<item quantity="other">%d neue Nachrichten</item>
|
||||
</plurals>
|
||||
<plurals name="messages">
|
||||
<item quantity="one">%d Nachricht</item>
|
||||
<item quantity="other">%d Nachrichten</item>
|
||||
|
||||
@@ -326,12 +326,10 @@
|
||||
<string name="Members_few">%1$d miembros</string>
|
||||
<string name="Members_many">%1$d miembros</string>
|
||||
<string name="Members_other">%1$d miembros</string>
|
||||
<string name="NewMessages_zero">Sin mensajes nuevos</string>
|
||||
<string name="NewMessages_one">%1$d nuevo mensaje</string>
|
||||
<string name="NewMessages_two">%1$d nuevos mensajes</string>
|
||||
<string name="NewMessages_few">%1$d nuevos mensajes</string>
|
||||
<string name="NewMessages_many">%1$d nuevos mensajes</string>
|
||||
<string name="NewMessages_other">%1$d nuevos mensajes</string>
|
||||
<plurals name="NewMessages">
|
||||
<item quantity="one">%d nuevo mensaje</item>
|
||||
<item quantity="other">%d nuevos mensajes</item>
|
||||
</plurals>
|
||||
<plurals name="messages">
|
||||
<item quantity="one">%d mensaje</item>
|
||||
<item quantity="other">%d mensajes</item>
|
||||
|
||||
@@ -344,12 +344,10 @@
|
||||
<string name="Members_few">%1$d membres</string>
|
||||
<string name="Members_many">%1$d membres</string>
|
||||
<string name="Members_other">%1$d membres</string>
|
||||
<string name="NewMessages_zero">aucun nouveau message</string>
|
||||
<string name="NewMessages_one">%1$d nouveau message</string>
|
||||
<string name="NewMessages_two">%1$d nouveaux messages</string>
|
||||
<string name="NewMessages_few">%1$d nouveaux messages</string>
|
||||
<string name="NewMessages_many">%1$d nouveaux messages</string>
|
||||
<string name="NewMessages_other">%1$d nouveau messages</string>
|
||||
<plurals name="NewMessages">
|
||||
<item quantity="one">%d nouveau message</item>
|
||||
<item quantity="other">%d nouveaux messages</item>
|
||||
</plurals>
|
||||
<plurals name="messages">
|
||||
<item quantity="one">%d message</item>
|
||||
<item quantity="other">%d messages</item>
|
||||
|
||||
@@ -326,12 +326,10 @@
|
||||
<string name="Members_few">%1$d membri</string>
|
||||
<string name="Members_many">%1$d membri</string>
|
||||
<string name="Members_other">%1$d membri</string>
|
||||
<string name="NewMessages_zero">nessun nuovo messaggio</string>
|
||||
<string name="NewMessages_one">%1$d nuovo messaggio</string>
|
||||
<string name="NewMessages_two">%1$d nuovi messaggi</string>
|
||||
<string name="NewMessages_few">%1$d nuovi messaggi</string>
|
||||
<string name="NewMessages_many">%1$d nuovi messaggi</string>
|
||||
<string name="NewMessages_other">%1$d nuovi messaggi</string>
|
||||
<plurals name="NewMessages">
|
||||
<item quantity="one">%d nuovo messaggio</item>
|
||||
<item quantity="other">%d nuovi messaggi</item>
|
||||
</plurals>
|
||||
<plurals name="messages">
|
||||
<item quantity="one">%d messaggio</item>
|
||||
<item quantity="other">%d messaggi</item>
|
||||
|
||||
@@ -326,12 +326,10 @@
|
||||
<string name="Members_few">%1$d leden</string>
|
||||
<string name="Members_many">%1$d leden</string>
|
||||
<string name="Members_other">%1$d leden</string>
|
||||
<string name="NewMessages_zero">geen nieuwe berichten</string>
|
||||
<string name="NewMessages_one">%1$d nieuw bericht</string>
|
||||
<string name="NewMessages_two">%1$d nieuwe berichten</string>
|
||||
<string name="NewMessages_few">%1$d nieuwe berichten</string>
|
||||
<string name="NewMessages_many">%1$d nieuwe berichten</string>
|
||||
<string name="NewMessages_other">%1$d nieuwe berichten</string>
|
||||
<plurals name="NewMessages">
|
||||
<item quantity="one">%d nieuw bericht</item>
|
||||
<item quantity="other">%d nieuwe berichten</item>
|
||||
</plurals>
|
||||
<plurals name="messages">
|
||||
<item quantity="one">%d bericht</item>
|
||||
<item quantity="other">%d berichten</item>
|
||||
|
||||
@@ -326,12 +326,10 @@
|
||||
<string name="Members_few">%1$d membros</string>
|
||||
<string name="Members_many">%1$d membros</string>
|
||||
<string name="Members_other">%1$d membros</string>
|
||||
<string name="NewMessages_zero">sem novas mensagens</string>
|
||||
<string name="NewMessages_one">%1$d nova mensagem</string>
|
||||
<string name="NewMessages_two">%1$d novas mensagens</string>
|
||||
<string name="NewMessages_few">%1$d novas mensagens</string>
|
||||
<string name="NewMessages_many">%1$d novas mensagens</string>
|
||||
<string name="NewMessages_other">%1$d novas mensagens</string>
|
||||
<plurals name="NewMessages">
|
||||
<item quantity="one">%d nova mensagem</item>
|
||||
<item quantity="other">%d novas mensagens</item>
|
||||
</plurals>
|
||||
<plurals name="messages">
|
||||
<item quantity="one">%d mensagem</item>
|
||||
<item quantity="other">%d mensagens</item>
|
||||
|
||||
@@ -346,12 +346,10 @@
|
||||
<string name="Members_few">%1$d members</string>
|
||||
<string name="Members_many">%1$d members</string>
|
||||
<string name="Members_other">%1$d members</string>
|
||||
<string name="NewMessages_zero">no new messages</string>
|
||||
<string name="NewMessages_one">%1$d new message</string>
|
||||
<string name="NewMessages_two">%1$d new messages</string>
|
||||
<string name="NewMessages_few">%1$d new messages</string>
|
||||
<string name="NewMessages_many">%1$d new messages</string>
|
||||
<string name="NewMessages_other">%1$d new messages</string>
|
||||
<plurals name="NewMessages">
|
||||
<item quantity="one">%d new message</item>
|
||||
<item quantity="other">%d new messages</item>
|
||||
</plurals>
|
||||
<plurals name="messages">
|
||||
<item quantity="one">%d message</item>
|
||||
<item quantity="other">%d messages</item>
|
||||
|
||||
Reference in New Issue
Block a user