本文整理匯總了Java中android.view.animation.Animation.AnimationListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation.AnimationListener方法的具體用法?Java Animation.AnimationListener怎麽用?Java Animation.AnimationListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.Animation
的用法示例。
在下文中一共展示了Animation.AnimationListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: animateContent
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* Animating the center part of the row, For example the image in an image message or the text in text message.
* */
private void animateContent(View view, Animation.AnimationListener animationListener, boolean showFull){
if (!isScrolling)
return;
view.setAnimation(AnimationUtils.loadAnimation(mActivity, showFull ? R.anim.fade_in_expand : R.anim.fade_in_half_and_expand));
view.getAnimation().setAnimationListener(animationListener);
view.animate();
}
示例2: startScaleDownAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
void startScaleDownAnimation(Animation.AnimationListener listener) {
mScaleDownAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(1 - interpolatedTime);
translateContentViews((mTarget.getTranslationY() * (1 - interpolatedTime)));
// System.out.println(" mScaleDownAnimation interpolatedTime = " + interpolatedTime);
}
};
mScaleDownAnimation.setDuration(SCALE_DOWN_DURATION);
mScaleDownAnimation.setAnimationListener(listener);
//刷新完成,延時200ms,用於展示完成狀態.但最好是有一個完成的動畫。TODO
mScaleDownAnimation.setStartOffset(listener != null ? 500 : -1);
mRefreshView.clearAnimation();
mRefreshView.startAnimation(mScaleDownAnimation);
if (listener != null) {
//刷新完成
getRefreshTrigger().onComplete();
}
}
示例3: animateOffsetToStartPosition
import android.view.animation.Animation; //導入方法依賴的package包/類
private void animateOffsetToStartPosition(CircleImageView view, int from, Animation.AnimationListener listener) {
if (mScale) {
// Scale the item back down
startScaleDownReturnToStartAnimation(view, from, listener);
} else {
mFrom = from;
mAnimateToStartPosition.reset();
mAnimateToStartPosition.setDuration(ANIMATE_TO_START_DURATION);
mAnimateToStartPosition.setInterpolator(mDecelerateInterpolator);
if (listener != null) {
view.setAnimationListener(listener);
}
view.clearAnimation();
view.startAnimation(mAnimateToStartPosition);
}
}
示例4: startScaleUpAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private void startScaleUpAnimation(Animation.AnimationListener listener) {
mLoadingView.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT >= 11) {
mProgress.setAlpha(255);
}
Animation mScaleAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(interpolatedTime);
}
};
mScaleAnimation.setDuration(getResources().getInteger(android.R.integer.config_mediumAnimTime));
if (listener != null) {
mLoadingView.setAnimationListener(listener);
}
mLoadingView.clearAnimation();
mLoadingView.startAnimation(mScaleAnimation);
}
示例5: animateOffsetToStartPosition
import android.view.animation.Animation; //導入方法依賴的package包/類
private void animateOffsetToStartPosition(int from, Animation.AnimationListener listener) {
mFrom = from;
AnimateToStartPos animateToStartPos = new AnimateToStartPos();
animateToStartPos.reset();
animateToStartPos.setDuration(200);
animateToStartPos.setInterpolator(mDecelerateInterpolator);
if (listener != null) mLoadingView.setAnimationListener(listener);
mLoadingView.clearAnimation();
mLoadingView.startAnimation(animateToStartPos);
}
示例6: animateOffsetToStartPosition
import android.view.animation.Animation; //導入方法依賴的package包/類
private void animateOffsetToStartPosition(int from, Animation.AnimationListener listener) {
if (mScale) {
// Scale the item back down
startScaleDownReturnToStartAnimation(from, listener);
} else {
mFrom = from;
mAnimateToStartPosition.reset();
mAnimateToStartPosition.setDuration(ANIMATE_TO_START_DURATION);
mAnimateToStartPosition.setInterpolator(mDecelerateInterpolator);
mAnimateToStartPosition.setAnimationListener(listener);
mRefreshView.clearAnimation();
mRefreshView.startAnimation(mAnimateToStartPosition);
}
}
示例7: startScaleDownAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private void startScaleDownAnimation(Animation.AnimationListener listener) {
mScaleDownAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(1 - interpolatedTime);
}
};
mScaleDownAnimation.setDuration(SCALE_DOWN_DURATION);
mScaleDownAnimation.setAnimationListener(listener);
mRefreshView.clearAnimation();
mRefreshView.startAnimation(mScaleDownAnimation);
}
示例8: startScaleDownAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private void startScaleDownAnimation(Animation.AnimationListener listener) {
Animation mScaleDownAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(1 - interpolatedTime);
}
};
mScaleDownAnimation.setDuration(150);
mLoadingView.setAnimationListener(listener);
mLoadingView.clearAnimation();
mLoadingView.startAnimation(mScaleDownAnimation);
}
示例9: animateFakeClearing
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* Hides every view in a RecyclerView to simulate clearing the RecyclerView
* returns how long the animation takes to complete.
* Returns -1 if there is nothing to animate
*/
public static int animateFakeClearing(int lastVisibleItemPosition, int firstVisibleItemPosition, AutoSpanRecyclerView aRecyclerView, Animation.AnimationListener animationListener, boolean includeTranslation) {
final int DELAY_BETWEEN = 50;
int clearingDuration = 0;
int startPositionCol = getColumnPosFromIndex(firstVisibleItemPosition, aRecyclerView);
int startPositionRow = getRowPosFromIndex(firstVisibleItemPosition, aRecyclerView);
for(int i = lastVisibleItemPosition; i >= firstVisibleItemPosition; i--) {
final View VIEW = aRecyclerView.getChildAt(lastVisibleItemPosition - i);
int positionColumnDistance = Math.abs(getColumnPosFromIndex(i, aRecyclerView) - startPositionCol);
int positionRowDistance = Math.abs(getRowPosFromIndex(i, aRecyclerView) - startPositionRow);
int delay = (positionColumnDistance + positionRowDistance) * DELAY_BETWEEN + 1;
AnimationSet mHideAnimations = AnimationService.startAlphaHideAnimation(delay, VIEW, includeTranslation);
if (mHideAnimations == null) {
return -1;
}
int hideAnimationDuration = (int) mHideAnimations.getDuration();
if (hideAnimationDuration + delay > clearingDuration) {
clearingDuration = hideAnimationDuration + delay;
}
// If the view is the last to animate, then start the intent when the animation finishes.
if(i == lastVisibleItemPosition && animationListener != null) {
mHideAnimations.setAnimationListener(animationListener);
}
}
return clearingDuration;
}
示例10: animateOffsetToCorrectPosition
import android.view.animation.Animation; //導入方法依賴的package包/類
private void animateOffsetToCorrectPosition(int from, Animation.AnimationListener listener) {
mFrom = from;
mAnimateToCorrectPosition.reset();
mAnimateToCorrectPosition.setDuration(ANIMATE_TO_TRIGGER_DURATION);
mAnimateToCorrectPosition.setInterpolator(mDecelerateInterpolator);
mAnimateToCorrectPosition.setAnimationListener(listener);
mRefreshView.clearAnimation();
mRefreshView.startAnimation(mAnimateToCorrectPosition);
}
示例11: setRefreshing
import android.view.animation.Animation; //導入方法依賴的package包/類
private void setRefreshing(boolean refreshing, final boolean notify) {
if (mRefreshing != refreshing) {
mNotify = notify;
ensureTarget();
mRefreshing = refreshing;
if (mRefreshing) {
animateOffsetToCorrectPosition(mCurrentTargetOffsetTop, mRefreshListener);
} else {
Animation.AnimationListener listener = null;
if (!mScale) {
listener = new Animation.AnimationListener() {
@Override
public void onAnimationStart(Animation animation) {
}
@Override
public void onAnimationEnd(Animation animation) {
if (!mScale) {
startScaleDownAnimation(null);
}
}
@Override
public void onAnimationRepeat(Animation animation) {
}
};
}
animateOffsetToStartPosition(mCurrentTargetOffsetTop, null);
//startScaleDownAnimation(mRefreshListener);
}
}
}
示例12: setAnimationListener
import android.view.animation.Animation; //導入方法依賴的package包/類
public void setAnimationListener(Animation.AnimationListener listener) {
mListener = listener;
}
示例13: setButtonAnimationListener
import android.view.animation.Animation; //導入方法依賴的package包/類
public void setButtonAnimationListener(Animation.AnimationListener listener) {
animation.setAnimationListener(listener);
}
示例14: setAnimationListener
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* {@link AnimationImageView#mListener} のセット
*
* @param listener {@link android.view.animation.Animation.AnimationListener}
*/
public void setAnimationListener(Animation.AnimationListener listener) {
mListener = listener;
}
示例15: getAlphaAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* Gets a transparency gradient animation
*
* @param fromAlpha Transparency at the beginning
* @param toAlpha Transparency at the end
* @param animationListener Animation monitor
* @return A transparency gradient animation, The default duration is 400ms.
*/
public static AlphaAnimation getAlphaAnimation(float fromAlpha, float toAlpha, Animation.AnimationListener animationListener) {
return getAlphaAnimation(fromAlpha, toAlpha, DEFAULT_ANIMATION_DURATION, animationListener);
}