mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-25 10:47:38 +00:00
Added tiny hint that magisk can be uninstalled using the icon
This commit is contained in:
parent
4cfff40475
commit
6a2acbe929
@ -253,9 +253,21 @@ fun TextInputLayout.setErrorString(error: String) {
|
||||
|
||||
@BindingAdapter("onSelectClick", "onSelectReset", requireAll = false)
|
||||
fun View.setOnSelectClickListener(listener: View.OnClickListener, resetTime: Long) {
|
||||
|
||||
fun getHideTarget() = (parent as? ViewGroup)?.findViewWithTag<View>(R.id.hideWhenSelected)
|
||||
fun animateVisibility(hide: Boolean, target: View? = getHideTarget()) {
|
||||
target ?: return
|
||||
val targetScale = if (hide) 0f else 1f
|
||||
target.animate()
|
||||
.scaleY(targetScale)
|
||||
.scaleX(targetScale)
|
||||
.start()
|
||||
}
|
||||
|
||||
setOnClickListener {
|
||||
when {
|
||||
it.isSelected -> {
|
||||
animateVisibility(false)
|
||||
listener.onClick(it)
|
||||
(it.tag as? Runnable)?.let { task ->
|
||||
it.handler.removeCallbacks(task)
|
||||
@ -263,8 +275,10 @@ fun View.setOnSelectClickListener(listener: View.OnClickListener, resetTime: Lon
|
||||
it.isSelected = false
|
||||
}
|
||||
else -> {
|
||||
animateVisibility(true)
|
||||
it.isSelected = true
|
||||
it.tag = it.postDelayed(resetTime) {
|
||||
animateVisibility(false)
|
||||
it.tag = null
|
||||
it.isSelected = false
|
||||
}
|
||||
|
@ -334,6 +334,15 @@
|
||||
app:srcCompat="@drawable/ic_magisk_delete"
|
||||
app:tint="@color/color_primary_error_transient" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:layout_width="@dimen/l1"
|
||||
android:layout_height="@dimen/l1"
|
||||
android:tag="@{@id/hideWhenSelected}"
|
||||
app:layout_constraintEnd_toEndOf="@+id/home_magisk_icon"
|
||||
app:layout_constraintTop_toTopOf="@+id/home_magisk_icon"
|
||||
app:srcCompat="@drawable/ic_delete_md2"
|
||||
app:tint="?colorPrimary" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatTextView
|
||||
android:id="@+id/home_magisk_title"
|
||||
android:layout_width="0dp"
|
||||
|
@ -1,6 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
|
||||
<item name="hideWhenSelected" type="id" />
|
||||
<item name="recyclerScrollListener" type="id" />
|
||||
<item name="revealAnim" type="id" />
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user