From 78a9ab7159218005f5bca91b35583e4daa608e2d Mon Sep 17 00:00:00 2001 From: ThomasSession Date: Thu, 29 Aug 2024 14:03:41 +1000 Subject: [PATCH] Making sure we bold appropriately --- .../conversation/v2/ConversationAdapter.kt | 3 ++- .../preferences/BlockedContactsViewModel.kt | 8 ++++---- .../securesms/util/CallNotificationBuilder.kt | 13 +++++++------ 3 files changed, 13 insertions(+), 11 deletions(-) diff --git a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapter.kt b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapter.kt index dc22446958..d75d14ea4a 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapter.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/conversation/v2/ConversationAdapter.kt @@ -32,6 +32,7 @@ import org.thoughtcrime.securesms.dependencies.DatabaseComponent import com.bumptech.glide.RequestManager import org.thoughtcrime.securesms.preferences.PrivacySettingsActivity import org.thoughtcrime.securesms.showSessionDialog +import org.thoughtcrime.securesms.ui.getSubbedCharSequence import org.thoughtcrime.securesms.ui.getSubbedString class ConversationAdapter( @@ -159,7 +160,7 @@ class ConversationAdapter( val titleTxt = context.getSubbedString(R.string.callsMissedCallFrom, NAME_KEY to message.individualRecipient.name!!) title(titleTxt) - val bodyTxt = context.getSubbedString(R.string.callsYouMissedCallPermissions, NAME_KEY to message.individualRecipient.name!!) + val bodyTxt = context.getSubbedCharSequence(R.string.callsYouMissedCallPermissions, NAME_KEY to message.individualRecipient.name!!) text(bodyTxt) button(R.string.sessionSettings) { diff --git a/app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsViewModel.kt b/app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsViewModel.kt index 80f0e08293..ae9dfe4760 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsViewModel.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/preferences/BlockedContactsViewModel.kt @@ -78,21 +78,21 @@ class BlockedContactsViewModel @Inject constructor(private val storage: Storage) fun getTitle(context: Context): String = context.getString(R.string.blockUnblock) // Method to get the appropriate text to display when unblocking 1, 2, or several contacts - fun getText(context: Context, contactsToUnblock: Set): String { + fun getText(context: Context, contactsToUnblock: Set): CharSequence { return when (contactsToUnblock.size) { // Note: We do not have to handle 0 because if no contacts are chosen then the unblock button is deactivated 1 -> Phrase.from(context, R.string.blockUnblockName) .put(NAME_KEY, contactsToUnblock.elementAt(0).name) - .format().toString() + .format() 2 -> Phrase.from(context, R.string.blockUnblockNameTwo) .put(NAME_KEY, contactsToUnblock.elementAt(0).name) - .format().toString() + .format() else -> { val othersCount = contactsToUnblock.size - 1 Phrase.from(context, R.string.blockUnblockNameMultiple) .put(NAME_KEY, contactsToUnblock.elementAt(0).name) .put(COUNT_KEY, othersCount) - .format().toString() + .format() } } } diff --git a/app/src/main/java/org/thoughtcrime/securesms/util/CallNotificationBuilder.kt b/app/src/main/java/org/thoughtcrime/securesms/util/CallNotificationBuilder.kt index 379116c287..4ffe12d006 100644 --- a/app/src/main/java/org/thoughtcrime/securesms/util/CallNotificationBuilder.kt +++ b/app/src/main/java/org/thoughtcrime/securesms/util/CallNotificationBuilder.kt @@ -17,6 +17,8 @@ import org.thoughtcrime.securesms.calls.WebRtcCallActivity import org.thoughtcrime.securesms.notifications.NotificationChannels import org.thoughtcrime.securesms.preferences.SettingsActivity import org.thoughtcrime.securesms.service.WebRtcCallService +import org.thoughtcrime.securesms.ui.getSubbedCharSequence +import org.thoughtcrime.securesms.ui.getSubbedString class CallNotificationBuilder { @@ -41,12 +43,11 @@ class CallNotificationBuilder { val pendingIntent = PendingIntent.getActivity(context, 0, contentIntent, PendingIntent.FLAG_UPDATE_CURRENT or PendingIntent.FLAG_IMMUTABLE) - val titleTxt = Phrase.from(context, R.string.callsMissedCallFrom) - .put(NAME_KEY, callerName) - .format().toString() - val bodyTxt = Phrase.from(context, R.string.callsYouMissedCallPermissions) - .put(NAME_KEY, callerName) - .format().toString() + val titleTxt = context.getSubbedString(R.string.callsMissedCallFrom, NAME_KEY to callerName) + val bodyTxt = context.getSubbedCharSequence( + R.string.callsYouMissedCallPermissions, + NAME_KEY to callerName + ) val builder = NotificationCompat.Builder(context, NotificationChannels.CALLS) .setSound(null)