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

The following examples show how to use android.view.animation.ScaleAnimation#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: MapController.java    From osmdroid with Apache License 2.0 6 votes vote down vote up
public MapController(MapView mapView) {
    mMapView = mapView;

    // Keep track of initial layout
    mReplayController = new ReplayController();
    if (!mMapView.isLayoutOccurred()) {
        mMapView.addOnFirstLayoutListener(this);
    }


    if (Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB) {
        ZoomAnimationListener zoomAnimationListener = new ZoomAnimationListener(this);
        mZoomInAnimationOld = new ScaleAnimation(1, 2, 1, 2, Animation.RELATIVE_TO_SELF, 0.5f,
            Animation.RELATIVE_TO_SELF, 0.5f);
        mZoomOutAnimationOld = new ScaleAnimation(1, 0.5f, 1, 0.5f, Animation.RELATIVE_TO_SELF,
            0.5f, Animation.RELATIVE_TO_SELF, 0.5f);
        mZoomInAnimationOld.setDuration(Configuration.getInstance().getAnimationSpeedShort());
        mZoomOutAnimationOld.setDuration(Configuration.getInstance().getAnimationSpeedShort());
        mZoomInAnimationOld.setAnimationListener(zoomAnimationListener);
        mZoomOutAnimationOld.setAnimationListener(zoomAnimationListener);
    }
}
 
Example 2
Source File: AnimationUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 获取一个中心点缩放动画
 * @param fromX             动画开始前在 X 坐标
 * @param toX               动画结束后在 X 坐标
 * @param fromY             动画开始前在 Y 坐标
 * @param toY               动画结束后在 Y 坐标
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个中心点缩放动画
 */
public static ScaleAnimation getScaleAnimationCenter(final float fromX, final float toX, final float fromY, final float toY,
                                                     final long durationMillis, final AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(fromX, toX, fromY, toY,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f,
            ScaleAnimation.RELATIVE_TO_SELF, 0.5f);
    scaleAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        scaleAnimation.setAnimationListener(animationListener);
    }
    return scaleAnimation;
}
 
Example 3
Source File: AnimationUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 获取一个缩小动画
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个缩小动画
 */
public static ScaleAnimation getLessenScaleAnimation(final long durationMillis, final AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f,
            ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        scaleAnimation.setAnimationListener(animationListener);
    }
    return scaleAnimation;
}
 
Example 4
Source File: AnimationUtils.java    From DevUtils with Apache License 2.0 5 votes vote down vote up
/**
 * 获取一个放大动画
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个放大动画
 */
public static ScaleAnimation getAmplificationAnimation(final long durationMillis, final AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f,
            ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        scaleAnimation.setAnimationListener(animationListener);
    }
    return scaleAnimation;
}
 
Example 5
Source File: AnimationUtils.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
/**
 * 获取一个缩小动画
 *
 * @param durationMillis    时间
 * @param animationListener 监听
 * @return 一个缩小动画
 */
public static ScaleAnimation getLessenScaleAnimation(long durationMillis, Animation.AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f,
            0.0f, ScaleAnimation.RELATIVE_TO_SELF,
            ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);

    return scaleAnimation;
}
 
Example 6
Source File: AnimationUtils.java    From SprintNBA with Apache License 2.0 5 votes vote down vote up
/**
 * 获取一个放大动画
 *
 * @param durationMillis    时间
 * @param animationListener 监听
 * @return 返回一个放大的效果
 */
public static ScaleAnimation getAmplificationAnimation(long durationMillis, Animation.AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f,
            1.0f, ScaleAnimation.RELATIVE_TO_SELF,
            ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);
    return scaleAnimation;
}
 
Example 7
Source File: CustomAnim.java    From Utils with Apache License 2.0 5 votes vote down vote up
/**
 * get a lessen scale animation
 *
 * @param durationMillis Duration in milliseconds
 * @param listener       the animation listener to be notified
 * @return An animation that controls the lessen scale of an object
 */
public static ScaleAnimation getLessenScaleAnimation(long durationMillis, Animation.AnimationListener listener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f,
            0.0f, ScaleAnimation.RELATIVE_TO_SELF,
            ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(listener);
    return scaleAnimation;
}
 
Example 8
Source File: CustomAnim.java    From Utils with Apache License 2.0 5 votes vote down vote up
/**
 * get a amplification scale animation
 *
 * @param durationMillis Duration in milliseconds
 * @param listener       the animation listener to be notified
 * @return An animation that controls the amplification scale of an object
 */
public static ScaleAnimation getAmplificationAnimation(long durationMillis, Animation.AnimationListener listener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f,
            1.0f, ScaleAnimation.RELATIVE_TO_SELF,
            ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(listener);
    return scaleAnimation;
}
 
Example 9
Source File: AnimationUtils.java    From DevUtils with Apache License 2.0 3 votes vote down vote up
/**
 * 获取一个缩放动画
 * @param fromX             动画开始前在 X 坐标
 * @param toX               动画结束后在 X 坐标
 * @param fromY             动画开始前在 Y 坐标
 * @param toY               动画结束后在 Y 坐标
 * @param pivotXType        缩放中心点的 X 坐标类型, 取值范围为 {@link Animation#ABSOLUTE}、
 *                          {@link Animation#RELATIVE_TO_SELF}、{@link Animation#RELATIVE_TO_PARENT}
 * @param pivotXValue       缩放中心点的 X 坐标, 当 pivotXType == ABSOLUTE 时, 表示绝对位置, 否则表示相对位置, 1.0 表示 100%
 * @param pivotYType        缩放中心点的 Y 坐标类型
 * @param pivotYValue       缩放中心点的 Y 坐标
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个缩放动画
 */
public static ScaleAnimation getScaleAnimation(final float fromX, final float toX, final float fromY, final float toY,
                                               final int pivotXType, final float pivotXValue, final int pivotYType, final float pivotYValue,
                                               final long durationMillis, final AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(fromX, toX, fromY, toY, pivotXType, pivotXValue, pivotYType, pivotYValue);
    scaleAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        scaleAnimation.setAnimationListener(animationListener);
    }
    return scaleAnimation;
}
 
Example 10
Source File: AnimationUtils.java    From DevUtils with Apache License 2.0 3 votes vote down vote up
/**
 * 获取一个缩放动画
 * @param fromX             动画开始前在 X 坐标
 * @param toX               动画结束后在 X 坐标
 * @param fromY             动画开始前在 Y 坐标
 * @param toY               动画结束后在 Y 坐标
 * @param pivotX            缩放中心点的 X 坐标
 * @param pivotY            缩放中心点的 Y 坐标
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个缩放动画
 */
public static ScaleAnimation getScaleAnimation(final float fromX, final float toX, final float fromY, final float toY,
                                               final float pivotX, final float pivotY, final long durationMillis,
                                               final AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(fromX, toX, fromY, toY, pivotX, pivotY);
    scaleAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        scaleAnimation.setAnimationListener(animationListener);
    }
    return scaleAnimation;
}
 
Example 11
Source File: AnimationUtils.java    From DevUtils with Apache License 2.0 3 votes vote down vote up
/**
 * 获取一个缩放动画
 * @param fromX             动画开始前在 X 坐标
 * @param toX               动画结束后在 X 坐标
 * @param fromY             动画开始前在 Y 坐标
 * @param toY               动画结束后在 Y 坐标
 * @param durationMillis    动画持续时间
 * @param animationListener 动画监听器
 * @return 一个缩放动画
 */
public static ScaleAnimation getScaleAnimation(final float fromX, final float toX, final float fromY, final float toY,
                                               final long durationMillis, final AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(fromX, toX, fromY, toY);
    scaleAnimation.setDuration(durationMillis);
    if (animationListener != null) {
        scaleAnimation.setAnimationListener(animationListener);
    }
    return scaleAnimation;
}
 
Example 12
Source File: AnimationUtil.java    From AndroidStudyDemo with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 获取一个缩小动画
 *
 * @param durationMillis
 * @param animationListener
 * @return
 */
public static ScaleAnimation getLessenScaleAnimation(long durationMillis, AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(1.0f, 0.0f, 1.0f, 0.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);
    return scaleAnimation;
}
 
Example 13
Source File: AnimationUtil.java    From AndroidStudyDemo with GNU General Public License v2.0 3 votes vote down vote up
/**
 * 获取一个放大动画
 *
 * @param durationMillis
 * @param animationListener
 * @return
 */
public static ScaleAnimation getAmplificationAnimation(long durationMillis, AnimationListener animationListener) {
    ScaleAnimation scaleAnimation = new ScaleAnimation(0.0f, 1.0f, 0.0f, 1.0f, ScaleAnimation.RELATIVE_TO_SELF, ScaleAnimation.RELATIVE_TO_SELF);
    scaleAnimation.setDuration(durationMillis);
    scaleAnimation.setAnimationListener(animationListener);
    return scaleAnimation;
}