mirror of
https://github.com/element-hq/element-android
synced 2024-11-24 10:25:35 +03:00
Just some formatting
This commit is contained in:
parent
370b9dabff
commit
4e32120a41
4 changed files with 16 additions and 14 deletions
|
@ -57,9 +57,9 @@ class CallItemFactory @Inject constructor(
|
||||||
val callId = callSignalingContent.callId ?: return null
|
val callId = callSignalingContent.callId ?: return null
|
||||||
val call = callManager.getCallById(callId)
|
val call = callManager.getCallById(callId)
|
||||||
val callKind = when {
|
val callKind = when {
|
||||||
call == null -> CallTileTimelineItem.CallKind.UNKNOWN
|
call == null -> CallTileTimelineItem.CallKind.UNKNOWN
|
||||||
call.mxCall.isVideoCall -> CallTileTimelineItem.CallKind.VIDEO
|
call.mxCall.isVideoCall -> CallTileTimelineItem.CallKind.VIDEO
|
||||||
else -> CallTileTimelineItem.CallKind.AUDIO
|
else -> CallTileTimelineItem.CallKind.AUDIO
|
||||||
}
|
}
|
||||||
return when (event.root.getClearType()) {
|
return when (event.root.getClearType()) {
|
||||||
EventType.CALL_ANSWER -> {
|
EventType.CALL_ANSWER -> {
|
||||||
|
|
|
@ -91,7 +91,7 @@ class NoticeEventFormatter @Inject constructor(
|
||||||
EventType.CALL_INVITE,
|
EventType.CALL_INVITE,
|
||||||
EventType.CALL_CANDIDATES,
|
EventType.CALL_CANDIDATES,
|
||||||
EventType.CALL_HANGUP,
|
EventType.CALL_HANGUP,
|
||||||
EventType.CALL_REJECT,
|
EventType.CALL_REJECT,
|
||||||
EventType.CALL_ANSWER -> formatCallEvent(type, timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
EventType.CALL_ANSWER -> formatCallEvent(type, timelineEvent.root, timelineEvent.senderInfo.disambiguatedDisplayName)
|
||||||
EventType.CALL_NEGOTIATE,
|
EventType.CALL_NEGOTIATE,
|
||||||
EventType.CALL_SELECT_ANSWER,
|
EventType.CALL_SELECT_ANSWER,
|
||||||
|
@ -352,11 +352,12 @@ class NoticeEventFormatter @Inject constructor(
|
||||||
} else {
|
} else {
|
||||||
sp.getString(R.string.notice_call_candidates, senderName)
|
sp.getString(R.string.notice_call_candidates, senderName)
|
||||||
}
|
}
|
||||||
EventType.CALL_REJECT -> if (event.isSentByCurrentUser()) {
|
EventType.CALL_REJECT ->
|
||||||
sp.getString(R.string.call_tile_you_declined, "")
|
if (event.isSentByCurrentUser()) {
|
||||||
} else {
|
sp.getString(R.string.call_tile_you_declined, "")
|
||||||
sp.getString(R.string.call_tile_other_declined, senderName)
|
} else {
|
||||||
}
|
sp.getString(R.string.call_tile_other_declined, senderName)
|
||||||
|
}
|
||||||
else -> null
|
else -> null
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -78,17 +78,17 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem<CallTileTimelineItem.Ho
|
||||||
holder.acceptView.setText(R.string.join)
|
holder.acceptView.setText(R.string.join)
|
||||||
holder.acceptView.setLeftDrawable(R.drawable.ic_call_audio_small, R.color.riotx_accent)
|
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.rejectView.setText(R.string.call_notification_reject)
|
||||||
holder.acceptView.setText(R.string.call_notification_answer)
|
holder.acceptView.setText(R.string.call_notification_answer)
|
||||||
holder.acceptView.setLeftDrawable(R.drawable.ic_call_audio_small, R.color.riotx_accent)
|
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.rejectView.setText(R.string.call_notification_reject)
|
||||||
holder.acceptView.setText(R.string.call_notification_answer)
|
holder.acceptView.setText(R.string.call_notification_answer)
|
||||||
holder.acceptView.setLeftDrawable(R.drawable.ic_call_video_small, R.color.riotx_accent)
|
holder.acceptView.setLeftDrawable(R.drawable.ic_call_video_small, R.color.riotx_accent)
|
||||||
}
|
}
|
||||||
else -> {
|
else -> {
|
||||||
Timber.w("Shouldn't be in that state")
|
Timber.w("Shouldn't be in that state")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -102,12 +102,12 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem<CallTileTimelineItem.Ho
|
||||||
|
|
||||||
private fun TextView.setCallStatus(attributes: Attributes) {
|
private fun TextView.setCallStatus(attributes: Attributes) {
|
||||||
when (attributes.callStatus) {
|
when (attributes.callStatus) {
|
||||||
CallStatus.INVITED -> if (attributes.informationData.sentByMe) {
|
CallStatus.INVITED -> if (attributes.informationData.sentByMe) {
|
||||||
setText(R.string.call_tile_you_started_call)
|
setText(R.string.call_tile_you_started_call)
|
||||||
} else {
|
} else {
|
||||||
text = context.getString(R.string.call_tile_other_started_call, attributes.userOfInterest.getBestName())
|
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) {
|
CallStatus.REJECTED -> if (attributes.informationData.sentByMe) {
|
||||||
setTextWithColoredPart(R.string.call_tile_you_declined, R.string.call_tile_call_back) {
|
setTextWithColoredPart(R.string.call_tile_you_declined, R.string.call_tile_call_back) {
|
||||||
val callbackAction = RoomDetailAction.StartCall(attributes.callKind == CallKind.VIDEO)
|
val callbackAction = RoomDetailAction.StartCall(attributes.callKind == CallKind.VIDEO)
|
||||||
|
@ -116,7 +116,7 @@ abstract class CallTileTimelineItem : AbsBaseMessageItem<CallTileTimelineItem.Ho
|
||||||
} else {
|
} else {
|
||||||
text = context.getString(R.string.call_tile_other_declined, attributes.userOfInterest.getBestName())
|
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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2797,6 +2797,7 @@
|
||||||
<string name="call_tile_you_started_call">You started a call</string>
|
<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_other_started_call">%1$s started a call</string>
|
||||||
<string name="call_tile_in_call">You\'re currently in this 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_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_other_declined">%1$s declined this call</string>
|
||||||
<string name="call_tile_ended">This call has ended</string>
|
<string name="call_tile_ended">This call has ended</string>
|
||||||
|
|
Loading…
Reference in a new issue