2019-11-05 19:38:02 +01:00
|
|
|
<?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>
|
|
|
|
|
2019-11-06 17:09:00 +01:00
|
|
|
<import type="com.topjohnwu.magisk.R" />
|
|
|
|
|
2019-11-05 19:38:02 +01:00
|
|
|
<import type="com.topjohnwu.magisk.Config" />
|
|
|
|
|
|
|
|
<variable
|
|
|
|
name="item"
|
|
|
|
type="com.topjohnwu.magisk.model.entity.recycler.ModuleItem" />
|
|
|
|
|
|
|
|
<variable
|
|
|
|
name="viewModel"
|
|
|
|
type="com.topjohnwu.magisk.redesign.module.ModuleViewModel" />
|
|
|
|
|
|
|
|
</data>
|
|
|
|
|
|
|
|
<com.google.android.material.card.MaterialCardView
|
|
|
|
style="?styleCardVariant"
|
2019-11-06 17:37:18 +01:00
|
|
|
isEnabled="@{!Config.coreOnly && !item.removed}"
|
2019-11-05 19:38:02 +01:00
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="wrap_content"
|
2019-11-06 17:37:18 +01:00
|
|
|
android:alpha="@{item.enabled && !Config.coreOnly ? 1f : .5f}"
|
|
|
|
android:onClick="@{() -> item.toggle()}"
|
2019-11-05 19:38:02 +01:00
|
|
|
tools:layout_gravity="center"
|
|
|
|
tools:layout_marginBottom="@dimen/l1"
|
|
|
|
tools:layout_marginEnd="@dimen/l1">
|
|
|
|
|
|
|
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
|
|
android:layout_width="match_parent"
|
2019-11-08 19:19:19 +01:00
|
|
|
android:layout_height="wrap_content">
|
2019-11-05 19:38:02 +01:00
|
|
|
|
2019-11-06 17:09:00 +01:00
|
|
|
<androidx.appcompat.widget.AppCompatImageView
|
|
|
|
android:id="@+id/module_state_icon"
|
|
|
|
style="?styleImageSmall"
|
2019-11-06 17:37:18 +01:00
|
|
|
gone="@{!item.removed && !item.updated}"
|
|
|
|
srcCompat="@{item.removed ? R.drawable.ic_delete_md2 : R.drawable.ic_update_md2}"
|
2019-11-06 17:09:00 +01:00
|
|
|
android:layout_marginStart="@dimen/l1"
|
|
|
|
android:background="@null"
|
|
|
|
app:layout_constraintBottom_toBottomOf="@+id/module_version_author"
|
|
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
|
|
app:layout_constraintTop_toTopOf="@+id/module_title"
|
|
|
|
tools:srcCompat="@drawable/ic_update_md2" />
|
|
|
|
|
2019-11-05 19:38:02 +01:00
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
|
|
|
android:id="@+id/module_title"
|
2019-11-06 17:09:00 +01:00
|
|
|
android:layout_width="0dp"
|
2019-11-05 19:38:02 +01:00
|
|
|
android:layout_height="wrap_content"
|
|
|
|
android:layout_marginStart="@dimen/l1"
|
|
|
|
android:layout_marginTop="@dimen/l1"
|
2019-11-08 19:19:19 +01:00
|
|
|
android:layout_marginEnd="@dimen/l1"
|
2019-11-05 19:38:02 +01:00
|
|
|
android:text="@{item.item.name}"
|
|
|
|
android:textAppearance="?appearanceTextBodyNormal"
|
|
|
|
android:textStyle="bold"
|
2019-11-08 19:19:19 +01:00
|
|
|
app:layout_constraintEnd_toEndOf="parent"
|
2019-11-06 17:09:00 +01:00
|
|
|
app:layout_constraintStart_toEndOf="@+id/module_state_icon"
|
2019-11-05 19:38:02 +01:00
|
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
|
|
tools:text="@tools:sample/lorem" />
|
|
|
|
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
|
|
|
android:id="@+id/module_version_author"
|
2019-11-06 17:09:00 +01:00
|
|
|
android:layout_width="0dp"
|
2019-11-05 19:38:02 +01:00
|
|
|
android:layout_height="wrap_content"
|
|
|
|
android:layout_marginStart="@dimen/l1"
|
2019-11-08 19:19:19 +01:00
|
|
|
android:layout_marginEnd="@dimen/l1"
|
2019-11-05 19:38:02 +01:00
|
|
|
android:text="@{@string/module_version_author(item.item.version, item.item.author)}"
|
|
|
|
android:textAppearance="?appearanceTextCaptionVariant"
|
2019-11-08 19:19:19 +01:00
|
|
|
app:layout_constraintEnd_toEndOf="parent"
|
2019-11-06 17:09:00 +01:00
|
|
|
app:layout_constraintStart_toEndOf="@+id/module_state_icon"
|
2019-11-05 19:38:02 +01:00
|
|
|
app:layout_constraintTop_toBottomOf="@+id/module_title"
|
|
|
|
tools:text="v1 by topjohnwu" />
|
|
|
|
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
2019-11-08 19:19:19 +01:00
|
|
|
android:id="@+id/module_description"
|
2019-11-05 19:38:02 +01:00
|
|
|
gone="@{item.item.description.empty}"
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
android:layout_marginStart="@dimen/l1"
|
|
|
|
android:layout_marginTop="@dimen/l1"
|
|
|
|
android:layout_marginEnd="@dimen/l1"
|
|
|
|
android:text="@{item.item.description}"
|
|
|
|
android:textAppearance="?appearanceTextCaptionVariant"
|
|
|
|
app:layout_constraintTop_toBottomOf="@+id/module_version_author"
|
|
|
|
tools:lines="4"
|
|
|
|
tools:text="@tools:sample/lorem/random" />
|
|
|
|
|
2019-11-08 19:19:19 +01:00
|
|
|
<View
|
|
|
|
android:id="@+id/module_divider"
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="1dp"
|
|
|
|
android:layout_marginTop="@dimen/l1"
|
|
|
|
android:background="?colorSurfaceVariant"
|
|
|
|
app:layout_constraintTop_toBottomOf="@+id/module_description" />
|
|
|
|
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
|
|
style="?styleButtonText"
|
|
|
|
android:layout_width="wrap_content"
|
|
|
|
android:layout_height="wrap_content"
|
2019-11-06 17:09:00 +01:00
|
|
|
android:onClick="@{(v) -> item.delete(viewModel)}"
|
2019-11-08 19:19:19 +01:00
|
|
|
android:text="@{item.removed ? `Restore` : `Remove`}"
|
|
|
|
android:textAllCaps="false"
|
|
|
|
app:icon="@{item.removed ? R.drawable.ic_restart : R.drawable.ic_delete_md2}"
|
|
|
|
app:iconGravity="textEnd"
|
|
|
|
app:iconPadding="@dimen/l_50"
|
2019-11-06 17:09:00 +01:00
|
|
|
app:layout_constraintEnd_toEndOf="parent"
|
2019-11-08 19:19:19 +01:00
|
|
|
app:layout_constraintTop_toBottomOf="@+id/module_divider"
|
|
|
|
tools:icon="@drawable/ic_delete_md2"
|
|
|
|
tools:text="Remove" />
|
2019-11-05 19:38:02 +01:00
|
|
|
|
2019-11-06 17:09:00 +01:00
|
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
2019-11-05 19:38:02 +01:00
|
|
|
|
|
|
|
</com.google.android.material.card.MaterialCardView>
|
|
|
|
|
|
|
|
|
|
|
|
</layout>
|