From fd570310e0d59b023f3dbf8acf1ad5ba2a829099 Mon Sep 17 00:00:00 2001 From: Christian Ascheberg Date: Wed, 16 Dec 2015 15:36:14 +0100 Subject: [PATCH] fix more plurals Closes #4898 // FREEBIE --- res/values/strings.xml | 12 ++++++++---- .../securesms/ConversationListFragment.java | 13 ++++++++----- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/res/values/strings.xml b/res/values/strings.xml index 6bcbcb6b2f..382ab6dc05 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -185,11 +185,15 @@ Deleting Deleting selected conversations... - Conversations archived + + Conversation archived + %d conversations archived + UNDO - Moved conversation to inbox - Conversation archived - Moved conversations to inbox + + Moved conversation to inbox + Moved %d conversations to inbox + Key exchange message... diff --git a/src/org/thoughtcrime/securesms/ConversationListFragment.java b/src/org/thoughtcrime/securesms/ConversationListFragment.java index 1d08005bb3..187c031b57 100644 --- a/src/org/thoughtcrime/securesms/ConversationListFragment.java +++ b/src/org/thoughtcrime/securesms/ConversationListFragment.java @@ -201,10 +201,13 @@ public class ConversationListFragment extends Fragment final Set selectedConversations = new HashSet<>(getListAdapter().getBatchSelections()); final boolean archive = this.archive; - String snackBarTitle; + int snackBarTitleId; - if (archive) snackBarTitle = getString(R.string.ConversationListFragment_moved_conversations_to_inbox); - else snackBarTitle = getString(R.string.ConversationListFragment_conversations_archived); + if (archive) snackBarTitleId = R.plurals.ConversationListFragment_moved_conversations_to_inbox; + else snackBarTitleId = R.plurals.ConversationListFragment_conversations_archived; + + int count = selectedConversations.size(); + String snackBarTitle = getResources().getQuantityString(snackBarTitleId, count, count); new SnackbarAsyncTask(getView(), snackBarTitle, getString(R.string.ConversationListFragment_undo), @@ -438,7 +441,7 @@ public class ConversationListFragment extends Fragment if (archive) { new SnackbarAsyncTask(getView(), - getString(R.string.ConversationListFragment_moved_conversation_to_inbox), + getResources().getQuantityString(R.plurals.ConversationListFragment_moved_conversations_to_inbox, 1, 1), getString(R.string.ConversationListFragment_undo), getResources().getColor(R.color.amber_500), Snackbar.LENGTH_LONG, false) @@ -455,7 +458,7 @@ public class ConversationListFragment extends Fragment }.execute(threadId); } else { new SnackbarAsyncTask(getView(), - getString(R.string.ConversationListFragment_conversation_archived), + getResources().getQuantityString(R.plurals.ConversationListFragment_conversations_archived, 1, 1), getString(R.string.ConversationListFragment_undo), getResources().getColor(R.color.amber_500), Snackbar.LENGTH_LONG, false)