Show message/post count in notifications. Dev task #77.

This commit is contained in:
akwizgran
2014-03-07 13:06:31 +00:00
parent a5b09a0f65
commit abaf1d7e96
3 changed files with 17 additions and 9 deletions

View File

@@ -76,8 +76,14 @@
<string name="add_button">Add</string>
<string name="cancel_button">Cancel</string>
<string name="post_sent_toast">Post sent</string>
<string name="private_message_notification_text">New private message.</string>
<string name="group_post_notification_text">New forum post.</string>
<plurals name="private_message_notification_text">
<item quantity="one">New private message.</item>
<item quantity="other">%d new private messages.</item>
</plurals>
<plurals name="group_post_notification_text">
<item quantity="one">New forum post.</item>
<item quantity="other">%d new forum posts.</item>
</plurals>
<string name="settings_title">Settings</string>
<string name="activate_bluetooth_option">Activate Bluetooth while signed in</string>
<string name="activate_bluetooth_explanation">Briar uses Bluetooth to communicate with nearby contacts</string>

View File

@@ -68,8 +68,9 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager {
new NotificationCompat.Builder(appContext);
b.setSmallIcon(R.drawable.message_notification_icon);
b.setContentTitle(appContext.getText(R.string.app_name));
b.setContentText(appContext.getText(
R.string.private_message_notification_text));
b.setContentText(appContext.getResources().getQuantityString(
R.plurals.private_message_notification_text, privateTotal,
privateTotal));
b.setDefaults(DEFAULT_ALL);
b.setOnlyAlertOnce(true);
if(contactCounts.size() == 1) {
@@ -126,8 +127,9 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager {
new NotificationCompat.Builder(appContext);
b.setSmallIcon(R.drawable.message_notification_icon);
b.setContentTitle(appContext.getText(R.string.app_name));
b.setContentText(appContext.getText(
R.string.group_post_notification_text));
b.setContentText(appContext.getResources().getQuantityString(
R.plurals.group_post_notification_text, groupTotal,
groupTotal));
b.setDefaults(DEFAULT_ALL);
b.setOnlyAlertOnce(true);
if(groupCounts.size() == 1) {

View File

@@ -223,9 +223,9 @@ implements EventListener, OnClickListener, OnItemClickListener {
available.setVisibility(GONE);
} else {
available.setVisibility(VISIBLE);
String format = getResources().getQuantityString(
R.plurals.forums_available, availableCount);
available.setText(String.format(format, availableCount));
available.setText(getResources().getQuantityString(
R.plurals.forums_available, availableCount,
availableCount));
}
}
});