Fix focus on main elements in Modern UI

Co-authored-by: John Wu <topjohnwu@gmail.com>
This commit is contained in:
nikk 2020-09-21 13:27:29 +03:00 committed by GitHub
parent bd240ba48c
commit f575155a41
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 141 additions and 72 deletions

View File

@ -31,6 +31,7 @@
style="@style/WidgetFoundation.Card.Elevated"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
app:cardElevation="@dimen/margin_generic"
app:cardUseCompatPadding="true">
@ -53,9 +54,9 @@
app:layout_constraintGuide_end="16dp" />
<ImageView
android:id="@+id/dialog_base_icon"
style="@style/WidgetFoundation.Image.Big"
gone="@{data.icon == null}"
android:id="@+id/dialog_base_icon"
android:layout_gravity="center"
android:layout_marginTop="@dimen/l1"
android:src="@{data.icon}"
@ -66,8 +67,8 @@
tools:src="@drawable/ic_delete_md2" />
<TextView
gone="@{data.title.length == 0}"
android:id="@+id/dialog_base_title"
gone="@{data.title.length == 0}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l1"
@ -96,8 +97,8 @@
android:layout_height="wrap_content">
<TextView
gone="@{data.message.length == 0}"
android:id="@+id/dialog_base_message"
gone="@{data.message.length == 0}"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:text="@{data.message}"
@ -127,16 +128,16 @@
android:id="@+id/dialog_base_buttons"
android:layout_width="0dp"
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:gravity="bottom|center_horizontal"
android:layoutDirection="locale"
android:orientation="horizontal"
android:paddingStart="12dp"
android:paddingTop="4dp"
android:paddingEnd="12dp"
android:paddingBottom="4dp">
android:paddingBottom="4dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<Button
android:id="@+id/dialog_base_button_4"
@ -146,7 +147,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="@{data.buttonIDGAF.isEnabled()}"
android:filterTouchesWhenObscured="true"
android:focusable="@{data.buttonIDGAF.isEnabled()}"
android:onClick="@{() -> data.buttonIDGAF.clicked()}"
android:text="@{data.buttonIDGAF.title}"
app:icon="@{data.buttonIDGAF.icon}"
@ -161,7 +164,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="@{data.buttonNeutral.isEnabled()}"
android:filterTouchesWhenObscured="true"
android:focusable="@{data.buttonNeutral.isEnabled()}"
android:onClick="@{() -> data.buttonNeutral.clicked()}"
android:text="@{data.buttonNeutral.title}"
app:icon="@{data.buttonNeutral.icon}"
@ -184,7 +189,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="@{data.buttonNegative.isEnabled()}"
android:filterTouchesWhenObscured="true"
android:focusable="@{data.buttonNegative.isEnabled()}"
android:onClick="@{() -> data.buttonNegative.clicked()}"
android:text="@{data.buttonNegative.title}"
app:icon="@{data.buttonNegative.icon}"
@ -199,7 +206,9 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:clickable="@{data.buttonPositive.isEnabled()}"
android:filterTouchesWhenObscured="true"
android:focusable="@{data.buttonPositive.isEnabled()}"
android:onClick="@{() -> data.buttonPositive.clicked()}"
android:text="@{data.buttonPositive.title}"
app:icon="@{data.buttonPositive.icon}"

View File

@ -9,7 +9,7 @@
<import type="com.topjohnwu.magisk.ui.home.MagiskState" />
<import type="com.topjohnwu.magisk.ui.home.DeveloperItem"/>
<import type="com.topjohnwu.magisk.ui.home.DeveloperItem" />
<variable
name="viewModel"
@ -34,15 +34,15 @@
android:paddingTop="@dimen/l1">
<Button
android:layout_gravity="center"
style="@style/WidgetFoundation.Button"
gone="@{!viewModel.showTest}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:onClick="@{() -> viewModel.onTestPressed()}"
android:text="TEST"
android:textAllCaps="false"
tools:visibility="gone"/>
tools:visibility="gone" />
<com.google.android.material.card.MaterialCardView
style="@style/WidgetFoundation.Card.Primary"
@ -51,7 +51,8 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
android:layout_marginBottom="@dimen/l1">
android:layout_marginBottom="@dimen/l1"
android:focusable="false">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@ -101,40 +102,40 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
android:layout_marginTop="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
app:layout_constraintTop_toBottomOf="@+id/home_magisk_wrapper" />
<Space
gone="@{!viewModel.showSafetyNet &amp;&amp; !viewModel.showUninstall}"
android:layout_width="match_parent"
android:layout_height="@dimen/l1"
gone="@{!viewModel.showSafetyNet &amp;&amp; !viewModel.showUninstall}" />
android:layout_height="@dimen/l1" />
<Button
style="@style/WidgetFoundation.Button.Outlined"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
gone="@{!viewModel.showSafetyNet}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
android:onClick="@{() -> viewModel.onSafetyNetPressed()}"
android:text="@string/home_check_safetynet"
android:textAllCaps="false"
android:textSize="12sp"
android:onClick="@{() -> viewModel.onSafetyNetPressed()}"
gone="@{!viewModel.showSafetyNet}"
app:cornerRadius="@dimen/r1"
app:icon="@drawable/ic_safetynet_md2" />
<Button
style="@style/WidgetFoundation.Button.Outlined.Error"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
gone="@{!viewModel.showUninstall}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1"
android:onClick="@{() -> viewModel.onDeletePressed()}"
android:text="@string/uninstall_magisk_title"
android:textAllCaps="false"
android:textSize="12sp"
android:onClick="@{() -> viewModel.onDeletePressed()}"
gone="@{!viewModel.showUninstall}"
app:cornerRadius="@dimen/r1"
app:icon="@drawable/ic_delete_md2" />
@ -143,7 +144,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_margin="@dimen/l1">
android:layout_margin="@dimen/l1"
android:focusable="false">
<LinearLayout
android:layout_width="match_parent"
@ -169,20 +171,20 @@
android:textAppearance="@style/AppearanceFoundation.Caption.Variant" />
<include
item="@{DeveloperItem.Main.INSTANCE}"
layout="@layout/item_developer"
viewModel="@{viewModel}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l_50"
viewModel="@{viewModel}"
item="@{DeveloperItem.Main.INSTANCE}" />
android:layout_marginTop="@dimen/l_50" />
<include
item="@{DeveloperItem.App.INSTANCE}"
layout="@layout/item_developer"
viewModel="@{viewModel}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l_50"
viewModel="@{viewModel}"
item="@{DeveloperItem.App.INSTANCE}" />
android:layout_marginTop="@dimen/l_50" />
</LinearLayout>

View File

@ -6,6 +6,7 @@
<data>
<import type="com.topjohnwu.magisk.core.Info" />
<import type="com.topjohnwu.magisk.core.Config" />
<variable
@ -36,12 +37,13 @@
android:paddingTop="@dimen/l1">
<com.google.android.material.card.MaterialCardView
gone="@{viewModel.skipOptions}"
style="@style/WidgetFoundation.Card"
gone="@{viewModel.skipOptions}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1" >
android:layout_marginEnd="@dimen/l1"
android:focusable="false">
<LinearLayout
android:layout_width="match_parent"
@ -63,11 +65,11 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/l1"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/install_options_title"
android:textAppearance="@style/AppearanceFoundation.Body"
android:textStyle="bold"
android:gravity="center_vertical"
android:layout_weight="1"/>
android:textStyle="bold" />
<Button
style="@style/WidgetFoundation.Button.Text"
@ -83,16 +85,17 @@
gone="@{viewModel.step != 0}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical"
android:paddingStart="3dp"
android:paddingEnd="3dp"
android:layout_marginStart="@dimen/l1"
android:layout_marginTop="@dimen/l_50"
android:layout_marginEnd="@dimen/l1"
android:layout_marginBottom="@dimen/l_50"
android:orientation="vertical"
android:paddingStart="3dp"
android:paddingEnd="3dp"
tools:layout_gravity="center">
<CheckBox
style="@style/WidgetFoundation.Checkbox"
gone="@{Info.isSAR}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -101,6 +104,7 @@
tools:checked="true" />
<CheckBox
style="@style/WidgetFoundation.Checkbox"
gone="@{Info.isFBE}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -109,6 +113,7 @@
app:tint="?colorPrimary" />
<CheckBox
style="@style/WidgetFoundation.Checkbox"
gone="@{Info.ramdisk}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -128,7 +133,8 @@
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:layout_marginTop="@dimen/l1"
android:layout_marginEnd="@dimen/l1" >
android:layout_marginEnd="@dimen/l1"
android:focusable="false">
<LinearLayout
android:layout_width="match_parent"
@ -150,11 +156,11 @@
android:layout_width="0dp"
android:layout_height="match_parent"
android:layout_marginStart="@dimen/l1"
android:layout_weight="1"
android:gravity="center_vertical"
android:text="@string/install_method_title"
android:textAppearance="@style/AppearanceFoundation.Body"
android:textStyle="bold"
android:gravity="center_vertical"
android:layout_weight="1"/>
android:textStyle="bold" />
<Button
style="@style/WidgetFoundation.Button.Text"
@ -165,7 +171,7 @@
android:onClick="@{() -> viewModel.install()}"
android:text="@string/install_start"
app:icon="@drawable/ic_forth_md2"
app:iconGravity="textEnd"/>
app:iconGravity="textEnd" />
</LinearLayout>
@ -183,6 +189,7 @@
<RadioButton
android:id="@+id/method_download"
style="@style/WidgetFoundation.RadioButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/download_zip_only"
@ -190,12 +197,14 @@
<RadioButton
android:id="@+id/method_patch"
style="@style/WidgetFoundation.RadioButton"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:text="@string/select_patch_file" />
<RadioButton
android:id="@+id/method_direct"
style="@style/WidgetFoundation.RadioButton"
gone="@{!viewModel.rooted}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -203,6 +212,7 @@
<RadioButton
android:id="@+id/method_inactive_slot"
style="@style/WidgetFoundation.RadioButton"
gone="@{!viewModel.isRooted || !Info.isAB}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
@ -218,21 +228,21 @@
style="@style/WidgetFoundation.Card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="@dimen/l1"
android:layout_marginStart="@dimen/l1"
android:layout_marginEnd="@dimen/l1" >
android:layout_marginEnd="@dimen/l1"
android:focusable="false">
<TextView
android:id="@+id/release_notes"
markdownText="@{viewModel.notes}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_margin="15dp"
android:textAppearance="@style/AppearanceFoundation.Caption"
android:visibility="gone"
markdownText="@{viewModel.notes}"
tools:visibility="visible"
tools:maxLines="5"
tools:text="@tools:sample/lorem/random"
tools:maxLines="5" />
tools:visibility="visible" />
</com.google.android.material.card.MaterialCardView>

View File

@ -47,10 +47,13 @@
app:layout_constraintTop_toBottomOf="@+id/hide_filter_title_filter">
<com.google.android.material.chip.Chip
android:id="@+id/hide_filter_chip"
style="@style/Widget.MaterialComponents.Chip.Filter"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="@={viewModel.showSystem}"
android:nextFocusRight="@id/hide_filter_chip_data"
android:nextFocusDown="@id/hide_filter_search_field"
android:text="@string/show_system_app"
android:textAppearance="@style/AppearanceFoundation.Caption"
app:checkedIcon="@drawable/ic_check_md2"
@ -58,12 +61,15 @@
tools:checked="true" />
<com.google.android.material.chip.Chip
android:id="@+id/hide_filter_chip_data"
style="@style/Widget.MaterialComponents.Chip.Entry"
gone="@{viewModel.query.empty}"
onCloseClicked="@{() -> viewModel.resetQuery()}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checkable="false"
android:nextFocusRight="@id/hide_filter_done"
android:nextFocusDown="@id/hide_filter_search_field"
android:text="@{viewModel.query}"
android:textAppearance="@style/AppearanceFoundation.Caption"
app:chipBackgroundColor="?colorSurfaceVariant" />
@ -106,14 +112,16 @@
app:tint="?colorDisabled" />
<EditText
android:id="@+id/hide_filter_search_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
android:background="@null"
android:gravity="start|center_vertical"
android:hint="@string/hide_filter_hint"
android:inputType="textUri"
android:minHeight="36dp"
android:gravity="start|center_vertical"
android:nextFocusRight="@id/hide_filter_done"
android:paddingStart="0dp"
android:paddingEnd="@dimen/l1"
android:singleLine="true"
@ -128,14 +136,15 @@
android:id="@+id/hide_filter_done"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:nextFocusLeft="@id/hide_filter_chip"
app:backgroundTint="?colorPrimary"
app:tint="?colorOnPrimary"
app:elevation="0dp"
app:fabSize="mini"
app:layout_constraintBottom_toBottomOf="@+id/hide_filter_search"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="@+id/hide_filter_search"
app:srcCompat="@drawable/ic_check_md2" />
app:srcCompat="@drawable/ic_check_md2"
app:tint="?colorOnPrimary" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -18,13 +18,14 @@
<com.google.android.material.card.MaterialCardView
style="@style/WidgetFoundation.Card"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:focusable="false">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/l_50"
android:paddingStart="@dimen/l1"
android:paddingTop="@dimen/l_50"
android:paddingEnd="@dimen/l1"
android:paddingBottom="@dimen/l_50"
tools:layout_gravity="center">
@ -105,7 +106,7 @@
android:id="@+id/home_magisk_latest_version"
style="@style/W.Home.Item.Top"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" >
app:layout_constraintTop_toTopOf="parent">
<TextView
style="@style/W.Home.ItemContent"

View File

@ -18,13 +18,14 @@
<com.google.android.material.card.MaterialCardView
style="@style/WidgetFoundation.Card"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_height="wrap_content"
android:focusable="false">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/l_50"
android:paddingStart="@dimen/l1"
android:paddingTop="@dimen/l_50"
android:paddingEnd="@dimen/l1"
android:paddingBottom="@dimen/l_50"
tools:layout_gravity="center">
@ -106,7 +107,7 @@
android:id="@+id/home_manager_latest_version"
style="@style/W.Home.Item.Top"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" >
app:layout_constraintTop_toTopOf="parent">
<TextView
style="@style/W.Home.ItemContent"

View File

@ -87,6 +87,7 @@
app:tint="?colorDisabled" />
<EditText
android:id="@+id/module_filter_search_field"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="48dp"
@ -94,6 +95,7 @@
android:hint="@string/hide_filter_hint"
android:inputType="textUri"
android:minHeight="36dp"
android:nextFocusRight="@id/module_filter_done"
android:paddingStart="0dp"
android:paddingEnd="@dimen/l1"
android:singleLine="true"
@ -109,6 +111,7 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/l1"
android:nextFocusLeft="@id/module_filter_search_field"
app:backgroundTint="?colorPrimary"
app:elevation="0dp"
app:fabSize="mini"

View File

@ -21,6 +21,7 @@
style="@style/WidgetFoundation.Card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:focusable="false"
tools:layout_gravity="center"
tools:layout_marginBottom="@dimen/l1">
@ -30,9 +31,11 @@
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/hide_expand"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:nextFocusRight="@id/hide_expand_icon"
android:onClick="@{item::toggleExpand}">
<ImageView
@ -77,15 +80,16 @@
<com.topjohnwu.widget.IndeterminateCheckBox
android:id="@+id/hide_expand_icon"
state="@={item.hiddenState}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/l1"
android:minWidth="0dp"
android:minHeight="0dp"
android:layout_marginEnd="@dimen/l1"
android:nextFocusLeft="@id/hide_expand"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
state="@={item.hiddenState}"/>
app:layout_constraintTop_toTopOf="parent" />
</androidx.constraintlayout.widget.ConstraintLayout>
@ -105,9 +109,9 @@
<ProgressBar
style="@style/WidgetFoundation.ProgressBar"
gone="@{item.checkedPercent == 0}"
android:layout_width="match_parent"
android:layout_gravity="top"
gone="@{item.checkedPercent == 0}"
android:progress="@{item.checkedPercent}" />
</com.google.android.material.card.MaterialCardView>

View File

@ -19,6 +19,8 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="?selectableItemBackgroundBorderless"
android:clickable="true"
android:focusable="true"
android:minWidth="60dp"
android:onClick="@{() -> viewModel.onLinkPressed(item.link)}"
android:padding="@dimen/l_50"

View File

@ -19,6 +19,8 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:clickable="true"
android:focusable="true"
android:onClick="@{() -> listener.onClick(item.position)}"
android:paddingStart="@dimen/l1"
android:paddingTop="@dimen/l_75"

View File

@ -29,6 +29,7 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="@{item.enabled ? 1f : .5f}"
android:nextFocusRight="@id/module_indicator"
tools:layout_gravity="center"
tools:layout_margin="@dimen/l1">
@ -83,10 +84,10 @@
<com.google.android.material.switchmaterial.SwitchMaterial
android:id="@+id/module_indicator"
android:checked="@={item.enabled}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginEnd="@dimen/l_50"
android:checked="@={item.enabled}"
app:layout_constraintBottom_toBottomOf="@+id/module_version_author"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintHorizontal_bias="1"
@ -122,6 +123,8 @@
gone="@{item.repo == null}"
android:layout_width="wrap_content"
android:alpha=".5"
android:clickable="true"
android:focusable="true"
android:onClick="@{() -> viewModel.infoPressed(item)}"
android:paddingEnd="@dimen/l_50"
app:layout_constraintBottom_toBottomOf="@+id/module_remove"
@ -134,6 +137,8 @@
style="@style/WidgetFoundation.Button.Text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:onClick="@{() -> item.delete(viewModel)}"
android:text="@{item.removed ? @string/module_state_restore : @string/module_state_remove}"
android:textAllCaps="false"

View File

@ -18,9 +18,14 @@
</data>
<com.google.android.material.card.MaterialCardView
android:id="@+id/module_card"
style="@style/WidgetFoundation.Card"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:clickable="true"
android:focusable="true"
android:nextFocusRight="@id/module_info"
android:onClick="@{() -> viewModel.downloadPressed(item)}"
tools:layout_gravity="center"
tools:layout_marginBottom="@dimen/l1"
tools:layout_marginEnd="@dimen/l1">
@ -96,6 +101,7 @@
style="@style/WidgetFoundation.Icon"
android:layout_width="wrap_content"
android:alpha=".5"
android:nextFocusLeft="@id/module_card"
android:onClick="@{() -> viewModel.infoPressed(item)}"
android:paddingEnd="@dimen/l_50"
app:layout_constraintBottom_toBottomOf="@+id/module_download"
@ -105,16 +111,17 @@
<ImageView
android:id="@+id/module_download"
android:layout_width="wrap_content"
style="@style/WidgetFoundation.Icon.Primary"
android:paddingStart="@dimen/l_50"
isEnabled="@{!(item.progress == -100 || (item.progress > 0 &amp;&amp; item.progress &lt; 100))}"
android:contentDescription="@string/download"
srcCompat="@{item.isUpdate ? R.drawable.ic_update_md2 : R.drawable.ic_download_md2}"
android:layout_width="wrap_content"
android:contentDescription="@string/download"
android:nextFocusLeft="@id/module_info"
android:onClick="@{() -> viewModel.downloadPressed(item)}"
android:paddingStart="@dimen/l_50"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toBottomOf="@+id/module_divider"
android:onClick="@{() -> viewModel.downloadPressed(item)}"
tools:srcCompat="@drawable/ic_download_md2" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -21,14 +21,16 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:alpha="@{item.enabled ? 1f : .5f}"
android:clickable="@{item.enabled}"
android:focusable="@{item.enabled}"
android:onClick="@{(view) -> item.onPressed(view, callback)}"
tools:layout_gravity="center">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal"
android:gravity="center_vertical"
android:orientation="horizontal"
android:paddingStart="@{item.icon == 0 ? @dimen/l1 : 0}"
android:paddingEnd="@dimen/l1">
@ -41,9 +43,9 @@
tools:srcCompat="@drawable/ic_fingerprint" />
<LinearLayout
android:layout_weight="1"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_weight="1"
android:gravity="center_vertical"
android:orientation="vertical"
android:paddingTop="@dimen/l1"
@ -73,12 +75,13 @@
<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}"/>
isEnabled="@{item.enabled}"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:checked="@{item.checked}"
android:focusable="@{item.enabled}"
android:onCheckedChanged="@{(v, c) -> item.onToggle(v, callback, c)}" />
</LinearLayout>

View File

@ -15,6 +15,7 @@
<style name="WidgetFoundation.Card" parent="Widget.MaterialComponents.CardView">
<item name="android:focusable">auto</item>
<item name="cardBackgroundColor">?colorSurfaceVariant</item>
<item name="cardCornerRadius">@dimen/l_50</item>
<item name="cardElevation">0dp</item>
@ -154,6 +155,16 @@
<item name="tint">@color/color_error_transient</item>
</style>
<style name="WidgetFoundation.Checkbox" parent="Widget.AppCompat.CompoundButton.CheckBox">
<item name="android:paddingStart">@dimen/l1</item>
<item name="android:paddingEnd">@dimen/l1</item>
</style>
<style name="WidgetFoundation.RadioButton" parent="Widget.AppCompat.CompoundButton.RadioButton">
<item name="android:paddingStart">@dimen/l1</item>
<item name="android:paddingEnd">@dimen/l1</item>
</style>
<style name="WidgetFoundation.ProgressBar" parent="Widget.AppCompat.ProgressBar.Horizontal">
<item name="android:indeterminate">false</item>
<item name="android:layout_height">4dp</item>