Added shortcut in call settings to change incoming call ringtone

This commit is contained in:
Sylvain Berfini 2024-07-20 18:08:32 +02:00
parent 0bea45054b
commit 2394c701cf
5 changed files with 44 additions and 0 deletions

View file

@ -19,7 +19,9 @@
*/
package org.linphone.ui.main.settings.fragment
import android.content.Intent
import android.os.Bundle
import android.provider.Settings
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
@ -137,6 +139,20 @@ class SettingsFragment : GenericMainFragment() {
}
}
viewModel.goToIncomingCallNotificationChannelSettingsEvent.observe(viewLifecycleOwner) {
it.consume {
Log.w("$TAG Going to incoming call channel settings")
val intent = Intent(Settings.ACTION_CHANNEL_NOTIFICATION_SETTINGS).apply {
putExtra(Settings.EXTRA_APP_PACKAGE, requireContext().packageName)
putExtra(
Settings.EXTRA_CHANNEL_ID,
getString(R.string.notification_channel_incoming_call_id)
)
}
startActivity(intent)
}
}
viewModel.addLdapServerEvent.observe(viewLifecycleOwner) {
it.consume {
val action = SettingsFragmentDirections.actionSettingsFragmentToLdapServerConfigurationFragment(

View file

@ -75,6 +75,8 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() {
val autoRecordCalls = MutableLiveData<Boolean>()
val goToIncomingCallNotificationChannelSettingsEvent = MutableLiveData<Event<Boolean>>()
// Conversations settings
val showConversationsSettings = MutableLiveData<Boolean>()
@ -345,6 +347,11 @@ class SettingsViewModel @UiThread constructor() : GenericViewModel() {
}
}
@UiThread
fun changeRingtone() {
goToIncomingCallNotificationChannelSettingsEvent.value = Event(true)
}
@UiThread
fun toggleConversationsExpand() {
expandConversations.value = expandConversations.value == false

View file

@ -144,6 +144,25 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/vibrate_switch" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:id="@+id/advanced_settings"
android:onClick="@{() -> viewModel.changeRingtone()}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:padding="5dp"
android:layout_marginStart="10dp"
android:layout_marginEnd="10dp"
android:layout_marginTop="16dp"
android:layout_marginBottom="@dimen/screen_bottom_margin"
android:text="@string/settings_calls_change_ringtone_title"
android:drawableEnd="@drawable/caret_right"
android:drawableTint="?attr/color_main2_600"
app:layout_constraintHorizontal_bias="1"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@id/auto_record_switch"/>
</androidx.constraintlayout.widget.ConstraintLayout>
</layout>

View file

@ -196,6 +196,7 @@
<string name="settings_calls_enable_fec_title">Activer la FEC vidéo</string>
<string name="settings_calls_vibrate_while_ringing_title">Vibrer lors de la réception d\'un appel</string>
<string name="settings_calls_auto_record_title">Démarrer l\'enregistrement des appels automatiquement</string>
<string name="settings_calls_change_ringtone_title">Changer de sonnerie</string>
<string name="settings_conversations_title">Conversations</string>
<string name="settings_conversations_auto_download_title">Télécharger automatiquement les fichiers</string>
<string name="settings_contacts_title">Contacts</string>

View file

@ -233,6 +233,7 @@
<string name="settings_calls_enable_fec_title">Enable video FEC</string>
<string name="settings_calls_vibrate_while_ringing_title">Vibrate while incoming call is ringing</string>
<string name="settings_calls_auto_record_title">Automatically start recording calls</string>
<string name="settings_calls_change_ringtone_title">Change ringtone</string>
<string name="settings_conversations_title">Conversations</string>
<string name="settings_conversations_auto_download_title">Auto-download files</string>
<string name="settings_contacts_title">Contacts</string>