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

132 lines
6.2 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"
xmlns:tools="http://schemas.android.com/tools">
<data>
<import type="com.topjohnwu.magisk.R" />
<variable
name="item"
type="com.topjohnwu.magisk.model.entity.recycler.HideItem" />
<variable
name="viewModel"
type="com.topjohnwu.magisk.redesign.hide.HideViewModel" />
</data>
<com.google.android.material.card.MaterialCardView
style="@style/WidgetFoundation.Card.Variant"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:layout_gravity="center"
tools:layout_marginBottom="@dimen/l1">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?selectableItemBackground"
android:onClick="@{(v) -> item.toggle(v)}">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/hide_icon"
style="@style/WidgetFoundation.Image"
android:layout_margin="@dimen/l1"
android:alpha="@{item.isExpanded ? 0.1f : 1f}"
android:src="@{item.item.info.icon}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_bias="0"
tools:src="@drawable/ic_magisk" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/hide_action"
style="@style/WidgetFoundation.Image"
isSelected="@{item.itemsCheckedPercent == 100}"
goneUnless="@{item.isExpanded}"
android:layout_margin="@dimen/l1"
android:background="?selectableItemBackgroundBorderless"
android:onClick="@{() -> item.toggle(viewModel)}"
android:padding="@dimen/l_25"
app:layout_constraintBottom_toBottomOf="@+id/hide_icon"
app:layout_constraintEnd_toEndOf="@+id/hide_icon"
app:layout_constraintStart_toStartOf="@+id/hide_icon"
app:layout_constraintTop_toTopOf="@+id/hide_icon"
app:srcCompat="@drawable/ic_hide_select_md2" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/hide_name"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
android:ellipsize="middle"
android:singleLine="true"
android:text="@{item.item.info.name}"
android:textAppearance="@style/AppearanceFoundation.Body"
android:textStyle="bold"
app:layout_constraintBottom_toTopOf="@+id/hide_package"
app:layout_constraintEnd_toStartOf="@+id/hide_expand_icon"
app:layout_constraintStart_toEndOf="@+id/hide_icon"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintVertical_chainStyle="packed"
tools:text="@string/app_name" />
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/hide_package"
gone="@{item.item.info.info.packageName.empty}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:text="@{item.item.info.info.packageName}"
android:textAppearance="@style/AppearanceFoundation.Caption.Variant"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/hide_name"
app:layout_constraintStart_toStartOf="@+id/hide_name"
app:layout_constraintTop_toBottomOf="@+id/hide_name"
tools:text="com.topjohnwu.magisk" />
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/hide_expand_icon"
style="@style/WidgetFoundation.Icon"
invisible="@{item.item.processes.empty}"
srcCompat="@{item.isExpanded ? R.drawable.ic_close : R.drawable.ic_back_md2}"
android:background="@null"
android:rotation="180"
android:rotationX="@{item.isExpanded ? 180 : 0}"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:srcCompat="@drawable/ic_back_md2" />
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.recyclerview.widget.RecyclerView
goneUnless="@{item.isExpanded}"
itemBinding="@{viewModel.itemInternalBinding}"
items="@{item.items}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="?colorSurfaceVariant"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"
tools:itemCount="2"
tools:listitem="@layout/item_hide_process_md2" />
</LinearLayout>
<ProgressBar
style="@style/WidgetFoundation.ProgressBar"
android:layout_width="match_parent"
android:layout_gravity="top"
android:progress="@{item.itemsCheckedPercent}" />
</com.google.android.material.card.MaterialCardView>
</layout>