mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-02-27 08:27:23 +00:00

The switch is not actually a switch, but a representation of internal state, the layouts continue to accept touch events as beforehand.
199 lines
9.8 KiB
XML
199 lines
9.8 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>
|
|
|
|
<variable
|
|
name="item"
|
|
type="com.topjohnwu.magisk.model.entity.recycler.PolicyItem" />
|
|
|
|
<variable
|
|
name="viewModel"
|
|
type="com.topjohnwu.magisk.ui.superuser.SuperuserViewModel" />
|
|
|
|
</data>
|
|
|
|
<com.google.android.material.card.MaterialCardView
|
|
style="@style/WidgetFoundation.Card.Variant"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="wrap_content"
|
|
android:layout_gravity="center"
|
|
android:alpha="@{item.isEnabled() ? 1f : .5f}"
|
|
android:onClick="@{() -> item.toggle(viewModel)}"
|
|
android:onLongClick="@{() -> item.toggle()}"
|
|
tools:layout_marginBottom="@dimen/l1"
|
|
tools:layout_marginEnd="@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">
|
|
|
|
<androidx.appcompat.widget.AppCompatImageView
|
|
android:id="@+id/policy_app_icon"
|
|
style="@style/WidgetFoundation.Image"
|
|
android:layout_marginStart="@dimen/l1"
|
|
android:layout_marginTop="@dimen/l1"
|
|
android:layout_marginBottom="@dimen/l1"
|
|
android:src="@{item.icon}"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
app:layout_constraintVertical_bias="0"
|
|
tools:srcCompat="@drawable/ic_logo" />
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
|
android:id="@+id/policy_app_name"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginLeft="@dimen/margin_generic"
|
|
android:layout_marginRight="@dimen/margin_generic"
|
|
android:ellipsize="middle"
|
|
android:gravity="start"
|
|
android:maxLines="2"
|
|
android:text="@{item.item.appName}"
|
|
android:textAppearance="@style/AppearanceFoundation.Body"
|
|
android:textIsSelectable="false"
|
|
android:textStyle="bold"
|
|
app:layout_constraintEnd_toStartOf="@+id/policy_indicator"
|
|
app:layout_constraintStart_toEndOf="@+id/policy_app_icon"
|
|
app:layout_constraintTop_toTopOf="@+id/policy_app_icon"
|
|
tools:text="@string/app_name" />
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
|
android:id="@+id/policy_package_name"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:layout_marginBottom="@dimen/l1"
|
|
android:ellipsize="middle"
|
|
android:gravity="start"
|
|
android:maxLines="2"
|
|
android:text="@{item.item.packageName}"
|
|
android:textAppearance="@style/AppearanceFoundation.Caption.Variant"
|
|
android:textColor="@android:color/tertiary_text_dark"
|
|
android:textIsSelectable="false"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintEnd_toEndOf="@id/policy_app_name"
|
|
app:layout_constraintStart_toStartOf="@id/policy_app_name"
|
|
app:layout_constraintTop_toBottomOf="@id/policy_app_name"
|
|
app:layout_constraintVertical_bias="0"
|
|
tools:text="com.topjohnwu.magisk" />
|
|
|
|
<androidx.appcompat.widget.AppCompatImageView
|
|
android:id="@+id/policy_indicator"
|
|
style="@style/WidgetFoundation.Switch"
|
|
isSelected="@{item.enabled}"
|
|
android:layout_marginEnd="@dimen/l1"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent" />
|
|
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
|
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
android:id="@+id/policy_expand_container"
|
|
gone="@{!item.isExpanded}"
|
|
android:layout_width="match_parent"
|
|
android:layout_height="match_parent"
|
|
android:background="?colorSurfaceVariant"
|
|
android:visibility="gone"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toBottomOf="@+id/policy_package_name"
|
|
tools:visibility="visible">
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/policy_notify"
|
|
style="@style/WidgetFoundation.Button.Text"
|
|
isSelected="@{item.shouldNotify}"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:minHeight="24dp"
|
|
android:onClick="@{() -> item.toggleNotify(viewModel)}"
|
|
android:text="@string/superuser_toggle_notification"
|
|
android:textAllCaps="false"
|
|
android:textAppearance="@style/AppearanceFoundation.Tiny"
|
|
android:textColor="@color/color_state_primary_transient"
|
|
app:icon="@drawable/ic_notifications_md2"
|
|
app:iconTint="@color/color_state_primary_transient"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintEnd_toStartOf="@+id/policy_log"
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
app:tint="@color/color_state_primary_transient" />
|
|
|
|
<View
|
|
android:layout_width="1dp"
|
|
android:layout_height="0dp"
|
|
android:layout_marginTop="@dimen/l_50"
|
|
android:layout_marginBottom="@dimen/l_50"
|
|
android:background="?colorSurface"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintStart_toEndOf="@+id/policy_notify"
|
|
app:layout_constraintTop_toTopOf="parent" />
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/policy_log"
|
|
style="@style/WidgetFoundation.Button.Text"
|
|
isSelected="@{item.shouldLog}"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:minHeight="24dp"
|
|
android:onClick="@{() -> item.toggleLog(viewModel)}"
|
|
android:text="@string/logs"
|
|
android:textAllCaps="false"
|
|
android:textAppearance="@style/AppearanceFoundation.Tiny"
|
|
android:textColor="@color/color_state_primary_transient"
|
|
app:icon="@drawable/ic_bug_md2"
|
|
app:iconTint="@color/color_state_primary_transient"
|
|
app:layout_constrainedWidth="true"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintEnd_toStartOf="@+id/policy_delete"
|
|
app:layout_constraintStart_toEndOf="@+id/policy_notify"
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
app:tint="@color/color_state_primary_transient" />
|
|
|
|
<View
|
|
android:layout_width="1dp"
|
|
android:layout_height="0dp"
|
|
android:layout_marginTop="@dimen/l_50"
|
|
android:layout_marginBottom="@dimen/l_50"
|
|
android:background="?colorSurface"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintStart_toEndOf="@+id/policy_log"
|
|
app:layout_constraintTop_toTopOf="parent" />
|
|
|
|
<com.google.android.material.button.MaterialButton
|
|
android:id="@+id/policy_delete"
|
|
style="@style/WidgetFoundation.Button.Text"
|
|
android:layout_width="0dp"
|
|
android:layout_height="wrap_content"
|
|
android:minHeight="24dp"
|
|
android:onClick="@{() -> viewModel.deletePressed(item)}"
|
|
android:text="@string/superuser_toggle_revoke"
|
|
android:textAllCaps="false"
|
|
android:textColor="?colorError"
|
|
android:textSize="12sp"
|
|
app:icon="@drawable/ic_delete_md2"
|
|
app:iconTint="?colorError"
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
app:layout_constraintStart_toEndOf="@+id/policy_log"
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
app:rippleColor="?colorError" />
|
|
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
|
|
</LinearLayout>
|
|
|
|
</com.google.android.material.card.MaterialCardView>
|
|
|
|
</layout>
|