diff --git a/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/PolicyRvItem.kt b/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/PolicyRvItem.kt index 219224c9a..53a61e0e4 100644 --- a/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/PolicyRvItem.kt +++ b/app/src/main/java/com/topjohnwu/magisk/model/entity/recycler/PolicyRvItem.kt @@ -14,6 +14,7 @@ import com.topjohnwu.magisk.model.events.PolicyEnableEvent import com.topjohnwu.magisk.model.events.PolicyUpdateEvent import com.topjohnwu.magisk.utils.KObservableField import com.topjohnwu.magisk.utils.RxBus +import com.topjohnwu.magisk.utils.rotationTo import com.topjohnwu.magisk.utils.setRevealed class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvItem() { @@ -41,6 +42,7 @@ class PolicyRvItem(val item: MagiskPolicy, val icon: Drawable) : ComparableRvIte fun toggle(view: View) { toggle() + view.rotationTo(if (isExpanded.value) 225 else 180) (view.parent as ViewGroup) .findViewById(R.id.expand_layout) .setRevealed(isExpanded.value) diff --git a/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt b/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt index 6d69a2d05..be15e5fce 100644 --- a/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt +++ b/app/src/main/java/com/topjohnwu/magisk/utils/DataBindingAdapters.kt @@ -369,4 +369,12 @@ fun RecyclerView.setDividers(dividerVertical: Drawable?, dividerHorizontal: Draw setDrawable(dividerVertical) }.let { addItemDecoration(it) } } +} + +@BindingAdapter("rotationAnimated") +fun View.rotationTo(value: Int) { + animate() + .rotation(value.toFloat()) + .setInterpolator(FastOutSlowInInterpolator()) + .start() } \ No newline at end of file diff --git a/app/src/main/res/layout/item_policy_md2.xml b/app/src/main/res/layout/item_policy_md2.xml index 508f6920e..2d69bec7e 100644 --- a/app/src/main/res/layout/item_policy_md2.xml +++ b/app/src/main/res/layout/item_policy_md2.xml @@ -16,7 +16,7 @@