You've already forked Magisk
mirror of
https://github.com/topjohnwu/Magisk.git
synced 2025-09-06 06:36:58 +00:00
This has been done in preparations for rewrite to kotlin and upcoming design changes. Nothing should be broken but use caution.
43 lines
1.1 KiB
Java
43 lines
1.1 KiB
Java
package com.topjohnwu.magisk.view;
|
|
|
|
import android.view.View;
|
|
import android.view.animation.Animation;
|
|
import android.view.animation.RotateAnimation;
|
|
|
|
public class ArrowExpandable extends Expandable {
|
|
protected Expandable mBase;
|
|
private View arrow;
|
|
|
|
public ArrowExpandable(Expandable base, View arrow) {
|
|
mBase = base;
|
|
this.arrow = arrow;
|
|
}
|
|
|
|
@Override
|
|
public void onExpand() {
|
|
mBase.onExpand();
|
|
setRotate(new RotateAnimation(0, 180,
|
|
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
|
|
}
|
|
|
|
@Override
|
|
public void onCollapse() {
|
|
mBase.onCollapse();
|
|
setRotate(new RotateAnimation(180, 0,
|
|
Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f));
|
|
}
|
|
|
|
@Override
|
|
public void onSetExpanded(boolean expanded) {
|
|
mBase.onSetExpanded(expanded);
|
|
if (arrow != null)
|
|
arrow.setRotation(expanded ? 180 : 0);
|
|
}
|
|
|
|
private void setRotate(RotateAnimation rotate) {
|
|
rotate.setDuration(300);
|
|
rotate.setFillAfter(true);
|
|
arrow.startAnimation(rotate);
|
|
}
|
|
}
|