mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Started chat & meetings settings, improved other settings
This commit is contained in:
parent
70e98dfe78
commit
29e4bb5932
8 changed files with 137 additions and 21 deletions
|
|
@ -46,10 +46,14 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
|
|||
}
|
||||
|
||||
val expandCalls = MutableLiveData<Boolean>()
|
||||
val expandConversations = MutableLiveData<Boolean>()
|
||||
val expandMeetings = MutableLiveData<Boolean>()
|
||||
val expandNetwork = MutableLiveData<Boolean>()
|
||||
val expandUserInterface = MutableLiveData<Boolean>()
|
||||
|
||||
// Calls settings
|
||||
val hideVideoCallSetting = MutableLiveData<Boolean>()
|
||||
|
||||
val echoCancellerEnabled = MutableLiveData<Boolean>()
|
||||
val routeAudioToBluetooth = MutableLiveData<Boolean>()
|
||||
val videoEnabled = MutableLiveData<Boolean>()
|
||||
|
|
@ -64,6 +68,12 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
|
|||
|
||||
val autoRecordCalls = MutableLiveData<Boolean>()
|
||||
|
||||
// Conversations settings
|
||||
val showConversationsSettings = MutableLiveData<Boolean>()
|
||||
|
||||
// Meetings settings
|
||||
val showMeetingsSettings = MutableLiveData<Boolean>()
|
||||
|
||||
// Network settings
|
||||
val useWifiOnly = MutableLiveData<Boolean>()
|
||||
|
||||
|
|
@ -84,7 +94,15 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
|
|||
}
|
||||
|
||||
init {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
hideVideoCallSetting.postValue(!core.isVideoEnabled)
|
||||
showConversationsSettings.postValue(!corePreferences.disableChat)
|
||||
showMeetingsSettings.postValue(!corePreferences.disableMeetings)
|
||||
}
|
||||
|
||||
expandCalls.value = false
|
||||
expandConversations.value = false
|
||||
expandMeetings.value = false
|
||||
expandNetwork.value = false
|
||||
expandUserInterface.value = false
|
||||
|
||||
|
|
@ -273,6 +291,16 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
|
|||
expandCalls.value = expandCalls.value == false
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleConversationsExpand() {
|
||||
expandConversations.value = expandConversations.value == false
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleMeetingsExpand() {
|
||||
expandMeetings.value = expandMeetings.value == false
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun toggleNetworkExpand() {
|
||||
expandNetwork.value = expandNetwork.value == false
|
||||
|
|
|
|||
|
|
@ -20,7 +20,6 @@
|
|||
style="@style/settings_title_style"
|
||||
android:onClick="@{() -> viewModel.toggleEchoCanceller()}"
|
||||
android:id="@+id/echo_canceller_title"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -37,7 +36,6 @@
|
|||
style="@style/settings_subtitle_style"
|
||||
android:onClick="@{() -> viewModel.toggleEchoCanceller()}"
|
||||
android:id="@+id/echo_canceller_subtitle"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -52,7 +50,6 @@
|
|||
style="@style/material_switch_style"
|
||||
android:id="@+id/echo_canceller_switch"
|
||||
android:onClick="@{() -> viewModel.toggleEchoCanceller()}"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
|
|
@ -65,7 +62,6 @@
|
|||
style="@style/settings_title_style"
|
||||
android:onClick="@{() -> viewModel.toggleRouteAudioToBluetooth()}"
|
||||
android:id="@+id/route_audio_to_bluetooth_title"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -82,7 +78,6 @@
|
|||
style="@style/material_switch_style"
|
||||
android:id="@+id/route_audio_to_bluetooth_switch"
|
||||
android:onClick="@{() -> viewModel.toggleRouteAudioToBluetooth()}"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
|
|
@ -95,7 +90,7 @@
|
|||
style="@style/settings_title_style"
|
||||
android:onClick="@{() -> viewModel.toggleEnableVideo()}"
|
||||
android:id="@+id/enable_video_title"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{!viewModel.hideVideoCallSetting ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -112,7 +107,7 @@
|
|||
style="@style/material_switch_style"
|
||||
android:id="@+id/enable_video_switch"
|
||||
android:onClick="@{() -> viewModel.toggleEnableVideo()}"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{!viewModel.hideVideoCallSetting ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
|
|
@ -124,7 +119,6 @@
|
|||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/settings_title_style"
|
||||
android:id="@+id/device_ringtone_title"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
|
|
@ -140,7 +134,6 @@
|
|||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
style="@style/material_switch_style"
|
||||
android:id="@+id/device_ringtone_spinner"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
|
|
@ -153,7 +146,6 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/device_ringtone_spinner_caret"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
|
|
@ -181,7 +173,6 @@
|
|||
android:drawableStart="@{viewModel.isRingtonePlaying ? @drawable/pause : @drawable/play, default=@drawable/play}"
|
||||
android:drawableTint="@color/tertiary_button_label_color"
|
||||
android:drawablePadding="8dp"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toEndOf="@id/device_ringtone_spinner"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/device_ringtone_spinner"
|
||||
|
|
@ -191,7 +182,7 @@
|
|||
style="@style/settings_title_style"
|
||||
android:onClick="@{() -> viewModel.toggleVibrateOnIncomingCalls()}"
|
||||
android:id="@+id/vibrate_title"
|
||||
android:visibility="@{viewModel.expandCalls && viewModel.isVibrationAvailable ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{viewModel.isVibrationAvailable ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -208,7 +199,7 @@
|
|||
style="@style/material_switch_style"
|
||||
android:id="@+id/vibrate_switch"
|
||||
android:onClick="@{() -> viewModel.toggleVibrateOnIncomingCalls()}"
|
||||
android:visibility="@{viewModel.expandCalls && viewModel.isVibrationAvailable ? View.VISIBLE : View.GONE}"
|
||||
android:visibility="@{viewModel.isVibrationAvailable ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
|
|
@ -221,7 +212,6 @@
|
|||
style="@style/settings_title_style"
|
||||
android:onClick="@{() -> viewModel.toggleAutoRecordCall()}"
|
||||
android:id="@+id/auto_record_title"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -238,7 +228,6 @@
|
|||
style="@style/material_switch_style"
|
||||
android:id="@+id/auto_record_switch"
|
||||
android:onClick="@{() -> viewModel.toggleAutoRecordCall()}"
|
||||
android:visibility="@{viewModel.expandCalls ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
|
|
|
|||
21
app/src/main/res/layout/settings_chat.xml
Normal file
21
app/src/main/res/layout/settings_chat.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.settings.viewmodel.SettingsViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="20dp"
|
||||
android:background="@drawable/shape_squircle_white_background">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -86,6 +86,66 @@
|
|||
app:layout_constraintTop_toBottomOf="@id/calls"
|
||||
bind:viewModel="@{viewModel}"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/section_header_style"
|
||||
android:onClick="@{() -> viewModel.toggleConversationsExpand()}"
|
||||
android:id="@+id/chat"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:layout_marginStart="26dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/settings_conversations_title"
|
||||
android:drawableEnd="@{viewModel.expandConversations ? @drawable/caret_up : @drawable/caret_down, default=@drawable/caret_up}"
|
||||
android:drawableTint="@color/gray_main2_600"
|
||||
android:visibility="@{viewModel.showConversationsSettings ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/calls_settings"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/conversation_settings"
|
||||
layout="@layout/settings_chat"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:visibility="@{viewModel.expandConversations && viewModel.showConversationsSettings ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/chat"
|
||||
bind:viewModel="@{viewModel}"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/section_header_style"
|
||||
android:onClick="@{() -> viewModel.toggleMeetingsExpand()}"
|
||||
android:id="@+id/meetings"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
android:layout_marginStart="26dp"
|
||||
android:layout_marginEnd="26dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/settings_meetings_title"
|
||||
android:drawableEnd="@{viewModel.expandMeetings ? @drawable/caret_up : @drawable/caret_down, default=@drawable/caret_up}"
|
||||
android:drawableTint="@color/gray_main2_600"
|
||||
android:visibility="@{viewModel.showMeetingsSettings ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/conversation_settings"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/meetings_settings"
|
||||
layout="@layout/settings_meetings"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="8dp"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:visibility="@{viewModel.expandMeetings && viewModel.showMeetingsSettings ? View.VISIBLE : View.GONE}"
|
||||
app:layout_constraintTop_toBottomOf="@id/meetings"
|
||||
bind:viewModel="@{viewModel}"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/section_header_style"
|
||||
android:onClick="@{() -> viewModel.toggleNetworkExpand()}"
|
||||
|
|
@ -101,7 +161,7 @@
|
|||
android:drawableTint="@color/gray_main2_600"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/calls_settings"/>
|
||||
app:layout_constraintTop_toBottomOf="@id/meetings_settings"/>
|
||||
|
||||
<include
|
||||
android:id="@+id/network_settings"
|
||||
|
|
|
|||
21
app/src/main/res/layout/settings_meetings.xml
Normal file
21
app/src/main/res/layout/settings_meetings.xml
Normal file
|
|
@ -0,0 +1,21 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<data>
|
||||
<import type="android.view.View" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.settings.viewmodel.SettingsViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingBottom="20dp"
|
||||
android:background="@drawable/shape_squircle_white_background">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -20,7 +20,6 @@
|
|||
style="@style/settings_title_style"
|
||||
android:onClick="@{() -> viewModel.toggleEnableVideo()}"
|
||||
android:id="@+id/wifi_only_title"
|
||||
android:visibility="@{viewModel.expandNetwork ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
|
|
@ -37,7 +36,6 @@
|
|||
style="@style/material_switch_style"
|
||||
android:id="@+id/wifi_only_switch"
|
||||
android:onClick="@{() -> viewModel.toggleUseWifiOnly()}"
|
||||
android:visibility="@{viewModel.expandNetwork ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
|
|
|
|||
|
|
@ -19,7 +19,6 @@
|
|||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/settings_title_style"
|
||||
android:id="@+id/theme_title"
|
||||
android:visibility="@{viewModel.expandUserInterface ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
|
|
@ -35,7 +34,6 @@
|
|||
<androidx.appcompat.widget.AppCompatSpinner
|
||||
style="@style/material_switch_style"
|
||||
android:id="@+id/theme_spinner"
|
||||
android:visibility="@{viewModel.expandUserInterface ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
|
|
@ -48,7 +46,6 @@
|
|||
|
||||
<ImageView
|
||||
android:id="@+id/theme_spinner_caret"
|
||||
android:visibility="@{viewModel.expandUserInterface ? View.VISIBLE : View.GONE}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="20dp"
|
||||
|
|
|
|||
|
|
@ -266,6 +266,8 @@
|
|||
<string name="settings_calls_pause_ringtone_label">Pause</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_conversations_title">Conversations</string>
|
||||
<string name="settings_meetings_title">Meetings</string>
|
||||
<string name="settings_network_title">Network</string>
|
||||
<string name="settings_network_use_wifi_only">Use only Wi-Fi networks</string>
|
||||
<string name="settings_user_interface_title">User interface</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue