MainActivity.java 文件源码

java
阅读 21 收藏 0 点赞 0 评论 0

项目:AnimatedVectorMorphingTool 作者:
/**
 * Launch the animation on the currentAnimatedVectorDrawable
 * As the levellist solution (ahead) has a bug, I do it in a simple way
 */
private void launchAnimBackup() {
    //initialize
    if (backupRoundTripFirstLaunched) {
        reverse = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.animated_ic_check_box_black_24dp_reverse, getTheme());
        initial = (AnimatedVectorDrawable) getResources().getDrawable(R.drawable.animated_ic_check_box_black_24dp, getTheme());
        //if you want to avoid the color bug (animation not played on color at the second time)
        //comment that line (ok it's memory consumption)
        backupRoundTripFirstLaunched=false;
    }
    //set the drawable depending on the direction (reverse or not)
    if (reverseState) {
        //then reverse
        imageView2.setImageDrawable(reverse);
    } else {
        //then reverse
        imageView2.setImageDrawable(initial);
    }
    reverseState=!reverseState;
    //launch the animation
    ((AnimatedVectorDrawable) imageView2.getDrawable()).start();
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号