mirror of
https://github.com/oxen-io/session-android.git
synced 2024-11-21 15:05:19 +00:00
WIP
This commit is contained in:
parent
114066ad5f
commit
ce8efd7def
@ -108,10 +108,10 @@ class ConversationActionBarView @JvmOverloads constructor(
|
|||||||
val durationAbbreviated = ExpirationUtil.getExpirationAbbreviatedDisplayValue(config.expiryMode.expirySeconds)
|
val durationAbbreviated = ExpirationUtil.getExpirationAbbreviatedDisplayValue(config.expiryMode.expirySeconds)
|
||||||
|
|
||||||
// ..then substitute into the string..
|
// ..then substitute into the string..
|
||||||
val subtitleTxt = context.getSubbedString(R.string.disappearingMessagesDisappear,
|
val subtitleTxt = context.getString(R.string.disappearingMessagesDisappear,
|
||||||
DISAPPEARING_MESSAGES_TYPE_KEY to dmTypeString,
|
DISAPPEARING_MESSAGES_TYPE_KEY to dmTypeString,
|
||||||
TIME_KEY to durationAbbreviated
|
TIME_KEY to durationAbbreviated
|
||||||
).toString()
|
)
|
||||||
|
|
||||||
// .. and apply to the subtitle.
|
// .. and apply to the subtitle.
|
||||||
settings += ConversationSetting(
|
settings += ConversationSetting(
|
||||||
@ -128,7 +128,7 @@ class ConversationActionBarView @JvmOverloads constructor(
|
|||||||
?.let {
|
?.let {
|
||||||
val mutedDuration = (it - System.currentTimeMillis()).milliseconds
|
val mutedDuration = (it - System.currentTimeMillis()).milliseconds
|
||||||
val durationString = LocalisedTimeUtil.getDurationWithSingleLargestTimeUnit(context, mutedDuration)
|
val durationString = LocalisedTimeUtil.getDurationWithSingleLargestTimeUnit(context, mutedDuration)
|
||||||
context.getSubbedString(R.string.notificationsMuteFor, TIME_LARGE_KEY to durationString).toString()
|
context.getSubbedString(R.string.notificationsMuteFor, TIME_LARGE_KEY to durationString)
|
||||||
}
|
}
|
||||||
?: context.getString(R.string.notificationsMuted),
|
?: context.getString(R.string.notificationsMuted),
|
||||||
ConversationSettingType.NOTIFICATION,
|
ConversationSettingType.NOTIFICATION,
|
||||||
|
@ -19,14 +19,16 @@ fun Context.createThemedComposeView(content: @Composable () -> Unit): ComposeVie
|
|||||||
setThemedContent(content)
|
setThemedContent(content)
|
||||||
}
|
}
|
||||||
|
|
||||||
fun Context.getSubbedString(stringId: Int, vararg substitutionPairs: Pair<String, String>): CharSequence {
|
fun Context.getSubbedCharSequence(stringId: Int, vararg substitutionPairs: Pair<String, String>): CharSequence {
|
||||||
val phrase = Phrase.from(this, stringId)
|
val phrase = Phrase.from(this, stringId)
|
||||||
for ((key, value) in substitutionPairs) {
|
for ((key, value) in substitutionPairs) { phrase.put(key, value) }
|
||||||
phrase.put(key, value)
|
|
||||||
}
|
|
||||||
return phrase.format()
|
return phrase.format()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fun Context.getSubbedString(stringId: Int, vararg substitutionPairs: Pair<String, String>): String {
|
||||||
|
return getSubbedCharSequence(stringId, *substitutionPairs).toString()
|
||||||
|
}
|
||||||
|
|
||||||
fun ComposeView.setThemedContent(content: @Composable () -> Unit) = setContent {
|
fun ComposeView.setThemedContent(content: @Composable () -> Unit) = setContent {
|
||||||
SessionMaterialTheme {
|
SessionMaterialTheme {
|
||||||
content()
|
content()
|
||||||
|
Loading…
Reference in New Issue
Block a user