mirror of
https://gitlab.linphone.org/BC/public/linphone-android.git
synced 2026-01-17 11:28:06 +00:00
Started advanced settings, currently only contains remote provisioning URI
This commit is contained in:
parent
7b13bb3bd2
commit
e616582162
7 changed files with 200 additions and 0 deletions
|
|
@ -0,0 +1,53 @@
|
|||
package org.linphone.ui.main.settings.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.UiThread
|
||||
import androidx.lifecycle.ViewModelProvider
|
||||
import org.linphone.databinding.SettingsAdvancedFragmentBinding
|
||||
import org.linphone.ui.main.fragment.GenericFragment
|
||||
import org.linphone.ui.main.settings.viewmodel.SettingsViewModel
|
||||
|
||||
@UiThread
|
||||
class SettingsAdvancedFragment : GenericFragment() {
|
||||
companion object {
|
||||
private const val TAG = "[Advanced Settings Fragment]"
|
||||
}
|
||||
|
||||
private lateinit var binding: SettingsAdvancedFragmentBinding
|
||||
|
||||
private lateinit var viewModel: SettingsViewModel
|
||||
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater,
|
||||
container: ViewGroup?,
|
||||
savedInstanceState: Bundle?
|
||||
): View {
|
||||
binding = SettingsAdvancedFragmentBinding.inflate(layoutInflater)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
postponeEnterTransition()
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
viewModel = ViewModelProvider(this)[SettingsViewModel::class.java]
|
||||
|
||||
binding.lifecycleOwner = viewLifecycleOwner
|
||||
binding.viewModel = viewModel
|
||||
|
||||
binding.setBackClickListener {
|
||||
goBack()
|
||||
}
|
||||
|
||||
startPostponedEnterTransition()
|
||||
}
|
||||
|
||||
override fun onPause() {
|
||||
viewModel.updateRemoteProvisioningUrl()
|
||||
|
||||
super.onPause()
|
||||
}
|
||||
}
|
||||
|
|
@ -78,6 +78,13 @@ class SettingsFragment : GenericFragment() {
|
|||
goBack()
|
||||
}
|
||||
|
||||
binding.setAdvancedSettingsClickListener {
|
||||
if (findNavController().currentDestination?.id == R.id.settingsFragment) {
|
||||
val action = SettingsFragmentDirections.actionSettingsFragmentToSettingsAdvancedFragment()
|
||||
findNavController().navigate(action)
|
||||
}
|
||||
}
|
||||
|
||||
viewModel.addLdapServerEvent.observe(viewLifecycleOwner) {
|
||||
it.consume {
|
||||
val action = SettingsFragmentDirections.actionSettingsFragmentToLdapServerConfigurationFragment(
|
||||
|
|
|
|||
|
|
@ -115,6 +115,9 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
|
|||
)
|
||||
val availableThemesValues = arrayListOf(-1, 0, 1)
|
||||
|
||||
// Advanced setttings
|
||||
val remoteProvisioningUrl = MutableLiveData<String>()
|
||||
|
||||
init {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
showConversationsSettings.postValue(!corePreferences.disableChat)
|
||||
|
|
@ -155,6 +158,8 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
|
|||
defaultLayout.postValue(core.defaultConferenceLayout.toInt())
|
||||
|
||||
theme.postValue(corePreferences.darkMode)
|
||||
|
||||
remoteProvisioningUrl.postValue(core.provisioningUri)
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -350,4 +355,19 @@ class SettingsViewModel @UiThread constructor() : ViewModel() {
|
|||
theme.postValue(themeValue)
|
||||
}
|
||||
}
|
||||
|
||||
@UiThread
|
||||
fun updateRemoteProvisioningUrl() {
|
||||
coreContext.postOnCoreThread { core ->
|
||||
val newProvisioningUri = remoteProvisioningUrl.value.orEmpty()
|
||||
if (newProvisioningUri != core.provisioningUri) {
|
||||
Log.i("$TAG Updating remote provisioning URI to [$newProvisioningUri]")
|
||||
if (newProvisioningUri.isEmpty()) {
|
||||
core.provisioningUri = null
|
||||
} else {
|
||||
core.provisioningUri = newProvisioningUri
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
100
app/src/main/res/layout/settings_advanced_fragment.xml
Normal file
100
app/src/main/res/layout/settings_advanced_fragment.xml
Normal file
|
|
@ -0,0 +1,100 @@
|
|||
<?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="backClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.settings.viewmodel.SettingsViewModel" />
|
||||
</data>
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="?attr/color_main2_000">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/back"
|
||||
android:onClick="@{backClickListener}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="0dp"
|
||||
android:adjustViewBounds="true"
|
||||
android:padding="15dp"
|
||||
android:src="@drawable/caret_left"
|
||||
android:contentDescription="@string/content_description_go_back_icon"
|
||||
app:tint="?attr/color_main1_500"
|
||||
app:layout_constraintBottom_toBottomOf="@id/title"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@id/title" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/main_page_title_style"
|
||||
android:id="@+id/title"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="@dimen/top_bar_height"
|
||||
android:layout_marginStart="10dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="@string/settings_advanced_title"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@id/back"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="0dp"
|
||||
android:fillViewport="true"
|
||||
android:background="?attr/color_grey_100"
|
||||
app:layout_constraintTop_toBottomOf="@id/title"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/header_style"
|
||||
android:id="@+id/remote_provisioning_label"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="16dp"
|
||||
android:layout_marginTop="16dp"
|
||||
android:paddingTop="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
android:text="@string/settings_advanced_remote_provisioning_url"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"/>
|
||||
|
||||
<androidx.appcompat.widget.AppCompatEditText
|
||||
style="@style/default_text_style"
|
||||
android:id="@+id/remote_provisioning"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="50dp"
|
||||
android:layout_marginEnd="16dp"
|
||||
android:layout_marginTop="5dp"
|
||||
android:paddingStart="20dp"
|
||||
android:paddingEnd="20dp"
|
||||
android:text="@={viewModel.remoteProvisioningUrl}"
|
||||
android:textSize="14sp"
|
||||
android:textColor="@color/gray_main2_600"
|
||||
android:maxLines="1"
|
||||
android:background="@drawable/edit_text_background"
|
||||
android:inputType="text|textUri"
|
||||
app:layout_constraintHorizontal_bias="0"
|
||||
app:layout_constraintWidth_max="@dimen/text_input_max_width"
|
||||
app:layout_constraintTop_toBottomOf="@id/remote_provisioning_label"
|
||||
app:layout_constraintStart_toStartOf="@id/remote_provisioning_label"
|
||||
app:layout_constraintEnd_toEndOf="parent"/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</ScrollView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</layout>
|
||||
|
|
@ -8,6 +8,9 @@
|
|||
<variable
|
||||
name="backClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="advancedSettingsClickListener"
|
||||
type="View.OnClickListener" />
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="org.linphone.ui.main.settings.viewmodel.SettingsViewModel" />
|
||||
|
|
@ -268,6 +271,7 @@
|
|||
<androidx.appcompat.widget.AppCompatTextView
|
||||
style="@style/section_header_style"
|
||||
android:id="@+id/advanced_settings"
|
||||
android:onClick="@{advancedSettingsClickListener}"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:padding="5dp"
|
||||
|
|
|
|||
|
|
@ -129,6 +129,14 @@
|
|||
app:exitAnim="@anim/slide_out_left"
|
||||
app:popEnterAnim="@anim/slide_in_left"
|
||||
app:popExitAnim="@anim/slide_out_right" />
|
||||
<action
|
||||
android:id="@+id/action_settingsFragment_to_settingsAdvancedFragment"
|
||||
app:destination="@id/settingsAdvancedFragment"
|
||||
app:launchSingleTop="true"
|
||||
app:enterAnim="@anim/slide_in_right"
|
||||
app:exitAnim="@anim/slide_out_left"
|
||||
app:popEnterAnim="@anim/slide_in_left"
|
||||
app:popExitAnim="@anim/slide_out_right" />
|
||||
</fragment>
|
||||
|
||||
<action
|
||||
|
|
@ -411,4 +419,10 @@
|
|||
app:nullable="true" />
|
||||
</fragment>
|
||||
|
||||
<fragment
|
||||
android:id="@+id/settingsAdvancedFragment"
|
||||
android:name="org.linphone.ui.main.settings.fragment.SettingsAdvancedFragment"
|
||||
android:label="SettingsAdvancedFragment"
|
||||
tools:layout="@layout/settings_advanced_fragment"/>
|
||||
|
||||
</navigation>
|
||||
|
|
@ -291,6 +291,8 @@
|
|||
<string name="settings_user_interface_auto_theme_label">Auto</string>
|
||||
<string name="settings_advanced_title">Advanced settings</string>
|
||||
|
||||
<string name="settings_advanced_remote_provisioning_url">Remote provisioning URL</string>
|
||||
|
||||
<!-- Account profile & settings -->
|
||||
<string name="manage_account_title">Manage account</string>
|
||||
<string name="manage_account_details_title">Details</string>
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue