Updated video settings to allow changing recv-fmtp of codecs
This commit is contained in:
parent
60d1e8de25
commit
d13a0c2dea
5 changed files with 130 additions and 12 deletions
|
@ -79,14 +79,21 @@ class VideoSettingsFragment : GenericFragment<SettingsVideoFragmentBinding>() {
|
||||||
private fun initVideoCodecsList() {
|
private fun initVideoCodecsList() {
|
||||||
val list = arrayListOf<ViewDataBinding>()
|
val list = arrayListOf<ViewDataBinding>()
|
||||||
for (payload in coreContext.core.videoPayloadTypes) {
|
for (payload in coreContext.core.videoPayloadTypes) {
|
||||||
val binding = DataBindingUtil.inflate<ViewDataBinding>(LayoutInflater.from(requireContext()), R.layout.settings_widget_switch, null, false)
|
val binding = DataBindingUtil.inflate<ViewDataBinding>(LayoutInflater.from(requireContext()), R.layout.settings_widget_switch_and_text, null, false)
|
||||||
binding.setVariable(BR.title, payload.mimeType)
|
binding.setVariable(BR.switch_title, payload.mimeType)
|
||||||
binding.setVariable(BR.subtitle, "")
|
binding.setVariable(BR.switch_subtitle, "")
|
||||||
|
binding.setVariable(BR.text_title, "recv-fmtp")
|
||||||
|
binding.setVariable(BR.text_subtitle, "")
|
||||||
|
binding.setVariable(BR.defaultValue, payload.recvFmtp)
|
||||||
binding.setVariable(BR.checked, payload.enabled())
|
binding.setVariable(BR.checked, payload.enabled())
|
||||||
binding.setVariable(BR.listener, object : SettingListenerStub() {
|
binding.setVariable(BR.listener, object : SettingListenerStub() {
|
||||||
override fun onBoolValueChanged(newValue: Boolean) {
|
override fun onBoolValueChanged(newValue: Boolean) {
|
||||||
payload.enable(newValue)
|
payload.enable(newValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onTextValueChanged(newValue: String) {
|
||||||
|
payload.recvFmtp = newValue
|
||||||
|
}
|
||||||
})
|
})
|
||||||
binding.lifecycleOwner = this
|
binding.lifecycleOwner = this
|
||||||
list.add(binding)
|
list.add(binding)
|
||||||
|
|
|
@ -21,9 +21,7 @@
|
||||||
android:onClick="@{() -> listener.onClicked()}"
|
android:onClick="@{() -> listener.onClicked()}"
|
||||||
android:enabled="@{enabled ?? true}"
|
android:enabled="@{enabled ?? true}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center_vertical|left">
|
|
||||||
|
|
||||||
<org.linphone.views.MarqueeTextView
|
<org.linphone.views.MarqueeTextView
|
||||||
android:id="@+id/settings_title"
|
android:id="@+id/settings_title"
|
||||||
|
|
|
@ -26,9 +26,7 @@
|
||||||
<RelativeLayout
|
<RelativeLayout
|
||||||
android:onClick="@{() -> listener.onClicked()}"
|
android:onClick="@{() -> listener.onClicked()}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center_vertical|left">
|
|
||||||
|
|
||||||
<org.linphone.views.MarqueeTextView
|
<org.linphone.views.MarqueeTextView
|
||||||
android:id="@+id/settings_title"
|
android:id="@+id/settings_title"
|
||||||
|
|
|
@ -24,9 +24,7 @@
|
||||||
android:enabled="@{enabled ?? true}"
|
android:enabled="@{enabled ?? true}"
|
||||||
onClickToggleSwitch="@{@id/setting_switch}"
|
onClickToggleSwitch="@{@id/setting_switch}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content">
|
||||||
android:orientation="vertical"
|
|
||||||
android:gravity="center_vertical|left">
|
|
||||||
|
|
||||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
android:id="@+id/setting_switch"
|
android:id="@+id/setting_switch"
|
||||||
|
|
117
app/src/main/res/layout/settings_widget_switch_and_text.xml
Normal file
117
app/src/main/res/layout/settings_widget_switch_and_text.xml
Normal file
|
@ -0,0 +1,117 @@
|
||||||
|
<?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"/>
|
||||||
|
<import type="android.text.InputType"/>
|
||||||
|
<variable
|
||||||
|
name="switch_title"
|
||||||
|
type="String" />
|
||||||
|
<variable
|
||||||
|
name="switch_subtitle"
|
||||||
|
type="String" />
|
||||||
|
<variable
|
||||||
|
name="text_title"
|
||||||
|
type="String" />
|
||||||
|
<variable
|
||||||
|
name="text_subtitle"
|
||||||
|
type="String" />
|
||||||
|
<variable
|
||||||
|
name="defaultValue"
|
||||||
|
type="String" />
|
||||||
|
<variable
|
||||||
|
name="checked"
|
||||||
|
type="Boolean" />
|
||||||
|
<variable
|
||||||
|
name="enabled"
|
||||||
|
type="Boolean" />
|
||||||
|
<variable
|
||||||
|
name="listener"
|
||||||
|
type="org.linphone.activities.main.settings.SettingListener" />
|
||||||
|
</data>
|
||||||
|
|
||||||
|
<RelativeLayout
|
||||||
|
android:enabled="@{enabled ?? true}"
|
||||||
|
onClickToggleSwitch="@{@id/setting_switch}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content">
|
||||||
|
|
||||||
|
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||||
|
android:id="@+id/setting_switch"
|
||||||
|
android:enabled="@{enabled ?? true}"
|
||||||
|
android:checked="@={checked}"
|
||||||
|
android:onCheckedChanged="@{(switch, value) -> listener.onBoolValueChanged(value)}"
|
||||||
|
android:layout_centerVertical="true"
|
||||||
|
android:layout_alignParentRight="true"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content" />
|
||||||
|
|
||||||
|
<org.linphone.views.MarqueeTextView
|
||||||
|
android:id="@+id/settings_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:text="@{switch_title}"
|
||||||
|
android:enabled="@{enabled ?? true}"
|
||||||
|
android:visibility="@{switch_title.length() > 0 ? View.VISIBLE : View.GONE}"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_toLeftOf="@id/setting_switch"
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
style="@style/settings_item_font"/>
|
||||||
|
|
||||||
|
<org.linphone.views.MarqueeTextView
|
||||||
|
android:id="@+id/settings_subtitle"
|
||||||
|
android:text="@{switch_subtitle}"
|
||||||
|
android:enabled="@{enabled ?? true}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:visibility="@{switch_subtitle.length() > 0 ? View.VISIBLE : View.GONE}"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:layout_below="@id/settings_title"
|
||||||
|
android:layout_toLeftOf="@id/setting_switch"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
style="@style/settings_item_subtitle_font"/>
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputLayout
|
||||||
|
android:id="@+id/settings_input_layout"
|
||||||
|
android:visibility="@{settingSwitch.checked ? View.VISIBLE : View.GONE}"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_below="@id/settings_subtitle"
|
||||||
|
android:layout_toLeftOf="@id/setting_switch"
|
||||||
|
android:layout_marginTop="5dp"
|
||||||
|
android:layout_marginLeft="10dp"
|
||||||
|
android:layout_marginRight="10dp"
|
||||||
|
android:enabled="@{enabled ?? true}"
|
||||||
|
android:hint="@{text_title}"
|
||||||
|
app:helperText="@{text_subtitle}"
|
||||||
|
app:helperTextEnabled="@{text_subtitle.length() > 0}">
|
||||||
|
|
||||||
|
<com.google.android.material.textfield.TextInputEditText
|
||||||
|
android:id="@+id/settings_input"
|
||||||
|
onValueChanged="@{() -> listener.onTextValueChanged(settingsInput.getText().toString())}"
|
||||||
|
android:text="@{defaultValue}"
|
||||||
|
android:imeOptions="actionDone"
|
||||||
|
android:inputType="@{InputType.TYPE_TEXT_FLAG_NO_SUGGESTIONS}"
|
||||||
|
android:singleLine="true"
|
||||||
|
android:background="@color/transparent_color"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"/>
|
||||||
|
|
||||||
|
</com.google.android.material.textfield.TextInputLayout>
|
||||||
|
|
||||||
|
<View
|
||||||
|
android:layout_marginTop="15dp"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="1dp"
|
||||||
|
android:layout_below="@id/settings_input_layout"
|
||||||
|
android:background="?attr/dividerColor" />
|
||||||
|
|
||||||
|
</RelativeLayout>
|
||||||
|
|
||||||
|
</layout>
|
Loading…
Reference in a new issue