Magisk/app/src/main/res/layout/item_settings.xml

88 lines
3.3 KiB
XML
Raw Normal View History

<?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"
xmlns:tools="http://schemas.android.com/tools">
<data>
<variable
name="item"
2020-08-11 03:30:00 -07:00
type="com.topjohnwu.magisk.model.entity.recycler.SettingsItem" />
<variable
name="callback"
type="com.topjohnwu.magisk.model.entity.recycler.SettingsItem.Callback" />
</data>
<com.google.android.material.card.MaterialCardView
style="@style/WidgetFoundation.Card"
isEnabled="@{item.enabled}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="@{item.enabled ? 1f : .5f}"
android:onClick="@{(view) -> item.onPressed(view, callback)}"
tools:layout_gravity="center">
2020-08-11 03:30:00 -07:00
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
2020-08-11 03:30:00 -07:00
android:orientation="horizontal"
android:gravity="center_vertical"
android:paddingStart="@{item.icon == 0 ? @dimen/l1 : 0}"
android:paddingEnd="@dimen/l1">
2020-08-11 00:54:19 -07:00
<ImageView
2020-08-11 03:30:00 -07:00
android:id="@+id/icon"
style="@style/WidgetFoundation.Icon"
gone="@{item.icon == 0}"
android:background="@null"
app:srcCompat="@{item.icon}"
tools:srcCompat="@drawable/ic_fingerprint" />
<LinearLayout
2020-08-11 03:30:00 -07:00
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingTop="@dimen/l1"
2020-08-11 03:30:00 -07:00
android:paddingBottom="@dimen/l1">
2020-08-11 00:54:19 -07:00
<TextView
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:gravity="start"
android:text="@{item.title}"
android:textAppearance="@style/AppearanceFoundation.Body"
android:textStyle="bold"
tools:lines="1"
tools:text="@tools:sample/lorem/random" />
2020-08-11 00:54:19 -07:00
<TextView
gone="@{item.description.empty}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@{item.description}"
android:textAppearance="@style/AppearanceFoundation.Tiny.Variant"
tools:lines="2"
tools:text="@tools:sample/lorem/random" />
</LinearLayout>
2020-08-11 03:30:00 -07:00
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/selector_indicator"
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:checked="@{item.checked}"
android:onCheckedChanged="@{(v, c) -> item.onToggle(v, callback, c)}"
goneUnless="@{item.showSwitch}"
isEnabled="@{item.enabled}"/>
</LinearLayout>
</com.google.android.material.card.MaterialCardView>
2020-08-11 00:54:19 -07:00
</layout>