Made call to 'getQuantityString' pass the count twice because otherwise it doesn't work correctly

This commit is contained in:
alansley 2024-08-29 13:33:50 +10:00
parent 8e80ab08a9
commit 1cec477020
4 changed files with 6 additions and 7 deletions

View File

@ -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()

View File

@ -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()

View File

@ -2066,7 +2066,7 @@ class ConversationActivityV2 : PassphraseRequiredActionBarActivity(), InputBarDe
private fun showDeleteLocallyUI(messages: Set<MessageRecord>) {
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)

View File

@ -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)
}