本文整理汇总了Java中android.view.animation.RotateAnimation.setAnimationListener方法的典型用法代码示例。如果您正苦于以下问题:Java RotateAnimation.setAnimationListener方法的具体用法?Java RotateAnimation.setAnimationListener怎么用?Java RotateAnimation.setAnimationListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.view.animation.RotateAnimation
的用法示例。
在下文中一共展示了RotateAnimation.setAnimationListener方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addImages
import android.view.animation.RotateAnimation; //导入方法依赖的package包/类
private void addImages() {
int imageSize = chessboardView.getThickness();
for (int i = 0; i < gridSize; i++) {
for (int j = 0; j < gridSize; j++) {
if (figuren[i][j] != null) {
Point point = chessboardView.getRectangleCoordinates(new Tuple<>(i, j));
figuren[i][j].setX(point.x);
figuren[i][j].setY(point.y);
addContentView(figuren[i][j], new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT));
figuren[i][j].getLayoutParams().width = imageSize;
figuren[i][j].getLayoutParams().height = imageSize;
if (!aiGame) {
if (!startValue.equals(board.getBoard())) {
int pivotX = point.x + imageSize / 2;
int pivotY = point.y + imageSize / 2;
RotateAnimation rotateAnimation = new RotateAnimation(180, 0, pivotX, pivotY);
rotateAnimation.setDuration(ANIMATION_SPEED / 2);
rotateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
rotateAnimation.setAnimationListener(new AnimationEndListener() {
@Override
public void onAnimationEnd(Animation animation) {
stateAllowClick = true;
}
});
figuren[i][j].startAnimation(rotateAnimation);
}
if (board.isWhitesTurn()) {
figuren[i][j].setRotation(0);
} else {
figuren[i][j].setRotation(180);
}
}
}
}
}
}
示例2: getRotateAnimation
import android.view.animation.RotateAnimation; //导入方法依赖的package包/类
/**
* Get a spin animation
*
* @param fromDegrees start angle
* @param toDegrees end angle
* @param pivotXType Rotation center point X axis coordinate relative type
* @param pivotXValue Rotation center point X axis coordinate
* @param pivotYType Rotation center point Y axis coordinate relative type
* @param pivotYValue Rotation center point Y axis coordinate
* @param durationMillis duration
* @param animationListener Animation monitor
* @return A rotating animation
*/
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;
}
示例3: getRotateAnimation
import android.view.animation.RotateAnimation; //导入方法依赖的package包/类
/**
* 获取一个旋转动画
*
* @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;
}