Java Code Examples for android.view.animation.RotateAnimation#setAnimationListener()

The following examples show how to use android.view.animation.RotateAnimation#setAnimationListener() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: AnimationUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 获取一个旋转动画
 * @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;
}
 
Example 2
Source File: SettingFragment.java    From MiBandDecompiled with Apache License 2.0 5 votes vote down vote up
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);
}
 
Example 3
Source File: DefaultCustomHeadView.java    From SwipeRefreshLayout with Apache License 2.0 5 votes vote down vote up
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);
    }
 
Example 4
Source File: DynamicListAnimationUtils.java    From dynamiclistview with MIT License 5 votes vote down vote up
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);
}
 
Example 5
Source File: DynamicListAnimationUtils.java    From dynamiclistview with MIT License 5 votes vote down vote up
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);
}
 
Example 6
Source File: AnimationUtils.java    From DevUtils with Apache License 2.0 3 votes vote down vote up
/**
 * 获取一个旋转动画
 * @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;
}
 
Example 7
Source File: AnimationUtils.java    From DevUtils with Apache License 2.0 3 votes vote down vote up
/**
 * 获取一个旋转动画
 * @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;
}
 
Example 8
Source File: AnimationUtils.java    From SprintNBA with Apache License 2.0 3 votes vote down vote up
/**
 * 获取一个旋转动画
 *
 * @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;
}
 
Example 9
Source File: AnimationUtil.java    From AndroidStudyDemo with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 获取一个旋转动画
 *
 * @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;
}
 
Example 10
Source File: CustomAnim.java    From Utils with Apache License 2.0 3 votes vote down vote up
/**
 * 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;
}