Updated indication of whether the module is enabled

This commit is contained in:
Viktor De Pasquale 2020-01-04 16:24:44 +01:00
parent 8737be2623
commit bc0bb92f7a
3 changed files with 15 additions and 0 deletions

View File

@ -2,6 +2,7 @@ package com.topjohnwu.magisk.utils
import android.animation.Animator
import android.animation.ValueAnimator
import android.graphics.Paint
import android.graphics.drawable.Drawable
import android.os.Build
import android.view.View
@ -456,4 +457,13 @@ fun View.setOnLongClickListenerBinding(listener: () -> Unit) {
listener()
true
}
}
@BindingAdapter("strikeThrough")
fun TextView.setStrikeThroughEnabled(useStrikeThrough: Boolean) {
paintFlags = if (useStrikeThrough) {
paintFlags or Paint.STRIKE_THRU_TEXT_FLAG
} else {
paintFlags and Paint.STRIKE_THRU_TEXT_FLAG.inv()
}
}

View File

@ -49,6 +49,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/module_title"
strikeThrough="@{!item.enabled}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
@ -64,6 +65,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/module_version_author"
strikeThrough="@{!item.enabled}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"
@ -78,6 +80,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/module_description"
gone="@{item.item.description.empty}"
strikeThrough="@{!item.enabled}"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/l1"

View File

@ -63,6 +63,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/policy_app_name"
strikeThrough="@{!item.enabled}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginLeft="@dimen/margin_generic"
@ -81,6 +82,7 @@
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/policy_package_name"
strikeThrough="@{!item.enabled}"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/l1"