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()
}
}