android.view.animation.RotateAnimation#setAnimationListener()源码实例Demo

下面列出了android.view.animation.RotateAnimation#setAnimationListener() 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。

源代码1 项目: DevUtils   文件: AnimationUtils.java
/**
 * 获取一个旋转动画
 * @param fromDegrees       开始角度
 * @param toDegrees         结束角度
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个旋转动画
 */
public static RotateAnimation getRotateAnimation(final float fromDegrees, final float toDegrees, final long durationMillis,
                                                 final AnimationListener animationListener) {
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees);
    rotateAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        rotateAnimation.setAnimationListener(animationListener);
    }
    return rotateAnimation;
}
 
源代码2 项目: MiBandDecompiled   文件: SettingFragment.java
private void e()
{
    A = new RotateAnimation(-5F, 5F, 0, Utils.convertDpToPixel(16F, getActivity()), 0, Utils.convertDpToPixel(33F, getActivity()));
    A.setAnimationListener(new bR(this));
    A.setDuration(50L);
    A.setRepeatCount(20);
    A.setInterpolator(new AccelerateDecelerateInterpolator());
    A.setRepeatMode(2);
}
 
public void setupAnimation() {

        mRotateUpAnim = new RotateAnimation(0.0f, -180.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        Animation.AnimationListener mRotateUpAnimListener = animationListener;
        mRotateUpAnim.setAnimationListener(mRotateUpAnimListener);
        mRotateUpAnim.setDuration(ROTATE_ANIM_DURATION);
        mRotateUpAnim.setFillAfter(true);

        mRotateDownAnim = new RotateAnimation(-180.0f, 0.0f, Animation.RELATIVE_TO_SELF, 0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        mRotateDownAnim.setDuration(ROTATE_ANIM_DURATION);
        mRotateDownAnim.setFillAfter(true);
    }
 
public static void rotationAnimation(View view, AnimationListener listener) {
	if(view==null)
		return;
	
	final RotateAnimation rotation = new RotateAnimation(0, 180, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
	rotation.setDuration(300);
	rotation.setFillAfter(true);
	if(listener!=null)
		rotation.setAnimationListener(listener);
	
	view.startAnimation(rotation);
}
 
public static void reverseRotationAnimation(View view, AnimationListener listener) {
	if(view==null)
		return;
	
	final RotateAnimation rotation = new RotateAnimation(180, 0, RotateAnimation.RELATIVE_TO_SELF, 0.5f, RotateAnimation.RELATIVE_TO_SELF, 0.5f);
	rotation.setDuration(300);
	rotation.setFillAfter(true);
	if(listener!=null)
		rotation.setAnimationListener(listener);
	
	view.startAnimation(rotation);
}
 
源代码6 项目: DevUtils   文件: AnimationUtils.java
/**
 * 获取一个旋转动画
 * @param fromDegrees       开始角度
 * @param toDegrees         结束角度
 * @param pivotXType        旋转中心点 X 轴坐标相对类型
 * @param pivotXValue       旋转中心点 X 轴坐标
 * @param pivotYType        旋转中心点 Y 轴坐标相对类型
 * @param pivotYValue       旋转中心点 Y 轴坐标
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个旋转动画
 */
public static RotateAnimation getRotateAnimation(final float fromDegrees, final float toDegrees, final int pivotXType, final float pivotXValue,
                                                 final int pivotYType, final float pivotYValue, final long durationMillis,
                                                 final AnimationListener animationListener) {
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
    rotateAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        rotateAnimation.setAnimationListener(animationListener);
    }
    return rotateAnimation;
}
 
源代码7 项目: DevUtils   文件: AnimationUtils.java
/**
 * 获取一个旋转动画
 * @param fromDegrees       开始角度
 * @param toDegrees         结束角度
 * @param pivotX            旋转中心点 X 轴坐标
 * @param pivotY            旋转中心点 Y 轴坐标
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个旋转动画
 */
public static RotateAnimation getRotateAnimation(final float fromDegrees, final float toDegrees, final float pivotX, final float pivotY,
                                                 final long durationMillis, final AnimationListener animationListener) {
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotX, pivotY);
    rotateAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        rotateAnimation.setAnimationListener(animationListener);
    }
    return rotateAnimation;
}
 
源代码8 项目: SprintNBA   文件: AnimationUtils.java
/**
 * 获取一个旋转动画
 *
 * @param fromDegrees       开始角度
 * @param toDegrees         结束角度
 * @param pivotXType        旋转中心点X轴坐标相对类型
 * @param pivotXValue       旋转中心点X轴坐标
 * @param pivotYType        旋转中心点Y轴坐标相对类型
 * @param pivotYValue       旋转中心点Y轴坐标
 * @param durationMillis    持续时间
 * @param animationListener 动画监听器
 * @return 一个旋转动画
 */
public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue, long durationMillis, Animation.AnimationListener animationListener) {
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees,
            toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
    rotateAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        rotateAnimation.setAnimationListener(animationListener);
    }
    return rotateAnimation;
}
 
源代码9 项目: AndroidStudyDemo   文件: AnimationUtil.java
/**
 * 获取一个旋转动画
 *
 * @param fromDegrees       开始角度
 * @param toDegrees         结束角度
 * @param pivotXType        旋转中心点X轴坐标相对类型
 * @param pivotXValue       旋转中心点X轴坐标
 * @param pivotYType        旋转中心点Y轴坐标相对类型
 * @param pivotYValue       旋转中心点Y轴坐标
 * @param durationMillis    持续时间
 * @param animationListener 动画监听器
 * @return 一个旋转动画
 */
public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType, float pivotXValue, int pivotYType, float pivotYValue, long durationMillis, AnimationListener animationListener) {
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees, toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
    rotateAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        rotateAnimation.setAnimationListener(animationListener);
    }
    return rotateAnimation;
}
 
源代码10 项目: Utils   文件: CustomAnim.java
/**
 * get a rotation animation
 *
 * @param fromDegrees    Rotation offset to apply at the start of the
 *                       animation.
 * @param toDegrees      Rotation offset to apply at the end of the animation.
 * @param pivotXType     Specifies how pivotXValue should be interpreted. One of
 *                       Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
 *                       Animation.RELATIVE_TO_PARENT.
 * @param pivotXValue    The X coordinate of the point about which the object
 *                       is being rotated, specified as an absolute number where 0 is the
 *                       left edge. This value can either be an absolute number if
 *                       pivotXType is ABSOLUTE, or a percentage (where 1.0 is 100%)
 *                       otherwise.
 * @param pivotYType     Specifies how pivotYValue should be interpreted. One of
 *                       Animation.ABSOLUTE, Animation.RELATIVE_TO_SELF, or
 *                       Animation.RELATIVE_TO_PARENT.
 * @param pivotYValue    The Y coordinate of the point about which the object
 *                       is being rotated, specified as an absolute number where 0 is the
 *                       top edge. This value can either be an absolute number if
 *                       pivotYType is ABSOLUTE, or a percentage (where 1.0 is 100%)
 *                       otherwise.
 * @param durationMillis Duration in milliseconds
 * @param listener       the animation listener to be notified
 * @return rotation animation
 */
public static RotateAnimation getRotateAnimation(float fromDegrees, float toDegrees, int pivotXType,
                                                 float pivotXValue, int pivotYType, float pivotYValue,
                                                 long durationMillis, Animation.AnimationListener listener) {
    RotateAnimation rotateAnimation = new RotateAnimation(fromDegrees,
            toDegrees, pivotXType, pivotXValue, pivotYType, pivotYValue);
    rotateAnimation.setDuration(durationMillis);
    if (listener != null) {
        rotateAnimation.setAnimationListener(listener);
    }
    return rotateAnimation;
}