You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
Added (partially) settings screen
Most importantly added design and functionality backing for these items
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:color="?colorDisabled" android:state_enabled="false" />
|
||||
<item android:color="?colorSecondary" android:state_checked="false" />
|
||||
<item android:color="?colorPrimary" />
|
||||
</selector>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:shape="rectangle">
|
||||
<size
|
||||
android:width="@dimen/l_50"
|
||||
android:height="@dimen/l_50" />
|
||||
<solid android:color="@android:color/transparent" />
|
||||
</shape>
|
||||
@@ -5,130 +5,33 @@
|
||||
|
||||
<data>
|
||||
|
||||
<import type="com.topjohnwu.magisk.R" />
|
||||
|
||||
<variable
|
||||
name="viewModel"
|
||||
type="com.topjohnwu.magisk.redesign.settings.SettingsViewModel" />
|
||||
|
||||
</data>
|
||||
|
||||
<androidx.core.widget.NestedScrollView
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
adapter="@{viewModel.adapter}"
|
||||
dividerHorizontal="@{R.drawable.divider_l_50}"
|
||||
dividerVertical="@{R.drawable.divider_l_50}"
|
||||
itemBinding="@{viewModel.itemBinding}"
|
||||
items="@{viewModel.items}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusableInTouchMode="false"
|
||||
android:clipToPadding="false"
|
||||
android:fillViewport="true"
|
||||
android:orientation="vertical"
|
||||
android:paddingStart="@dimen/l1"
|
||||
android:paddingTop="@{viewModel.insets.top + (int) @dimen/internal_action_bar_size}"
|
||||
android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l2}"
|
||||
android:paddingEnd="@dimen/l_50"
|
||||
android:paddingBottom="@{viewModel.insets.bottom + (int) @dimen/l1}"
|
||||
app:layoutManager="androidx.recyclerview.widget.StaggeredGridLayoutManager"
|
||||
app:spanCount="2"
|
||||
tools:layout_marginTop="24dp"
|
||||
tools:paddingTop="@dimen/l1">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingTop="@dimen/l1">
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/settings_card_redesign"
|
||||
style="@style/WidgetFoundation.Card.Variant.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginLeft="@dimen/l1"
|
||||
android:layout_marginRight="@dimen/l1"
|
||||
android:layout_marginBottom="@dimen/l1"
|
||||
android:onClick="@{() -> viewModel.toggle(viewModel.redesign)}"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toEndOf="@+id/settings_card_theme"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:gravity="start"
|
||||
android:paddingStart="@dimen/l1"
|
||||
android:text="Redesign"
|
||||
android:textAppearance="@style/AppearanceFoundation.Body.Secondary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/settings_card_redesign_switch"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/settings_card_redesign_switch"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/l_50"
|
||||
android:checked="@={viewModel.redesign}"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/settings_card_theme"
|
||||
style="@style/WidgetFoundation.Card.Variant.Secondary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/l1"
|
||||
android:onClick="@{() -> viewModel.themePressed()}"
|
||||
app:layout_constraintEnd_toStartOf="@+id/settings_card_redesign"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/settings_card_theme_dark_icon"
|
||||
style="@style/WidgetFoundation.Icon.Secondary"
|
||||
android:background="@null"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_paint" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/settings_card_theme_dark_pointer"
|
||||
style="@style/WidgetFoundation.Icon.Secondary"
|
||||
android:background="@null"
|
||||
android:rotation="180"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_back_md2" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@null"
|
||||
android:gravity="start|center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="@string/section_theme"
|
||||
android:textAppearance="@style/AppearanceFoundation.Body.Secondary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/settings_card_theme_dark_pointer"
|
||||
app:layout_constraintStart_toEndOf="@+id/settings_card_theme_dark_icon"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</androidx.core.widget.NestedScrollView>
|
||||
tools:listitem="@layout/item_settings_toggle"
|
||||
tools:paddingTop="@dimen/l1" />
|
||||
|
||||
</layout>
|
||||
@@ -31,7 +31,7 @@
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
android:id="@+id/theme_card_dark"
|
||||
style="@style/WidgetFoundation.Card.Variant.Secondary"
|
||||
style="@style/WidgetFoundation.Card.Primary"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{() -> viewModel.darkModePressed()}"
|
||||
@@ -46,7 +46,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/settings_card_dark_icon"
|
||||
style="@style/WidgetFoundation.Icon.Secondary"
|
||||
style="@style/WidgetFoundation.Icon.OnPrimary"
|
||||
android:background="@null"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -55,7 +55,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/settings_card_dark_pointer"
|
||||
style="@style/WidgetFoundation.Icon.Secondary"
|
||||
style="@style/WidgetFoundation.Icon.OnPrimary"
|
||||
android:background="@null"
|
||||
android:rotation="180"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
@@ -71,7 +71,7 @@
|
||||
android:gravity="start|center_vertical"
|
||||
android:singleLine="true"
|
||||
android:text="@string/settings_dark_mode_title"
|
||||
android:textAppearance="@style/AppearanceFoundation.Body.Secondary"
|
||||
android:textAppearance="@style/AppearanceFoundation.Body.OnPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/settings_card_dark_pointer"
|
||||
|
||||
@@ -0,0 +1,95 @@
|
||||
<?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"
|
||||
type="com.topjohnwu.magisk.redesign.settings.SettingsItem.Blank" />
|
||||
|
||||
<variable
|
||||
name="callback"
|
||||
type="com.topjohnwu.magisk.redesign.settings.SettingsItem.Callback" />
|
||||
|
||||
</data>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/WidgetFoundation.Card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{(view) -> callback.onItemPressed(view, item)}"
|
||||
tools:layout_gravity="center">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?listPreferredItemHeightSmall"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/blank_icon"
|
||||
style="@style/WidgetFoundation.Icon"
|
||||
gone="@{item.icon == 0}"
|
||||
android:background="@null"
|
||||
android:rotation="180"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@{item.icon}"
|
||||
tools:srcCompat="@drawable/ic_fingerprint" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/blank_indicator"
|
||||
style="@style/WidgetFoundation.Icon"
|
||||
android:background="@null"
|
||||
android:rotation="180"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_back_md2" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/blank_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@{item.icon == 0 ? (int) @dimen/l1 : 0}"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/l1"
|
||||
android:paddingBottom="@dimen/l1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/blank_indicator"
|
||||
app:layout_constraintStart_toEndOf="@+id/blank_icon"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/blank_title"
|
||||
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" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/blank_description"
|
||||
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>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</layout>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools">
|
||||
|
||||
<data>
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="com.topjohnwu.magisk.redesign.settings.SettingsItem" />
|
||||
|
||||
</data>
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/l1"
|
||||
android:paddingBottom="@dimen/l_50">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
gone="@{item.title.empty}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.title}"
|
||||
android:textAppearance="@style/AppearanceFoundation.Display.Secondary"
|
||||
android:textStyle="bold"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
gone="@{item.description.empty}"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@{item.description}"
|
||||
android:textAppearance="@style/AppearanceFoundation.Tiny.Bold"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</layout>
|
||||
@@ -0,0 +1,115 @@
|
||||
<?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"
|
||||
type="com.topjohnwu.magisk.redesign.settings.SettingsItem.Selector" />
|
||||
|
||||
<variable
|
||||
name="callback"
|
||||
type="com.topjohnwu.magisk.redesign.settings.SettingsItem.Callback" />
|
||||
|
||||
</data>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/WidgetFoundation.Card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{(view) -> callback.onItemPressed(view, item)}"
|
||||
tools:layout_gravity="center">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?listPreferredItemHeightSmall"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/selector_icon"
|
||||
style="@style/WidgetFoundation.Icon"
|
||||
gone="@{item.icon == 0}"
|
||||
android:background="@null"
|
||||
android:rotation="180"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintBottom_toTopOf="@+id/selector_divider"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@{item.icon}"
|
||||
tools:srcCompat="@drawable/ic_fingerprint" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/selector_indicator"
|
||||
style="@style/WidgetFoundation.Icon"
|
||||
android:background="@null"
|
||||
android:rotation="180"
|
||||
app:layout_constraintBottom_toTopOf="@+id/selector_divider"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@drawable/ic_back_md2" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/selector_text"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/l1"
|
||||
android:paddingBottom="@dimen/l1"
|
||||
app:layout_constraintBottom_toTopOf="@+id/selector_divider"
|
||||
app:layout_constraintEnd_toStartOf="@+id/selector_indicator"
|
||||
app:layout_constraintStart_toEndOf="@+id/selector_icon"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/selector_title"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@{item.icon == 0 ? (int) @dimen/l1 : 0}"
|
||||
android:gravity="start"
|
||||
android:text="@{item.title}"
|
||||
android:textAppearance="@style/AppearanceFoundation.Body"
|
||||
android:textStyle="bold"
|
||||
tools:lines="1"
|
||||
tools:text="@tools:sample/lorem/random" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/selector_description"
|
||||
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>
|
||||
|
||||
<View
|
||||
android:id="@+id/selector_divider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1.25dp"
|
||||
android:background="?colorOnSurfaceVariant"
|
||||
app:layout_constraintTop_toBottomOf="@+id/selector_text" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/selector_selection"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_margin="@dimen/l1"
|
||||
android:textAppearance="@style/AppearanceFoundation.Caption.Variant"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="@+id/selector_text"
|
||||
app:layout_constraintTop_toBottomOf="@+id/selector_divider"
|
||||
tools:text="@tools:sample/lorem" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</layout>
|
||||
@@ -0,0 +1,99 @@
|
||||
<?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>
|
||||
|
||||
<import type="com.topjohnwu.magisk.R" />
|
||||
|
||||
<variable
|
||||
name="item"
|
||||
type="com.topjohnwu.magisk.redesign.settings.SettingsItem.Toggle" />
|
||||
|
||||
<variable
|
||||
name="callback"
|
||||
type="com.topjohnwu.magisk.redesign.settings.SettingsItem.Callback" />
|
||||
|
||||
</data>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/WidgetFoundation.Card"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{(view) -> item.onPressed(view, callback)}"
|
||||
tools:layout_gravity="center">
|
||||
|
||||
<androidx.constraintlayout.widget.ConstraintLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:minHeight="?listPreferredItemHeightSmall"
|
||||
android:orientation="vertical">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/toggle_icon"
|
||||
style="@style/WidgetFoundation.Icon"
|
||||
gone="@{item.icon == 0}"
|
||||
android:background="@null"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:srcCompat="@{item.icon}"
|
||||
tools:srcCompat="@drawable/ic_fingerprint" />
|
||||
|
||||
<com.google.android.material.switchmaterial.SwitchMaterial
|
||||
android:id="@+id/toggle_indicator"
|
||||
style="@style/WidgetFoundation.Switch"
|
||||
onTouch="@{(view, event) -> item.onTouched(view, callback, event)}"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginEnd="@dimen/l_25"
|
||||
android:checked="@{item.value}"
|
||||
android:text=""
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@{item.icon == 0 ? (int) @dimen/l1 : 0}"
|
||||
android:layout_marginEnd="@dimen/l_50"
|
||||
android:gravity="center_vertical"
|
||||
android:orientation="vertical"
|
||||
android:paddingTop="@dimen/l1"
|
||||
android:paddingBottom="@dimen/l1"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/toggle_indicator"
|
||||
app:layout_constraintStart_toEndOf="@+id/toggle_icon"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/toggle_title"
|
||||
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" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/toggle_description"
|
||||
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>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
||||
</com.google.android.material.card.MaterialCardView>
|
||||
|
||||
</layout>
|
||||
@@ -16,7 +16,7 @@
|
||||
</data>
|
||||
|
||||
<com.google.android.material.card.MaterialCardView
|
||||
style="@style/WidgetFoundation.Card.Variant.Secondary"
|
||||
style="@style/WidgetFoundation.Card.Primary"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:onClick="@{() -> listener.onItemPressed(item)}"
|
||||
@@ -28,7 +28,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/tappable_icon"
|
||||
style="@style/WidgetFoundation.Icon.Secondary"
|
||||
style="@style/WidgetFoundation.Icon.OnPrimary"
|
||||
android:background="@null"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
@@ -42,7 +42,7 @@
|
||||
android:requiresFadingEdge="horizontal"
|
||||
android:singleLine="true"
|
||||
android:text="@{item.title}"
|
||||
android:textAppearance="@style/AppearanceFoundation.Body.Secondary"
|
||||
android:textAppearance="@style/AppearanceFoundation.Body.OnPrimary"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toStartOf="@+id/headline_icon_pointer"
|
||||
@@ -52,7 +52,7 @@
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/headline_icon_pointer"
|
||||
style="@style/WidgetFoundation.Icon.Secondary"
|
||||
style="@style/WidgetFoundation.Icon.OnPrimary"
|
||||
android:background="@null"
|
||||
android:rotation="180"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -6,6 +6,10 @@
|
||||
<item name="android:textColor">?attr/colorOnSurface</item>
|
||||
</style>
|
||||
|
||||
<style name="AppearanceFoundation.Display.Secondary">
|
||||
<item name="android:textColor">?colorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="AppearanceFoundation.Display.Variant">
|
||||
<item name="android:textColor">?attr/colorOnSurfaceVariant</item>
|
||||
</style>
|
||||
@@ -74,6 +78,14 @@
|
||||
<item name="android:textColor">?attr/colorOnSurfaceVariant</item>
|
||||
</style>
|
||||
|
||||
<style name="AppearanceFoundation.Caption.Primary">
|
||||
<item name="android:textColor">?attr/colorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="AppearanceFoundation.Caption.Secondary">
|
||||
<item name="android:textColor">?attr/colorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="AppearanceFoundation.Caption.OnPrimary">
|
||||
<item name="android:textColor">?attr/colorOnPrimary</item>
|
||||
</style>
|
||||
|
||||
@@ -42,10 +42,6 @@
|
||||
<item name="strokeColor">?colorPrimary</item>
|
||||
</style>
|
||||
|
||||
<style name="WidgetFoundation.Card.Variant.Secondary">
|
||||
<item name="strokeColor">?colorSecondary</item>
|
||||
</style>
|
||||
|
||||
<style name="WidgetFoundation.Card.Elevated" parent="Widget.MaterialComponents.CardView">
|
||||
<item name="cardBackgroundColor">?colorSurfaceSurfaceVariant</item>
|
||||
<item name="cardCornerRadius">@dimen/l_50</item>
|
||||
@@ -202,4 +198,9 @@
|
||||
<item name="android:layout_width">wrap_content</item>
|
||||
</style>
|
||||
|
||||
|
||||
<style name="WidgetFoundation.Switch" parent="Widget.AppCompat.CompoundButton.Switch">
|
||||
<item name="thumbTint">@color/color_primary_transient</item>
|
||||
</style>
|
||||
|
||||
</resources>
|
||||
Reference in New Issue
Block a user