diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/privacy/PrivacySettingsFragment.kt b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/privacy/PrivacySettingsFragment.kt index 51cb639ade..3aba9d95c4 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/privacy/PrivacySettingsFragment.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/components/settings/app/privacy/PrivacySettingsFragment.kt @@ -131,7 +131,7 @@ class PrivacySettingsFragment : DSLSettingsFragment(R.string.preferences__privac clickPref( title = DSLSettingsText.from(R.string.PrivacySettingsFragment__blocked), - summary = DSLSettingsText.from(getString(R.string.PrivacySettingsFragment__d_contacts, state.blockedCount)), + summary = DSLSettingsText.from(resources.getQuantityString(R.plurals.PrivacySettingsFragment__d_contacts, state.blockedCount, state.blockedCount)), onClick = { Navigation.findNavController(requireView()) .safeNavigate(R.id.action_privacySettingsFragment_to_blockedUsersActivity) diff --git a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsListUpdatePopupWindow.java b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsListUpdatePopupWindow.java index 7dfd77463a..fdc387cc3d 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsListUpdatePopupWindow.java +++ b/app/src/main/java/org/thoughtcrime/securesms/components/webrtc/CallParticipantsListUpdatePopupWindow.java @@ -11,6 +11,7 @@ import android.widget.TextView; import androidx.annotation.NonNull; import androidx.annotation.Nullable; +import androidx.annotation.PluralsRes; import androidx.annotation.StringRes; import org.thoughtcrime.securesms.R; @@ -141,7 +142,7 @@ public class CallParticipantsListUpdatePopupWindow extends PopupWindow { description = context.getString(getThreeMemberDescriptionResourceId(isAdded), getNextDisplayName(iterator), getNextDisplayName(iterator), getNextDisplayName(iterator)); break; default: - description = context.getString(getManyMemberDescriptionResourceId(isAdded), getNextDisplayName(iterator), getNextDisplayName(iterator), recipients.size() - 2); + description = context.getResources().getQuantityString(getManyMemberDescriptionResourceId(isAdded), recipients.size() - 2, getNextDisplayName(iterator), getNextDisplayName(iterator), recipients.size() - 2); } descriptionTextView.setText(description); @@ -181,11 +182,11 @@ public class CallParticipantsListUpdatePopupWindow extends PopupWindow { } } - private static @StringRes int getManyMemberDescriptionResourceId(boolean isAdded) { + private static @PluralsRes int getManyMemberDescriptionResourceId(boolean isAdded) { if (isAdded) { - return R.string.CallParticipantsListUpdatePopupWindow__s_s_and_d_others_joined; + return R.plurals.CallParticipantsListUpdatePopupWindow__s_s_and_d_others_joined; } else { - return R.string.CallParticipantsListUpdatePopupWindow__s_s_and_d_others_left; + return R.plurals.CallParticipantsListUpdatePopupWindow__s_s_and_d_others_left; } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/profiles/spoofing/ReviewCardDialogFragment.java b/app/src/main/java/org/thoughtcrime/securesms/profiles/spoofing/ReviewCardDialogFragment.java index 76bc9be24d..a73865bbf1 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/profiles/spoofing/ReviewCardDialogFragment.java +++ b/app/src/main/java/org/thoughtcrime/securesms/profiles/spoofing/ReviewCardDialogFragment.java @@ -38,7 +38,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment { public static ReviewCardDialogFragment createForReviewRequest(@NonNull RecipientId recipientId) { return create(R.string.ReviewCardDialogFragment__review_request, - R.string.ReviewCardDialogFragment__if_youre_not_sure, + R.plurals.ReviewCardDialogFragment__if_youre_not_sure, R.string.ReviewCardDialogFragment__no_groups_in_common, R.plurals.ReviewCardDialogFragment__d_groups_in_common, recipientId, @@ -47,7 +47,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment { public static ReviewCardDialogFragment createForReviewMembers(@NonNull GroupId.V2 groupId) { return create(R.string.ReviewCardDialogFragment__review_members, - R.string.ReviewCardDialogFragment__d_group_members_have_the_same_name, + R.plurals.ReviewCardDialogFragment__d_group_members_have_the_same_name, R.string.ReviewCardDialogFragment__no_other_groups_in_common, R.plurals.ReviewCardDialogFragment__d_other_groups_in_common, null, @@ -55,7 +55,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment { } private static ReviewCardDialogFragment create(@StringRes int titleResId, - @StringRes int descriptionResId, + @PluralsRes int descriptionResId, @StringRes int noGroupsInCommonResId, @PluralsRes int groupsInCommonResId, @Nullable RecipientId recipientId, @@ -92,7 +92,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment { viewModel.getReviewCards().observe(getViewLifecycleOwner(), cards -> { adapter.submitList(cards); - description.setText(getString(getDescriptionResId(), cards.size())); + description.setText(getResources().getQuantityString(getDescriptionResId(), cards.size(), cards.size())); }); viewModel.getReviewEvents().observe(getViewLifecycleOwner(), this::onReviewEvent); @@ -105,7 +105,7 @@ public class ReviewCardDialogFragment extends FullScreenDialogFragment { viewModel = new ViewModelProvider(this, factory).get(ReviewCardViewModel.class); } - private @StringRes int getDescriptionResId() { + private @PluralsRes int getDescriptionResId() { return requireArguments().getInt(EXTRA_DESCRIPTION_RES_ID); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 77299d3f76..84512896ab 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -4227,8 +4227,16 @@ Review members Review request - %1$d group members have the same name, review the members below and choose to take action. - If you\'re not sure who the request is from, review the contacts below and take action. + + + %1$d group member have the same name, review the member below and choose to take action. + %1$d group members have the same name, review the members below and choose to take action. + + + + If you\'re not sure who the request is from, review the contact below and take action. + If you\'re not sure who the request is from, review the contacts below and take action. + No other groups in common. No groups in common. @@ -4259,12 +4267,20 @@ %1$s joined %1$s and %2$s joined %1$s, %2$s and %3$s joined - %1$s, %2$s and %3$d others joined + + + %1$s, %2$s and %3$d other joined + %1$s, %2$s and %3$d others joined + %1$s left %1$s and %2$s left %1$s, %2$s and %3$s left - %1$s, %2$s and %3$d others left + + + %1$s, %2$s and %3$d other left + %1$s, %2$s and %3$d others left + You You (on another device) @@ -4634,7 +4650,11 @@ Blocked - %1$d contacts + + + %1$d contact + %1$d contacts + Messaging Disappearing messages App security