mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Added auto answer with video in both directions advanced call setting
This commit is contained in:
parent
926b8d4dc1
commit
d113797dfb
6 changed files with 60 additions and 3 deletions
|
|
@ -295,12 +295,12 @@ class CoreContext
|
|||
val autoAnswerDelay = corePreferences.autoAnswerDelay
|
||||
if (autoAnswerDelay == 0) {
|
||||
Log.w("$TAG Auto answering call immediately")
|
||||
answerCall(call)
|
||||
answerCall(call, true)
|
||||
} else {
|
||||
Log.i("$TAG Scheduling auto answering in $autoAnswerDelay milliseconds")
|
||||
postOnCoreThreadDelayed({
|
||||
Log.w("$TAG Auto answering call")
|
||||
answerCall(call)
|
||||
answerCall(call, true)
|
||||
}, autoAnswerDelay.toLong())
|
||||
}
|
||||
}
|
||||
|
|
@ -916,7 +916,7 @@ class CoreContext
|
|||
}
|
||||
|
||||
@WorkerThread
|
||||
fun answerCall(call: Call) {
|
||||
fun answerCall(call: Call, autoAnswer: Boolean = false) {
|
||||
Log.i(
|
||||
"$TAG Answering call with remote address [${call.remoteAddress.asStringUriOnly()}] and to address [${call.toAddress.asStringUriOnly()}]"
|
||||
)
|
||||
|
|
@ -942,6 +942,12 @@ class CoreContext
|
|||
Log.i(
|
||||
"$TAG Enabling video on call params to prevent audio-only layout when answering"
|
||||
)
|
||||
} else if (autoAnswer) {
|
||||
val videoBothWays = corePreferences.autoAnswerVideoCallsWithVideoDirectionSendReceive
|
||||
if (videoBothWays) {
|
||||
Log.i("$TAG Call is being auto-answered, requesting video in both ways according to user setting")
|
||||
params.videoDirection = MediaDirection.SendRecv
|
||||
}
|
||||
}
|
||||
|
||||
call.acceptWithParams(params)
|
||||
|
|
|
|||
|
|
@ -183,6 +183,13 @@ class CorePreferences
|
|||
config.setInt("app", "auto_answer_delay", value)
|
||||
}
|
||||
|
||||
@get:WorkerThread @set:WorkerThread
|
||||
var autoAnswerVideoCallsWithVideoDirectionSendReceive: Boolean
|
||||
get() = config.getBool("app", "auto_answer_video_send_receive", false)
|
||||
set(value) {
|
||||
config.setBool("app", "auto_answer_video_send_receive", value)
|
||||
}
|
||||
|
||||
// Conversation related
|
||||
|
||||
@get:WorkerThread @set:WorkerThread
|
||||
|
|
|
|||
|
|
@ -217,6 +217,7 @@ class SettingsViewModel
|
|||
val allowOutgoingEarlyMedia = MutableLiveData<Boolean>()
|
||||
val autoAnswerIncomingCalls = MutableLiveData<Boolean>()
|
||||
val autoAnswerIncomingCallsDelay = MutableLiveData<Int>()
|
||||
val autoAnswerIncomingCallsWithVideoDirectionSendReceive = MutableLiveData<Boolean>()
|
||||
|
||||
val expandAudioDevices = MutableLiveData<Boolean>()
|
||||
val inputAudioDeviceIndex = MutableLiveData<Int>()
|
||||
|
|
@ -356,6 +357,7 @@ class SettingsViewModel
|
|||
allowOutgoingEarlyMedia.postValue(corePreferences.allowOutgoingEarlyMedia)
|
||||
autoAnswerIncomingCalls.postValue(corePreferences.autoAnswerEnabled)
|
||||
autoAnswerIncomingCallsDelay.postValue(corePreferences.autoAnswerDelay)
|
||||
autoAnswerIncomingCallsWithVideoDirectionSendReceive.postValue(corePreferences.autoAnswerVideoCallsWithVideoDirectionSendReceive)
|
||||
|
||||
setupMediaEncryption()
|
||||
setupAudioDevices()
|
||||
|
|
@ -889,6 +891,16 @@ class SettingsViewModel
|
|||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleEnableAutoAnswerIncomingCallsWithVideoDirectionSendReceive() {
|
||||
val newValue = autoAnswerIncomingCallsWithVideoDirectionSendReceive.value == false
|
||||
|
||||
coreContext.postOnCoreThread { core ->
|
||||
corePreferences.autoAnswerVideoCallsWithVideoDirectionSendReceive = newValue
|
||||
autoAnswerIncomingCallsWithVideoDirectionSendReceive.postValue(newValue)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun updateDeviceName() {
|
||||
coreContext.postOnCoreThread {
|
||||
|
|
|
|||
|
|
@ -317,6 +317,36 @@
|
|||
app:layout_constraintStart_toStartOf="@id/auto_answer_incoming_calls_delay_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/settings_title_style"
|
||||
android:onClick="@{() -> viewModel.toggleEnableAutoAnswerIncomingCallsWithVideoDirectionSendReceive()}"
|
||||
android:id="@+id/auto_answer_incoming_calls_video_title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/settings_advanced_enable_auto_answer_video_send_receive"
|
||||
android:maxLines="2"
|
||||
android:ellipsize="end"
|
||||
android:visibility="@{viewModel.autoAnswerIncomingCalls ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toTopOf="@id/auto_answer_incoming_calls_video_switch"
|
||||
app:layout_constraintBottom_toBottomOf="@id/auto_answer_incoming_calls_video_switch"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@id/auto_answer_incoming_calls_video_switch"/>
|
||||
|
||||
<com.google.android.material.materialswitch.MaterialSwitch
|
||||
style="@style/material_switch_style"
|
||||
android:id="@+id/auto_answer_incoming_calls_video_switch"
|
||||
android:onClick="@{() -> viewModel.toggleEnableAutoAnswerIncomingCallsWithVideoDirectionSendReceive()}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:checked="@{viewModel.autoAnswerIncomingCallsWithVideoDirectionSendReceive}"
|
||||
android:visibility="@{viewModel.autoAnswerIncomingCalls ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/auto_answer_incoming_calls_delay" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -281,6 +281,7 @@
|
|||
<string name="settings_advanced_enable_auto_answer_incoming_calls_title">Décrocher automatiquement les appels entrants</string>
|
||||
<string name="settings_advanced_enable_auto_answer_incoming_calls_after_delay_title">Délai avant le décrochage automatique</string>
|
||||
<string name="settings_advanced_enable_auto_answer_incoming_calls_after_delay_hint">Délai en millisecondes</string>
|
||||
<string name="settings_advanced_enable_auto_answer_video_send_receive">Décrocher automatiquement avec la vidéo activée dans les deux sens</string>
|
||||
<string name="settings_advanced_remote_provisioning_url">URL de configuration distante</string>
|
||||
<string name="settings_advanced_download_apply_remote_provisioning">Télécharger & appliquer</string>
|
||||
<string name="settings_advanced_audio_devices_title">Périphériques audio</string>
|
||||
|
|
|
|||
|
|
@ -321,6 +321,7 @@
|
|||
<string name="settings_advanced_enable_auto_answer_incoming_calls_title">Auto answer incoming calls</string>
|
||||
<string name="settings_advanced_enable_auto_answer_incoming_calls_after_delay_title">Delay before auto answering call</string>
|
||||
<string name="settings_advanced_enable_auto_answer_incoming_calls_after_delay_hint">Delay in milliseconds</string>
|
||||
<string name="settings_advanced_enable_auto_answer_video_send_receive">Auto answer with video enabled in both directions</string>
|
||||
<string name="settings_advanced_remote_provisioning_url">Remote provisioning URL</string>
|
||||
<string name="settings_advanced_download_apply_remote_provisioning">Download & apply</string>
|
||||
<string name="settings_advanced_audio_devices_title">Audio devices</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue