Added UI setting to have dialpad automatically opened when starting new call

This commit is contained in:
Sylvain Berfini 2025-03-17 14:19:14 +01:00
parent 489c799332
commit 72c5cfe5ae
5 changed files with 50 additions and 5 deletions

View file

@ -227,6 +227,13 @@ class CorePreferences
config.setBool("ui", "enable_secure_mode", value)
}
@get:WorkerThread @set:WorkerThread
var automaticallyShowDialpad: Boolean
get() = config.getBool("ui", "automatically_show_dialpad", false)
set(value) {
config.setBool("ui", "automatically_show_dialpad", value)
}
@get:WorkerThread @set:WorkerThread
var themeMainColor: String
get() = config.getString("ui", "theme_main_color", "orange")!!
@ -318,10 +325,6 @@ class CorePreferences
val fetchContactsFromDefaultDirectory: Boolean
get() = config.getBool("app", "fetch_contacts_from_default_directory", true)
@get:WorkerThread
val automaticallyShowDialpad: Boolean
get() = config.getBool("ui", "automatically_show_dialpad", false)
@get:WorkerThread
val showLettersOnDialpad: Boolean
get() = config.getBool("ui", "show_letters_on_dialpad", true)

View file

@ -135,6 +135,8 @@ class SettingsViewModel
val allowIpv6 = MutableLiveData<Boolean>()
// User Interface settings
val autoShowDialpad = MutableLiveData<Boolean>()
val showThemeSelector = MutableLiveData<Boolean>()
val theme = MutableLiveData<Int>()
val availableThemesNames = arrayListOf(
@ -296,6 +298,7 @@ class SettingsViewModel
defaultLayout.postValue(core.defaultConferenceLayout.toInt())
autoShowDialpad.postValue(corePreferences.automaticallyShowDialpad)
theme.postValue(corePreferences.darkMode)
color.postValue(corePreferences.themeMainColor)
@ -564,6 +567,15 @@ class SettingsViewModel
expandUserInterface.value = expandUserInterface.value == false
}
@UiThread
fun toggleAutoShowDialpad() {
val newValue = autoShowDialpad.value == false
coreContext.postOnCoreThread { core ->
corePreferences.automaticallyShowDialpad = newValue
autoShowDialpad.postValue(newValue)
}
}
@UiThread
fun setTheme(themeValue: Int) {
coreContext.postOnCoreThread {

View file

@ -28,6 +28,34 @@
android:visibility="@{viewModel.showColorSelector ? View.VISIBLE : View.GONE}"
app:constraint_referenced_ids="color_spinner, color_spinner_caret, color_title" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:id="@+id/auto_show_dialpad_title"
android:onClick="@{() -> viewModel.toggleAutoShowDialpad()}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="10dp"
android:text="@string/settings_user_interface_auto_show_dialpad_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toTopOf="@id/auto_show_dialpad_switch"
app:layout_constraintBottom_toBottomOf="@id/auto_show_dialpad_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toStartOf="@id/auto_show_dialpad_switch"/>
<com.google.android.material.materialswitch.MaterialSwitch
style="@style/material_switch_style"
android:id="@+id/auto_show_dialpad_switch"
android:onClick="@{() -> viewModel.toggleAutoShowDialpad()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="20dp"
android:layout_marginEnd="16dp"
android:checked="@{viewModel.autoShowDialpad}"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.appcompat.widget.AppCompatTextView
style="@style/settings_title_style"
android:id="@+id/theme_title"
@ -39,7 +67,7 @@
android:text="@string/settings_user_interface_theme_title"
android:maxLines="2"
android:ellipsize="end"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintTop_toBottomOf="@id/auto_show_dialpad_switch"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"/>

View file

@ -242,6 +242,7 @@
<string name="settings_network_use_wifi_only">Se connecter uniquement via le Wi-Fi</string>
<string name="settings_network_allow_ipv6">Autoriser l\'IPv6</string>
<string name="settings_user_interface_title">Affichage</string>
<string name="settings_user_interface_auto_show_dialpad_title">Ouvrir le pavé numérique automatiquement</string>
<string name="settings_user_interface_theme_title">Thème</string>
<string name="settings_user_interface_dark_theme_label">Sombre</string>
<string name="settings_user_interface_light_theme_label">Clair</string>

View file

@ -281,6 +281,7 @@
<string name="settings_network_use_wifi_only">Use only Wi-Fi networks</string>
<string name="settings_network_allow_ipv6">Allow IPv6</string>
<string name="settings_user_interface_title">User interface</string>
<string name="settings_user_interface_auto_show_dialpad_title">Automatically open dialpad</string>
<string name="settings_user_interface_theme_title">Theme</string>
<string name="settings_user_interface_dark_theme_label">Dark theme</string>
<string name="settings_user_interface_light_theme_label">Light theme</string>