mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Improved & fixed issues regarding incoming video call notification
This commit is contained in:
parent
d02ca882bd
commit
c88917ac68
7 changed files with 67 additions and 22 deletions
|
|
@ -138,18 +138,21 @@ class NotificationsManager @MainThread constructor(private val context: Context)
|
|||
)
|
||||
showCallNotification(call, false)
|
||||
}
|
||||
Call.State.Connected -> {
|
||||
if (call.dir == Call.Dir.Incoming) {
|
||||
Call.State.Connected,
|
||||
Call.State.StreamsRunning -> {
|
||||
if (call.state == Call.State.Connected && call.dir == Call.Dir.Incoming) {
|
||||
Log.i(
|
||||
"$TAG Connected call was incoming (so it was answered), removing incoming call notification"
|
||||
)
|
||||
removeIncomingCallNotification()
|
||||
}
|
||||
|
||||
Log.i(
|
||||
"$TAG Showing connected call notification for [${call.remoteAddress.asStringUriOnly()}]"
|
||||
)
|
||||
showCallNotification(call, false)
|
||||
if (call.state == Call.State.Connected || call.dir == Call.Dir.Incoming) {
|
||||
Log.i(
|
||||
"$TAG Showing connected call notification for [${call.remoteAddress.asStringUriOnly()}]"
|
||||
)
|
||||
showCallNotification(call, false)
|
||||
}
|
||||
}
|
||||
Call.State.Updating -> {
|
||||
val notifiable = getNotifiableForCall(call)
|
||||
|
|
@ -1006,7 +1009,7 @@ class NotificationsManager @MainThread constructor(private val context: Context)
|
|||
channel
|
||||
).apply {
|
||||
try {
|
||||
style.setIsVideo(false)
|
||||
style.setIsVideo(isVideo)
|
||||
setStyle(style)
|
||||
} catch (iae: IllegalArgumentException) {
|
||||
Log.e(
|
||||
|
|
|
|||
|
|
@ -1040,22 +1040,40 @@ class CurrentCallViewModel @UiThread constructor() : GenericViewModel() {
|
|||
}
|
||||
|
||||
if (call.dir == Call.Dir.Incoming) {
|
||||
val isVideo = call.remoteParams?.isVideoEnabled == true && call.remoteParams?.videoDirection != MediaDirection.Inactive
|
||||
if (call.core.accountList.size > 1) {
|
||||
val displayName = LinphoneUtils.getDisplayName(call.toAddress)
|
||||
incomingCallTitle.postValue(
|
||||
AppUtils.getFormattedString(
|
||||
R.string.call_incoming_for_account,
|
||||
displayName
|
||||
if (isVideo) {
|
||||
incomingCallTitle.postValue(
|
||||
AppUtils.getFormattedString(
|
||||
R.string.call_video_incoming_for_account,
|
||||
displayName
|
||||
)
|
||||
)
|
||||
)
|
||||
} else {
|
||||
incomingCallTitle.postValue(
|
||||
AppUtils.getFormattedString(
|
||||
R.string.call_audio_incoming_for_account,
|
||||
displayName
|
||||
)
|
||||
)
|
||||
}
|
||||
} else {
|
||||
incomingCallTitle.postValue(AppUtils.getString(R.string.call_incoming))
|
||||
if (isVideo) {
|
||||
incomingCallTitle.postValue(AppUtils.getString(R.string.call_video_incoming))
|
||||
} else {
|
||||
incomingCallTitle.postValue(AppUtils.getString(R.string.call_audio_incoming))
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (LinphoneUtils.isCallOutgoing(call.state)) {
|
||||
isVideoEnabled.postValue(call.params.isVideoEnabled)
|
||||
updateVideoDirection(call.params.videoDirection)
|
||||
} else if (LinphoneUtils.isCallIncoming(call.state)) {
|
||||
isVideoEnabled.postValue(
|
||||
call.remoteParams?.isVideoEnabled == true && call.remoteParams?.videoDirection != MediaDirection.Inactive
|
||||
)
|
||||
} else {
|
||||
isVideoEnabled.postValue(call.currentParams.isVideoEnabled)
|
||||
updateVideoDirection(call.currentParams.videoDirection)
|
||||
|
|
|
|||
|
|
@ -46,10 +46,29 @@
|
|||
android:paddingEnd="30dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:src="@drawable/phone"
|
||||
android:contentDescription="@string/content_description_answer_call"
|
||||
android:visibility="@{viewModel.isVideoEnabled ? View.GONE : View.VISIBLE}"
|
||||
android:contentDescription="@string/content_description_answer_audio_call"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="@id/answer_video_call"
|
||||
app:layout_constraintStart_toEndOf="@id/hang_up"
|
||||
app:tint="@color/white" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/answer_video_call"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/call_button_size"
|
||||
android:background="@drawable/squircle_green_button_background"
|
||||
android:onClick="@{() -> viewModel.answer()}"
|
||||
android:paddingStart="30dp"
|
||||
android:paddingTop="15dp"
|
||||
android:paddingEnd="30dp"
|
||||
android:paddingBottom="15dp"
|
||||
android:src="@drawable/video_camera"
|
||||
android:visibility="@{viewModel.isVideoEnabled ? View.VISIBLE : View.GONE, default=gone}"
|
||||
android:contentDescription="@string/content_description_answer_video_call"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/hang_up"
|
||||
app:layout_constraintStart_toEndOf="@id/answer_call"
|
||||
app:tint="@color/white" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
android:layout_marginStart="10dp"
|
||||
android:layout_marginTop="10dp"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:text="@{viewModel.incomingCallTitle, default=@string/call_incoming}"
|
||||
android:text="@{viewModel.incomingCallTitle, default=@string/call_video_incoming}"
|
||||
app:layout_constraintStart_toEndOf="@id/call_direction_icon"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
|
|
|
|||
|
|
@ -35,7 +35,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="8dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="@{model.isOutgoing() ? @string/call_outgoing : @string/call_incoming, default=@string/call_outgoing}"
|
||||
android:text="@{model.isOutgoing() ? @string/call_outgoing : @string/call_audio_incoming, default=@string/call_outgoing}"
|
||||
android:textSize="14sp"
|
||||
android:textColor="?attr/color_main2_700"
|
||||
app:layout_constraintStart_toEndOf="@id/call_status"
|
||||
|
|
|
|||
|
|
@ -570,9 +570,11 @@
|
|||
|
||||
<!-- Call related -->
|
||||
<string name="call_outgoing">Appel sortant</string>
|
||||
<string name="call_incoming">Appel entrant</string>
|
||||
<string name="call_audio_incoming">Appel entrant</string>
|
||||
<string name="call_video_incoming">Appel vidéo entrant</string>
|
||||
<string name="call_ended">Appel terminé</string>
|
||||
<string name="call_incoming_for_account">Appel entrant pour %s</string>
|
||||
<string name="call_audio_incoming_for_account">Appel entrant pour %s</string>
|
||||
<string name="call_video_incoming_for_account">Appel vidéo entrant pour %s</string>
|
||||
<string name="call_transfer_current_call_title">Transférer %s à…</string>
|
||||
<string name="call_transfer_active_calls_label">Appels en cours</string>
|
||||
<string name="call_transfer_no_active_call_label">Pas d\'autre appel</string>
|
||||
|
|
|
|||
|
|
@ -608,9 +608,11 @@
|
|||
|
||||
<!-- Call related -->
|
||||
<string name="call_outgoing">Outgoing call</string>
|
||||
<string name="call_incoming">Incoming call</string>
|
||||
<string name="call_audio_incoming">Incoming call</string>
|
||||
<string name="call_video_incoming">Incoming video call</string>
|
||||
<string name="call_ended">Call ended</string>
|
||||
<string name="call_incoming_for_account">Incoming call for %s</string>
|
||||
<string name="call_audio_incoming_for_account">Incoming call for %s</string>
|
||||
<string name="call_video_incoming_for_account">Incoming video call for %s</string>
|
||||
<string name="call_transfer_current_call_title">Transfer %s to…</string>
|
||||
<string name="call_transfer_active_calls_label">Current calls</string>
|
||||
<string name="call_transfer_no_active_call_label">No other call</string>
|
||||
|
|
@ -797,7 +799,8 @@
|
|||
<string name="content_description_toggle_password_visibility">Toggles password visibility</string>
|
||||
<string name="content_description_toggle_bottom_sheet">Expands/retracts bottom sheet</string>
|
||||
<string name="content_description_hang_up_call">Terminates the call</string>
|
||||
<string name="content_description_answer_call">Answers the call</string>
|
||||
<string name="content_description_answer_audio_call">Answers the call</string>
|
||||
<string name="content_description_answer_video_call">Answers the video call</string>
|
||||
<string name="content_description_call_start">Starts a call</string>
|
||||
<string name="content_description_call_start_video">Starts a video call</string>
|
||||
<string name="content_description_toggle_video">Enables/disables sending your camera feed</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue