Fixed expandable card view arrow
This commit is contained in:
@@ -50,7 +50,7 @@ public class ExpandableCardView extends CardView {
|
|||||||
private View outerView;
|
private View outerView;
|
||||||
private ImageButton imageButton;
|
private ImageButton imageButton;
|
||||||
|
|
||||||
private static final int DEFAULT_ANIM_DURATION = 350;
|
private static final int DEFAULT_ANIM_DURATION = 2000;
|
||||||
private long animDuration = DEFAULT_ANIM_DURATION;
|
private long animDuration = DEFAULT_ANIM_DURATION;
|
||||||
|
|
||||||
private final static int COLLAPSING = 0;
|
private final static int COLLAPSING = 0;
|
||||||
@@ -260,8 +260,29 @@ public class ExpandableCardView extends CardView {
|
|||||||
new RotateAnimation(180,0,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
|
new RotateAnimation(180,0,Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF,
|
||||||
0.5f);
|
0.5f);
|
||||||
|
|
||||||
arrowAnimation.setFillAfter(true);
|
arrowAnimation.setAnimationListener(new Animation.AnimationListener() {
|
||||||
|
@Override
|
||||||
|
public void onAnimationStart(Animation animation) {
|
||||||
|
imageButton.setRotationX(0);
|
||||||
|
imageButton.setRotationY(0);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationEnd(Animation animation) {
|
||||||
|
if (isExpanded) {
|
||||||
|
imageButton.setRotationX(180);
|
||||||
|
imageButton.setRotationY(180);
|
||||||
|
} else {
|
||||||
|
imageButton.setRotationX(0);
|
||||||
|
imageButton.setRotationY(0);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onAnimationRepeat(Animation animation) {
|
||||||
|
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
arrowAnimation.setDuration(animDuration);
|
arrowAnimation.setDuration(animDuration);
|
||||||
expandAnimation.setDuration(animDuration);
|
expandAnimation.setDuration(animDuration);
|
||||||
|
|||||||
@@ -6,7 +6,7 @@
|
|||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_margin="@dimen/cardview_margin"
|
android:layout_margin="@dimen/cardview_margin"
|
||||||
card_view:cardElevation="@dimen/card_elevation"
|
card_view:cardElevation="@dimen/card_elevation"
|
||||||
app:animationDuration="300"
|
app:animationDuration="2000"
|
||||||
app:inner_view="@layout/list_canteen_body"
|
app:inner_view="@layout/list_canteen_body"
|
||||||
app:outer_view="@layout/list_canteen_header"
|
app:outer_view="@layout/list_canteen_header"
|
||||||
app:startExpanded="false" />
|
app:startExpanded="false" />
|
||||||
|
|||||||
Reference in New Issue
Block a user