当前位置: 首页>>代码示例>>Java>>正文


Java TranslateAnimation.setAnimationListener方法代码示例

本文整理汇总了Java中android.view.animation.TranslateAnimation.setAnimationListener方法的典型用法代码示例。如果您正苦于以下问题:Java TranslateAnimation.setAnimationListener方法的具体用法?Java TranslateAnimation.setAnimationListener怎么用?Java TranslateAnimation.setAnimationListener使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在android.view.animation.TranslateAnimation的用法示例。


在下文中一共展示了TranslateAnimation.setAnimationListener方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: adjustSizes

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void adjustSizes(boolean isAnimated) {
    int width = getWidth();
    if (width > 0 && this.items != null) {
        LayoutParams viewLayoutParams = (LayoutParams) this.currentView.getLayoutParams();
        viewLayoutParams.width = width / this.items.length;
        this.currentView.setLayoutParams(viewLayoutParams);
        if (!this.inAnimation) {
            if (isAnimated) {
                this.inAnimation = true;
                TranslateAnimation animation = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0,
                        Animation.RELATIVE_TO_SELF, this.currentIndex - this.lastIndex, 0, 0, 0, 0);
                animation.setDuration(300);
                animation.setAnimationListener(this);
                this.currentView.startAnimation(animation);
                return;
            }
            viewLayoutParams.leftMargin = this.currentIndex * viewLayoutParams.width;
            this.currentView.setLayoutParams(viewLayoutParams);
        }
    }
}
 
开发者ID:amspayam,项目名称:PDialogs-Android,代码行数:22,代码来源:SegmentController.java

示例2: animatefigure

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private boolean animatefigure(final Tuple<Integer, Integer> from, final Tuple<Integer, Integer> to, int speed) {
    if (figuren[from.first][from.last] != null) {
        Point rectFrom = chessboardView.getRectangleCoordinates(from);
        Point rectTo = chessboardView.getRectangleCoordinates(to);
        int deltaX = rectTo.x - rectFrom.x;
        int deltaY = rectTo.y - rectFrom.y;
        TranslateAnimation translateAnimation = new TranslateAnimation(0, deltaX, 0, deltaY);
        translateAnimation.setDuration(speed);
        translateAnimation.setInterpolator(new AccelerateDecelerateInterpolator());
        translateAnimation.setAnimationListener(new AnimationEndListener() {
            @Override
            public void onAnimationEnd(Animation animation) {
                update();
                if (aiGame && !board.isWhitesTurn()) {
                    aimove();
                } else {
                    stateAllowClick = true;
                }
            }
        });
        figuren[from.first][from.last].startAnimation(translateAnimation);
        return true;
    }
    return false;
}
 
开发者ID:android-gamecollection,项目名称:gamecollection,代码行数:26,代码来源:Chess.java

示例3: randomTranslate

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private TranslateAnimation randomTranslate(int startTopInParent, int duration, AnimationListener l) {
	float halfPercent = (1 + startTopInParent * 1.0f / mScreenHeight) / 2;
	TranslateAnimation trans = new TranslateAnimation(Animation.RELATIVE_TO_SELF, 0, Animation.RELATIVE_TO_SELF, (float) ((Math.random() > 0.5f ? 1 : -1) * Math.random()) * 5,
			Animation.RELATIVE_TO_PARENT, 0, Animation.RELATIVE_TO_PARENT, (float) (Math.random() * halfPercent + halfPercent));
	trans.setInterpolator(this, android.R.anim.linear_interpolator);
	trans.setStartOffset(0);
	trans.setDuration(duration);
	trans.setAnimationListener(l);
	return trans;
}
 
开发者ID:isuhao,项目名称:QMark,代码行数:11,代码来源:WelcomeSnowActy.java

示例4: animateDismissItem

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void animateDismissItem(View selectedItemView)
{
    final TranslateAnimation translateAnimation =
            new TranslateAnimation(0, 0 - selectedItemView.getWidth(), 0, 0);
    translateAnimation.setDuration(ANIMATION_DURATION);
    translateAnimation.setAnimationListener(new DismissAnimationListener(TouchHelper.this.selected));
    ViewCompat.setHasTransientState(selectedItemView, true);
    selectedItemView.startAnimation(translateAnimation);
}
 
开发者ID:WangZhiYao,项目名称:RealmTasks,代码行数:10,代码来源:TouchHelper.java

示例5: animateCompleteItem

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
private void animateCompleteItem(View selectedItemView)
{
    final TranslateAnimation translateAnimation =
            new TranslateAnimation(0, 0, 0, 0);
    translateAnimation.setDuration(ANIMATION_DURATION);
    translateAnimation.setAnimationListener(new CompleteAnimationListener(TouchHelper.this.selected));
    ViewCompat.setHasTransientState(selectedItemView, true);
    selectedItemView.startAnimation(translateAnimation);
}
 
开发者ID:WangZhiYao,项目名称:RealmTasks,代码行数:10,代码来源:TouchHelper.java

示例6: setExitAnimRightMargin

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
@Override
public void setExitAnimRightMargin(float dp) {
    int rightmargin =UIUtils.dip2ipx(dp);
    mExitAnim = new TranslateAnimation(0, DEFAULT_WIDTH + rightmargin, 0, 0);
    mExitAnim.setFillAfter(true);
    mExitAnim.setDuration(DURATION_ENTER_EXIT);
    mExitAnim.setAnimationListener(this);
}
 
开发者ID:vip001,项目名称:BubbleBar,代码行数:9,代码来源:BubbleBarView.java

示例7: getTranslateAnimation

import android.view.animation.TranslateAnimation; //导入方法依赖的package包/类
/**
 * 获取一个移动动画
 *
 * @param fromXDelta        动画起始时 X坐标上的移动位置
 * @param toXDelta          动画结束时 X坐标上的移动位置
 * @param fromYDelta        动画起始时 Y坐标上的移动位置
 * @param toYDelta          动画结束时 Y坐标上的移动位置
 * @param durationMillis    时间
 * @param interpolator      插值器
 *                          AccelerateDecelerateInterpolator 在动画开始与结束的地方速率改变比较慢,在中间的时候加速
 *                          AccelerateInterpolator 在动画开始的地方速率改变比较慢,然后开始加速
 *                          AnticipateInterpolator 开始的时候向后然后向前甩
 *                          AnticipateOvershootInterpolator 开始的时候向后然后向前甩一定值后返回最后的值
 *                          BounceInterpolator 动画结束的时候弹起
 *                          CycleInterpolator 动画循环播放特定的次数,速率改变沿着正弦曲线
 *                          DecelerateInterpolator 在动画开始的地方快然后慢
 *                          LinearInterpolator 以常量速率改变
 *                          OvershootInterpolator  向前甩一定值后再回到原来位置
 * @param animationListener 监听
 * @return 返回一个移动动画
 */
public static TranslateAnimation getTranslateAnimation(float fromXDelta, float toXDelta, float fromYDelta, float toYDelta, long durationMillis, Interpolator interpolator, AnimationListener animationListener) {
    TranslateAnimation translateAnimation = new TranslateAnimation(fromXDelta, toXDelta, fromYDelta, toYDelta);
    translateAnimation.setInterpolator(interpolator);
    translateAnimation.setDuration(durationMillis);
    translateAnimation.setAnimationListener(animationListener);
    return translateAnimation;
}
 
开发者ID:RockyQu,项目名称:MVVMFrames,代码行数:29,代码来源:AnimationUtils.java


注:本文中的android.view.animation.TranslateAnimation.setAnimationListener方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。