mirror of
https://github.com/topjohnwu/Magisk.git
synced 2024-12-02 22:45:27 +00:00
Updated policy items design
This commit is contained in:
parent
b66b82a6e9
commit
7c6d85221d
@ -14,6 +14,7 @@ import com.topjohnwu.magisk.model.events.PolicyEnableEvent
|
|||||||
import com.topjohnwu.magisk.model.events.PolicyUpdateEvent
|
import com.topjohnwu.magisk.model.events.PolicyUpdateEvent
|
||||||
import com.topjohnwu.magisk.utils.KObservableField
|
import com.topjohnwu.magisk.utils.KObservableField
|
||||||
import com.topjohnwu.magisk.utils.RxBus
|
import com.topjohnwu.magisk.utils.RxBus
|
||||||
|
import com.topjohnwu.magisk.utils.rotationTo
|
||||||
import com.topjohnwu.magisk.utils.setRevealed
|
import com.topjohnwu.magisk.utils.setRevealed
|
||||||
|
|
||||||
class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvItem<PolicyRvItem>() {
|
class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvItem<PolicyRvItem>() {
|
||||||
@ -41,6 +42,7 @@ class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvIte
|
|||||||
|
|
||||||
fun toggle(view: View) {
|
fun toggle(view: View) {
|
||||||
toggle()
|
toggle()
|
||||||
|
view.rotationTo(if (isExpanded.value) 225 else 180)
|
||||||
(view.parent as ViewGroup)
|
(view.parent as ViewGroup)
|
||||||
.findViewById<View>(R.id.expand_layout)
|
.findViewById<View>(R.id.expand_layout)
|
||||||
.setRevealed(isExpanded.value)
|
.setRevealed(isExpanded.value)
|
||||||
|
@ -370,3 +370,11 @@ fun RecyclerView.setDividers(dividerVertical: Drawable?, dividerHorizontal: Draw
|
|||||||
}.let { addItemDecoration(it) }
|
}.let { addItemDecoration(it) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@BindingAdapter("rotationAnimated")
|
||||||
|
fun View.rotationTo(value: Int) {
|
||||||
|
animate()
|
||||||
|
.rotation(value.toFloat())
|
||||||
|
.setInterpolator(FastOutSlowInInterpolator())
|
||||||
|
.start()
|
||||||
|
}
|
@ -16,7 +16,7 @@
|
|||||||
</data>
|
</data>
|
||||||
|
|
||||||
<com.google.android.material.card.MaterialCardView
|
<com.google.android.material.card.MaterialCardView
|
||||||
style="?styleCardNormal"
|
style="?styleCardVariant"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center"
|
android:layout_gravity="center"
|
||||||
@ -82,7 +82,7 @@
|
|||||||
revealFix="@{item.isExpanded()}"
|
revealFix="@{item.isExpanded()}"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
android:background="?colorSurface"
|
android:background="?colorSurfaceVariant"
|
||||||
android:visibility="invisible"
|
android:visibility="invisible"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
|
Loading…
Reference in New Issue
Block a user