Added empty contacts settings (for now)

This commit is contained in:
Sylvain Berfini 2024-02-05 16:31:46 +01:00
parent 3fb8b77f87
commit 879b6b3b7e
4 changed files with 63 additions and 1 deletions

View file

@ -48,6 +48,7 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
val expandCalls = MutableLiveData<Boolean>()
val expandConversations = MutableLiveData<Boolean>()
val expandContacts = MutableLiveData<Boolean>()
val expandMeetings = MutableLiveData<Boolean>()
val expandNetwork = MutableLiveData<Boolean>()
val expandUserInterface = MutableLiveData<Boolean>()
@ -75,6 +76,9 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
val autoDownloadEnabled = MutableLiveData<Boolean>()
val exportMediaEnabled = MutableLiveData<Boolean>()
// Contacts settings
val showContactsSettings = MutableLiveData<Boolean>()
// Meetings settings
val showMeetingsSettings = MutableLiveData<Boolean>()
@ -116,6 +120,7 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
showConversationsSettings.postValue(!corePreferences.disableChat)
showMeetingsSettings.postValue(!corePreferences.disableMeetings)
}
showContactsSettings.value = true
expandCalls.value = false
expandConversations.value = false
@ -326,6 +331,11 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
}
}
@UiThread
fun toggleContactsExpand() {
expandContacts.value = expandContacts.value == false
}
@UiThread
fun toggleMeetingsExpand() {
expandMeetings.value = expandMeetings.value == false

View 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>

View file

@ -117,6 +117,36 @@
app:layout_constraintTop_toBottomOf="@id/chat"
bind:viewModel="@{viewModel}"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/section_header_style"
android:onClick="@{() -> viewModel.toggleContactsExpand()}"
android:id="@+id/contacts"
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_contacts_title"
android:drawableEnd="@{viewModel.expandContacts ? @drawable/caret_up : @drawable/caret_down, default=@drawable/caret_up}"
android:drawableTint="?attr/color_main2_600"
android:visibility="@{viewModel.showContactsSettings ? 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/contacts_settings"
layout="@layout/settings_contacts"
android:layout_width="match_parent"
android:layout_height="0dp"
android:layout_marginTop="8dp"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:visibility="@{viewModel.expandContacts &amp;&amp; viewModel.showContactsSettings ? View.VISIBLE : View.GONE}"
app:layout_constraintTop_toBottomOf="@id/contacts"
bind:viewModel="@{viewModel}"/>
<androidx.appcompat.widget.AppCompatTextView
style="@style/section_header_style"
android:onClick="@{() -> viewModel.toggleMeetingsExpand()}"
@ -133,7 +163,7 @@
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"/>
app:layout_constraintTop_toBottomOf="@id/contacts_settings"/>
<include
android:id="@+id/meetings_settings"

View file

@ -276,6 +276,7 @@
<string name="settings_conversations_auto_download_title">Auto-download files</string>
<string name="settings_conversations_export_media_title">Export media in native gallery</string>
<string name="settings_conversations_export_media_subtitle">Media from ephemeral messages will never be exported</string>
<string name="settings_contacts_title">Contacts</string>
<string name="settings_meetings_title">Meetings</string>
<string name="settings_meetings_default_layout_title">Default layout</string>
<string name="settings_meetings_layout_active_speaker_label">Active speaker</string>