Just some formatting

This commit is contained in:
Benoit Marty 2021-02-09 21:21:40 +01:00
parent 370b9dabff
commit 4e32120a41
4 changed files with 16 additions and 14 deletions

View File

@ -57,9 +57,9 @@ class CallItemFactory @Inject constructor(
val callId = callSignalingContent.callId ?: return null
val call = callManager.getCallById(callId)
val callKind = when {
call == null -> CallTileTimelineItem.CallKind.UNKNOWN
call == null -> CallTileTimelineItem.CallKind.UNKNOWN
call.mxCall.isVideoCall -> CallTileTimelineItem.CallKind.VIDEO
else -> CallTileTimelineItem.CallKind.AUDIO
else -> CallTileTimelineItem.CallKind.AUDIO
}
return when (event.root.getClearType()) {
EventType.CALL_ANSWER -> {

View File

@ -91,7 +91,7 @@ class NoticeEventFormatter @Inject constructor(
EventType.CALL_INVITE,
EventType.CALL_CANDIDATES,
EventType.CALL_HANGUP,
EventType.CALL_REJECT,
EventType.CALL_REJECT,
EventType.CALL_ANSWER -> formatCallEvent(type, timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
EventType.CALL_NEGOTIATE,
EventType.CALL_SELECT_ANSWER,
@ -352,11 +352,12 @@ class NoticeEventFormatter @Inject constructor(
} else {
sp.getString(R.string.notice_call_candidates, senderName)
}
EventType.CALL_REJECT -> if (event.isSentByCurrentUser()) {
sp.getString(R.string.call_tile_you_declined, "")
} else {
sp.getString(R.string.call_tile_other_declined, senderName)
}
EventType.CALL_REJECT ->
if (event.isSentByCurrentUser()) {
sp.getString(R.string.call_tile_you_declined, "")
} else {
sp.getString(R.string.call_tile_other_declined, senderName)
}
else -> null
}
}

View File

@ -78,17 +78,17 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem<CallTileTimelineItem.Ho
holder.acceptView.setText(R.string.join)
holder.acceptView.setLeftDrawable(R.drawable.ic_call_audio_small, R.color.riotx_accent)
}
CallKind.AUDIO -> {
CallKind.AUDIO -> {
holder.rejectView.setText(R.string.call_notification_reject)
holder.acceptView.setText(R.string.call_notification_answer)
holder.acceptView.setLeftDrawable(R.drawable.ic_call_audio_small, R.color.riotx_accent)
}
CallKind.VIDEO -> {
CallKind.VIDEO -> {
holder.rejectView.setText(R.string.call_notification_reject)
holder.acceptView.setText(R.string.call_notification_answer)
holder.acceptView.setLeftDrawable(R.drawable.ic_call_video_small, R.color.riotx_accent)
}
else -> {
else -> {
Timber.w("Shouldn't be in that state")
}
}
@ -102,12 +102,12 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem<CallTileTimelineItem.Ho
private fun TextView.setCallStatus(attributes: Attributes) {
when (attributes.callStatus) {
CallStatus.INVITED -> if (attributes.informationData.sentByMe) {
CallStatus.INVITED -> if (attributes.informationData.sentByMe) {
setText(R.string.call_tile_you_started_call)
} else {
text = context.getString(R.string.call_tile_other_started_call, attributes.userOfInterest.getBestName())
}
CallStatus.IN_CALL -> setText(R.string.call_tile_in_call)
CallStatus.IN_CALL -> setText(R.string.call_tile_in_call)
CallStatus.REJECTED -> if (attributes.informationData.sentByMe) {
setTextWithColoredPart(R.string.call_tile_you_declined, R.string.call_tile_call_back) {
val callbackAction = RoomDetailAction.StartCall(attributes.callKind == CallKind.VIDEO)
@ -116,7 +116,7 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem<CallTileTimelineItem.Ho
} else {
text = context.getString(R.string.call_tile_other_declined, attributes.userOfInterest.getBestName())
}
CallStatus.ENDED -> setText(R.string.call_tile_ended)
CallStatus.ENDED -> setText(R.string.call_tile_ended)
}
}

View File

@ -2797,6 +2797,7 @@
<string name="call_tile_you_started_call">You started a call</string>
<string name="call_tile_other_started_call">%1$s started a call</string>
<string name="call_tile_in_call">You\'re currently in this call</string>
<!-- Pattern can be replaced by the value of string call_tile_call_back -->
<string name="call_tile_you_declined">You declined this call %1$s</string>
<string name="call_tile_other_declined">%1$s declined this call</string>
<string name="call_tile_ended">This call has ended</string>