linphone-android/app/src/main/res/layout/settings_widget_switch.xml
2021-09-10 17:15:54 +02:00

88 lines
No EOL
3.5 KiB
XML

<?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="title"
type="String" />
<variable
name="subtitle"
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_marginRight="@dimen/settings_margin"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
<TextView
android:id="@+id/settings_title"
android:layout_width="match_parent"
android:layout_height="25dp"
android:gravity="center_vertical"
android:text="@{title}"
android:enabled="@{enabled ?? true}"
android:visibility="@{title.length() > 0 ? View.VISIBLE : View.GONE}"
android:maxLines="2"
android:layout_toLeftOf="@id/setting_switch"
android:layout_marginTop="15dp"
android:layout_marginLeft="@dimen/settings_margin"
android:layout_marginRight="@dimen/settings_margin"
style="@style/settings_item_font"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="@dimen/setting_title_min_size"
app:autoSizeMaxTextSize="@dimen/setting_title_max_size"
app:autoSizeStepGranularity="@dimen/settings_granularity_step"/>
<TextView
android:id="@+id/settings_subtitle"
android:text="@{subtitle}"
android:enabled="@{enabled ?? true}"
android:layout_width="match_parent"
android:layout_height="20dp"
android:gravity="center_vertical"
android:visibility="@{subtitle.length() > 0 ? View.VISIBLE : View.GONE}"
android:maxLines="1"
android:layout_below="@id/settings_title"
android:layout_toLeftOf="@id/setting_switch"
android:layout_marginLeft="@dimen/settings_margin"
android:layout_marginRight="@dimen/settings_margin"
style="@style/settings_item_subtitle_font"
app:autoSizeTextType="uniform"
app:autoSizeMinTextSize="@dimen/setting_subtitle_min_size"
app:autoSizeMaxTextSize="@dimen/setting_subtitle_max_size"
app:autoSizeStepGranularity="@dimen/settings_granularity_step"/>
<View
android:layout_marginTop="15dp"
android:layout_width="match_parent"
android:layout_height="1dp"
android:layout_below="@id/settings_subtitle"
android:background="?attr/dividerColor" />
</RelativeLayout>
</layout>