當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。