2019-10-18 19:38:55 +02: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>
|
|
|
|
|
|
|
|
<variable
|
|
|
|
name="item"
|
2019-11-01 17:58:42 +01:00
|
|
|
type="com.topjohnwu.magisk.model.entity.recycler.PolicyItem" />
|
2019-10-18 19:38:55 +02:00
|
|
|
|
|
|
|
<variable
|
|
|
|
name="viewModel"
|
|
|
|
type="com.topjohnwu.magisk.redesign.superuser.SuperuserViewModel" />
|
|
|
|
|
|
|
|
</data>
|
|
|
|
|
|
|
|
<com.google.android.material.card.MaterialCardView
|
2019-10-19 21:07:06 +02:00
|
|
|
style="?styleCardVariant"
|
2019-10-18 19:38:55 +02:00
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
android:layout_gravity="center"
|
|
|
|
android:alpha="@{item.isEnabled() ? 1f : .5f}"
|
2019-11-01 17:58:42 +01:00
|
|
|
android:onClick="@{() -> item.toggle(viewModel)}"
|
2019-10-18 19:38:55 +02:00
|
|
|
tools:layout_marginBottom="@dimen/l1"
|
2019-11-01 18:12:52 +01:00
|
|
|
tools:layout_marginEnd="@dimen/l1"
|
|
|
|
tools:layout_width="200dp">
|
2019-10-18 19:38:55 +02:00
|
|
|
|
|
|
|
<androidx.constraintlayout.widget.ConstraintLayout
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="match_parent"
|
|
|
|
android:paddingTop="@dimen/l2"
|
|
|
|
android:paddingBottom="@dimen/l2">
|
|
|
|
|
|
|
|
<androidx.appcompat.widget.AppCompatImageView
|
2019-11-01 21:10:00 +01:00
|
|
|
android:id="@+id/policy_app_icon"
|
2019-10-18 19:38:55 +02:00
|
|
|
style="?styleImageBig"
|
|
|
|
android:src="@{item.icon}"
|
|
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
|
|
tools:srcCompat="@drawable/ic_logo" />
|
|
|
|
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
2019-11-01 21:10:00 +01:00
|
|
|
android:id="@+id/policy_app_name"
|
2019-10-18 19:38:55 +02:00
|
|
|
android:layout_width="0dp"
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
android:layout_marginLeft="@dimen/margin_generic"
|
|
|
|
android:layout_marginTop="@dimen/l1"
|
|
|
|
android:layout_marginRight="@dimen/margin_generic"
|
|
|
|
android:ellipsize="middle"
|
|
|
|
android:gravity="center"
|
|
|
|
android:singleLine="true"
|
|
|
|
android:text="@{item.item.appName}"
|
|
|
|
android:textAppearance="?appearanceTextTitleNormal"
|
|
|
|
android:textIsSelectable="false"
|
|
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
|
|
app:layout_constraintStart_toStartOf="parent"
|
2019-11-01 21:10:00 +01:00
|
|
|
app:layout_constraintTop_toBottomOf="@+id/policy_app_icon"
|
2019-10-18 19:38:55 +02:00
|
|
|
tools:text="@string/app_name" />
|
|
|
|
|
|
|
|
<androidx.appcompat.widget.AppCompatTextView
|
2019-11-01 21:10:00 +01:00
|
|
|
android:id="@+id/policy_package_name"
|
2019-10-18 19:38:55 +02:00
|
|
|
android:layout_width="0dp"
|
|
|
|
android:layout_height="wrap_content"
|
|
|
|
android:ellipsize="middle"
|
|
|
|
android:gravity="center"
|
|
|
|
android:singleLine="true"
|
|
|
|
android:text="@{item.item.packageName}"
|
|
|
|
android:textAppearance="?appearanceTextCaptionVariant"
|
|
|
|
android:textColor="@android:color/tertiary_text_dark"
|
|
|
|
android:textIsSelectable="false"
|
|
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
2019-11-01 21:10:00 +01:00
|
|
|
app:layout_constraintEnd_toEndOf="@id/policy_app_name"
|
|
|
|
app:layout_constraintStart_toStartOf="@id/policy_app_name"
|
|
|
|
app:layout_constraintTop_toBottomOf="@id/policy_app_name"
|
2019-10-18 19:38:55 +02:00
|
|
|
tools:text="com.topjohnwu.magisk" />
|
|
|
|
|
|
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
|
|
|
|
|
|
<androidx.constraintlayout.widget.ConstraintLayout
|
2019-11-01 21:10:00 +01:00
|
|
|
android:id="@+id/policy_expand_container"
|
2019-10-18 19:38:55 +02:00
|
|
|
revealFix="@{item.isExpanded()}"
|
|
|
|
android:layout_width="match_parent"
|
|
|
|
android:layout_height="match_parent"
|
2019-11-01 21:10:00 +01:00
|
|
|
app:layout_constraintTop_toBottomOf="@+id/policy_package_name"
|
2019-10-19 21:07:06 +02:00
|
|
|
android:background="?colorSurfaceVariant"
|
2019-10-18 19:38:55 +02:00
|
|
|
android:visibility="invisible"
|
|
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
|
|
app:layout_constraintStart_toStartOf="parent"
|
2019-11-01 21:10:00 +01:00
|
|
|
tools:alpha="0.9"
|
2019-11-01 18:12:52 +01:00
|
|
|
tools:visibility="visible">
|
2019-10-18 19:38:55 +02:00
|
|
|
|
|
|
|
<androidx.appcompat.widget.AppCompatImageView
|
2019-11-01 21:10:00 +01:00
|
|
|
android:id="@+id/policy_notify"
|
2019-10-18 19:38:55 +02:00
|
|
|
style="?styleIconNormal"
|
2019-11-01 21:10:00 +01:00
|
|
|
android:background="?selectableItemBackground"
|
2019-10-18 19:38:55 +02:00
|
|
|
isSelected="@{item.shouldNotify}"
|
2019-11-01 18:12:52 +01:00
|
|
|
tooltipText="@{@string/superuser_toggle_notification}"
|
|
|
|
android:contentDescription="@string/superuser_toggle_notification"
|
2019-11-01 17:58:42 +01:00
|
|
|
android:onClick="@{() -> item.toggleNotify(viewModel)}"
|
2019-11-01 21:10:00 +01:00
|
|
|
app:layout_constraintBottom_toTopOf="@+id/policy_delete"
|
|
|
|
app:layout_constraintEnd_toStartOf="@+id/policy_log"
|
2019-10-18 19:38:55 +02:00
|
|
|
app:layout_constraintHorizontal_chainStyle="packed"
|
|
|
|
app:layout_constraintStart_toStartOf="parent"
|
|
|
|
app:layout_constraintTop_toTopOf="parent"
|
|
|
|
app:layout_constraintVertical_chainStyle="packed"
|
|
|
|
app:srcCompat="@drawable/ic_notifications"
|
2019-11-01 21:10:00 +01:00
|
|
|
app:tint="@color/color_state_primary_transient" />
|
2019-10-18 19:38:55 +02:00
|
|
|
|
|
|
|
<androidx.appcompat.widget.AppCompatImageView
|
2019-11-01 21:10:00 +01:00
|
|
|
android:id="@+id/policy_log"
|
2019-10-18 19:38:55 +02:00
|
|
|
style="?styleIconNormal"
|
2019-11-01 21:10:00 +01:00
|
|
|
android:background="?selectableItemBackground"
|
2019-10-18 19:38:55 +02:00
|
|
|
isSelected="@{item.shouldLog}"
|
2019-11-01 18:12:52 +01:00
|
|
|
tooltipText="@{@string/superuser_toggle_log}"
|
|
|
|
android:contentDescription="@string/superuser_toggle_log"
|
2019-11-01 17:58:42 +01:00
|
|
|
android:onClick="@{() -> item.toggleLog(viewModel)}"
|
2019-11-01 21:10:00 +01:00
|
|
|
app:layout_constraintBottom_toBottomOf="@+id/policy_notify"
|
2019-10-18 19:38:55 +02:00
|
|
|
app:layout_constraintEnd_toEndOf="parent"
|
2019-11-01 21:10:00 +01:00
|
|
|
app:layout_constraintStart_toEndOf="@+id/policy_notify"
|
|
|
|
app:layout_constraintTop_toTopOf="@+id/policy_notify"
|
2019-10-18 19:38:55 +02:00
|
|
|
app:srcCompat="@drawable/ic_bug_report"
|
2019-11-01 21:10:00 +01:00
|
|
|
app:tint="@color/color_state_primary_transient" />
|
2019-10-18 19:38:55 +02:00
|
|
|
|
2019-11-01 18:12:52 +01:00
|
|
|
<com.google.android.material.button.MaterialButton
|
2019-11-01 21:10:00 +01:00
|
|
|
android:id="@+id/policy_delete"
|
2019-11-01 18:12:52 +01:00
|
|
|
style="?styleButtonText"
|
|
|
|
android:layout_width="wrap_content"
|
|
|
|
android:layout_height="wrap_content"
|
2019-10-18 19:38:55 +02:00
|
|
|
android:onClick="@{() -> viewModel.deletePressed(item)}"
|
2019-11-01 18:12:52 +01:00
|
|
|
android:text="@string/superuser_toggle_revoke"
|
|
|
|
android:textAllCaps="false"
|
|
|
|
android:textColor="?colorError"
|
|
|
|
android:textSize="12sp"
|
|
|
|
app:icon="@drawable/ic_delete_md2"
|
|
|
|
app:iconTint="?colorError"
|
2019-10-18 19:38:55 +02:00
|
|
|
app:layout_constraintBottom_toBottomOf="parent"
|
|
|
|
app:layout_constraintEnd_toEndOf="parent"
|
|
|
|
app:layout_constraintStart_toStartOf="parent"
|
2019-11-01 21:10:00 +01:00
|
|
|
app:layout_constraintTop_toBottomOf="@+id/policy_notify"
|
2019-11-01 18:12:52 +01:00
|
|
|
app:rippleColor="?colorError" />
|
2019-10-18 19:38:55 +02:00
|
|
|
|
|
|
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
|
|
|
|
|
|
|
<androidx.appcompat.widget.AppCompatImageView
|
|
|
|
style="?styleIconNormal"
|
|
|
|
isEnabled="@{item.isEnabled}"
|
|
|
|
isSelected="@{item.isExpanded}"
|
|
|
|
android:layout_gravity="top|end"
|
|
|
|
android:onClick="@{(view) -> item.toggle(view)}"
|
2019-11-05 19:38:02 +01:00
|
|
|
android:rotation="@{item.isExpanded ? 225 : 180}"
|
2019-10-18 19:38:55 +02:00
|
|
|
app:srcCompat="@drawable/ic_more_collapse" />
|
|
|
|
|
|
|
|
</com.google.android.material.card.MaterialCardView>
|
|
|
|
|
|
|
|
</layout>
|