From 1cec4770203a61547356009e42bf80e65fe17410 Mon Sep 17 00:00:00 2001 From: alansley Date: Thu, 29 Aug 2024 13:33:50 +1000 Subject: [PATCH] Made call to 'getQuantityString' pass the count twice because otherwise it doesn't work correctly --- .../java/org/thoughtcrime/securesms/DeleteMediaDialog.kt | 2 +- .../org/thoughtcrime/securesms/DeleteMediaPreviewDialog.kt | 3 +-- .../securesms/conversation/v2/ConversationActivityV2.kt | 6 +++--- .../conversation/v2/messages/DeletedMessageView.kt | 2 +- 4 files changed, 6 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/DeleteMediaDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/DeleteMediaDialog.kt index a27decddd1..77b77f863e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/DeleteMediaDialog.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/DeleteMediaDialog.kt @@ -8,7 +8,7 @@ class DeleteMediaDialog { @JvmStatic fun show(context: Context, recordCount: Int, doDelete: Runnable) = context.showSessionDialog { iconAttribute(R.attr.dialog_alert_icon) - title(context.resources.getQuantityString(R.plurals.deleteMessage, recordCount)) + title(context.resources.getQuantityString(R.plurals.deleteMessage, recordCount, recordCount)) text(context.resources.getString(R.string.deleteMessageDescriptionEveryone)) button(R.string.delete) { doDelete.run() } cancelButton() diff --git a/app/src/main/java/org/thoughtcrime/securesms/DeleteMediaPreviewDialog.kt b/app/src/main/java/org/thoughtcrime/securesms/DeleteMediaPreviewDialog.kt index 2b981d6bcc..b8aad6c22a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/DeleteMediaPreviewDialog.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/DeleteMediaPreviewDialog.kt @@ -9,8 +9,7 @@ class DeleteMediaPreviewDialog { fun show(context: Context, doDelete: Runnable) { context.showSessionDialog { iconAttribute(R.attr.dialog_alert_icon) - title(context.resources.getQuantityString(R.plurals.deleteMessage, 1)) - + title(context.resources.getQuantityString(R.plurals.deleteMessage, 1, 1)) text(R.string.deleteMessageDescriptionEveryone) dangerButton(R.string.delete) { doDelete.run() } cancelButton() diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt index 7995ed0c47..e451bcf2ab 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationActivityV2.kt @@ -2066,7 +2066,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe private fun showDeleteLocallyUI(messages: Set) { showSessionDialog { - title(resources.getQuantityString(R.plurals.deleteMessage, messages.count())) + title(resources.getQuantityString(R.plurals.deleteMessage, messages.count(), messages.count())) text(resources.getString(R.string.deleteMessagesDescriptionDevice)) button(R.string.delete) { messages.forEach(viewModel::deleteLocally); endActionMode() } cancelButton(::endActionMode) @@ -2088,7 +2088,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe // If the recipient is a community OR a Note-to-Self then we delete the message for everyone if (recipient.isCommunityRecipient || recipient.isLocalNumber) { showSessionDialog { - title(resources.getQuantityString(R.plurals.deleteMessage, messages.count())) + title(resources.getQuantityString(R.plurals.deleteMessage, messages.count(), messages.count())) text(resources.getString(R.string.deleteMessageDescriptionEveryone)) button(R.string.delete) { messages.forEach(viewModel::deleteForEveryone); endActionMode() } cancelButton { endActionMode() } @@ -2116,7 +2116,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe else // Finally, if this is a closed group and you are deleting someone else's message(s) then we can only delete locally. { showSessionDialog { - title(resources.getQuantityString(R.plurals.deleteMessage, messages.count())) + title(resources.getQuantityString(R.plurals.deleteMessage, messages.count(), messages.count())) text(resources.getString(R.string.deleteMessageDescriptionDevice)) dangerButton(R.string.delete) { messages.forEach(viewModel::deleteLocally); endActionMode() } cancelButton(::endActionMode) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/DeletedMessageView.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/DeletedMessageView.kt index 645a5e2f3b..5b64df059e 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/DeletedMessageView.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/messages/DeletedMessageView.kt @@ -21,7 +21,7 @@ class DeletedMessageView : LinearLayout { // region Updating fun bind(message: MessageRecord, @ColorInt textColor: Int) { assert(message.isDeleted) - binding.deleteTitleTextView.text = context.resources.getQuantityString(R.plurals.deleteMessageDeleted, 1) + binding.deleteTitleTextView.text = context.resources.getQuantityString(R.plurals.deleteMessageDeleted, 1, 1) binding.deleteTitleTextView.setTextColor(textColor) binding.deletedMessageViewIconImageView.imageTintList = ColorStateList.valueOf(textColor) }