本文整理匯總了Java中android.view.animation.Animation.setAnimationListener方法的典型用法代碼示例。如果您正苦於以下問題:Java Animation.setAnimationListener方法的具體用法?Java Animation.setAnimationListener怎麽用?Java Animation.setAnimationListener使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.view.animation.Animation
的用法示例。
在下文中一共展示了Animation.setAnimationListener方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: startScaleDownReturnToStartAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private void startScaleDownReturnToStartAnimation(int from,
Animation.AnimationListener listener) {
mFrom = from;
if (isAlphaUsedForScale()) {
mStartingScale = mRefreshView.getAlpha();
} else {
mStartingScale = ViewCompat.getScaleX(mRefreshView);
}
mScaleDownToStartAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
float targetScale = (mStartingScale + (-mStartingScale * interpolatedTime));
setAnimationProgress(targetScale);
moveToStart(interpolatedTime);
}
};
mScaleDownToStartAnimation.setDuration(SCALE_DOWN_DURATION);
if (listener != null) {
mScaleDownToStartAnimation.setAnimationListener(listener);
}
mRefreshView.clearAnimation();
mRefreshView.startAnimation(mScaleDownToStartAnimation);
}
示例2: show
import android.view.animation.Animation; //導入方法依賴的package包/類
void show(@Nullable final InternalVisibilityChangedListener listener, boolean fromUser) {
if (this.mView.getVisibility() != 0 || this.mIsHiding) {
this.mView.clearAnimation();
this.mView.internalSetVisibility(0, fromUser);
Animation anim = AnimationUtils.loadAnimation(this.mView.getContext(), R.anim.design_fab_in);
anim.setDuration(200);
anim.setInterpolator(AnimationUtils.LINEAR_OUT_SLOW_IN_INTERPOLATOR);
anim.setAnimationListener(new AnimationListenerAdapter() {
public void onAnimationEnd(Animation animation) {
if (listener != null) {
listener.onShown();
}
}
});
this.mView.startAnimation(anim);
} else if (listener != null) {
listener.onShown();
}
}
示例3: enterAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private void enterAnimation()
{
Animation slideEnter = AnimationUtils.loadAnimation(getContext(), AnimUtils.getAnimationEnter(SnackBarTypePosition.BOTTOM));
slideEnter.setAnimationListener(new AnimListener()
{
@Override
public void onAnimationEnd(Animation animation)
{
post(new Runnable()
{
@Override
public void run()
{
start(LENGTH_SHORT);
}
});
}
});
startAnimation(slideEnter);
}
示例4: 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();
}
}
示例5: startScaleUpAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
private void startScaleUpAnimation(Animation.AnimationListener listener) {
mRefreshView.setVisibility(View.VISIBLE);
if (android.os.Build.VERSION.SDK_INT >= 11) {
// Pre API 11, alpha is used in place of scale up to show the
// progress circle appearing.
// Don't adjust the alpha during appearance otherwise.
//mProgress.setAlpha(MAX_ALPHA);
}
mScaleAnimation = new Animation() {
@Override
public void applyTransformation(float interpolatedTime, Transformation t) {
setAnimationProgress(interpolatedTime);
}
};
mScaleAnimation.setDuration(mMediumAnimationDuration);
mScaleAnimation.setAnimationListener(listener);
mRefreshView.clearAnimation();
mRefreshView.startAnimation(mScaleAnimation);
}
示例6: animHidden
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* 使用{@link Animation}隱藏view
*
* @param v
* @param isGoneType :true 使用{@link #gone(View, boolean)},false 使用
* {@link #invisible(View, boolean)}
* @param gone
* @param animation
*/
public static void animHidden(final View v, final boolean isGoneType, final boolean gone, Animation animation) {
if (isGoneType) {
if (gone && View.GONE == v.getVisibility()) {
return;
}
} else {
if (gone && View.INVISIBLE == v.getVisibility()) {
return;
}
}
if (!gone && View.VISIBLE == v.getVisibility()) {
return;
}
animation.setAnimationListener(new IViewAnimationListener(v, isGoneType, gone));
v.startAnimation(animation);
}
示例7: setupAnimations
import android.view.animation.Animation; //導入方法依賴的package包/類
private void setupAnimations(Animation in, Animation out) {
if (QMail.showAnimations()) {
setInAnimation(in);
setOutAnimation(out);
out.setAnimationListener(this);
} else {
setInAnimation(null);
setOutAnimation(null);
}
}
示例8: onCreate
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
//啟動友盟推送服務
PushAgent pushAgent = PushAgent.getInstance(this);
if (checkLoginedOrGoToMain(false)) {
pushAgent.enable();
} else {
//由於本頁麵處理時間較短,所以如果要處理相關回調的話,應該在主Activity中進行。
pushAgent.enable(new IUmengRegisterCallback() {
@Override
public void onRegistered(final String registrationId) {
runOnUiThread(new Runnable() {
@Override
public void run() {
L.i(WelcomeActy.class, registrationId);
//L.i(WelcomeActy.class, UmengRegistrar.getRegistrationId(WelcomeActy.this));
}
});
}
});
}
mLoginPanel.setVisibility(View.GONE);
mImgMarket360Safe.setVisibility(View.GONE);
mImgMarketYingYongBao.setVisibility(View.GONE);
mImgMarketBaiDu.setVisibility(View.GONE);
mTextMarketBaiDu.setVisibility(View.GONE);
mTextTest.setVisibility(Debug.DEBUG ? View.VISIBLE : View.GONE);
if (Debug.DEBUG) mTextTest.setTypeface(FontUtils.getTypefaceWithCode(this, 1));
Animation anim = AnimationUtils.loadAnimation(this, R.anim.m_welcome_logo);
anim.setAnimationListener(mLogoAnimListener);
mImgLogo.startAnimation(anim);
}
示例9: OutToBottomAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
public OutToBottomAnimation(Context context, View animView, View nextView) {
this.context = context;
this.nextView = nextView;
this.animView = animView;
Animation animation = AnimationUtils.loadAnimation(context, R.anim.kf5_anim_out_to_bottom);
animation.setAnimationListener(this);
animation.setFillAfter(false);
animView.startAnimation(animation);
}
示例10: onClick
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
public void onClick(View v) {
if (disabledClick)
return;
this.config = !this.config;
Log.d("onClick", "Row ID" + v.getId());
//Toast.makeText(this.context, "Found row with title : " + this.title.getText(), Toast.LENGTH_SHORT).show();
Animation fadeOut = new AlphaAnimation(1.0f, 0.0f);
fadeOut.setAnimationListener(this);
fadeOut.setDuration(500);
fadeOut.setStartOffset(0);
Animation fadeIn = new AlphaAnimation(0.0f, 1.0f);
fadeIn.setAnimationListener(this);
fadeIn.setDuration(500);
fadeIn.setStartOffset(250);
if (this.config == true) {
this.sl1.startAnimation(fadeOut);
if ((this.sl2.isEnabled())) this.sl2.startAnimation(fadeOut);
if ((this.sl3.isEnabled())) this.sl3.startAnimation(fadeOut);
this.value.startAnimation(fadeOut);
this.onOffLegend.startAnimation(fadeIn);
this.onOff.startAnimation(fadeIn);
this.periodLegend.startAnimation(fadeIn);
this.periodBar.startAnimation(fadeIn);
} else {
this.sl1.startAnimation(fadeIn);
if ((this.sl2.isEnabled())) this.sl2.startAnimation(fadeIn);
if ((this.sl3.isEnabled())) this.sl3.startAnimation(fadeIn);
this.value.startAnimation(fadeIn);
this.onOffLegend.startAnimation(fadeOut);
this.onOff.startAnimation(fadeOut);
this.periodLegend.startAnimation(fadeOut);
this.periodBar.startAnimation(fadeOut);
}
}
示例11: collapse
import android.view.animation.Animation; //導入方法依賴的package包/類
/**
* Animate the view to shrink vertically
*
* @param v
* @param al
*/
private void collapse(final View v, Animation.AnimationListener al) {
final int initialHeight = v.getMeasuredHeight();
Animation anim = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
if (interpolatedTime == 1) {
v.getLayoutParams().height = initialHeight;
} else {
v.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
v.requestLayout();
}
}
@Override
public boolean willChangeBounds() {
return true;
}
};
if (al != null) {
anim.setAnimationListener(al);
}
anim.setDuration(ANIMATION_DURATION);
v.startAnimation(anim);
}
示例12: onCreateAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
@Override
public Animation onCreateAnimation(int transit, boolean enter, int nextAnim) {
Animation animation;
if (enter) {
animation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_in);
animation.setAnimationListener(mAnimationListener);
} else {
animation = AnimationUtils.loadAnimation(getActivity(), android.R.anim.fade_out);
}
AnimationSet animationSet = new AnimationSet(false);
animationSet.addAnimation(animation);
return animationSet;
}
示例13: setMenuCloseAnimation
import android.view.animation.Animation; //導入方法依賴的package包/類
public void setMenuCloseAnimation(Animation menuCloseAnimation) {
if (menuCloseAnimation == null) {
menuCloseAnimation = AnimationUtils.loadAnimation(mContext, R.anim.anim_null);
}
if (menuCloseAnimation.getDuration() == 0) {
menuCloseAnimation.setDuration(mOptionSD_AnimationDuration);
}
menuCloseAnimation.setAnimationListener(animationListener);
this.menuCloseAnimation = menuCloseAnimation;
}
示例14: animateRightToLeft
import android.view.animation.Animation; //導入方法依賴的package包/類
private void animateRightToLeft() {
setClickable(false);
final float finalLeft;
final float origLeft;
if (getCurrentState() == HBButtonState.NORMAL) {
origLeft = mRFSlider.left;
finalLeft = mRFSlider.left - mWidth / 3 * 2;
} else {
origLeft = mRFSlider.left;
finalLeft = mRFSlider.left + mWidth / 3 * 2;
}
Animation animation = new Animation() {
@Override
protected void applyTransformation(float interpolatedTime, Transformation t) {
super.applyTransformation(interpolatedTime, t);
if (getCurrentState() == HBButtonState.NORMAL) {
mRFSlider.set(origLeft - (origLeft - finalLeft) * interpolatedTime, mRFSlider.top, mRFSlider.right, mRFSlider.bottom);
} else {
mRFSlider.set(origLeft + (finalLeft - origLeft) * interpolatedTime, mRFSlider.top, mRFSlider.right, mRFSlider.bottom);
}
invalidate();
}
};
animation.setDuration(getAnimationDuration() + OFFSET_FIRST * 3);
animation.setAnimationListener(stateChangeListener);
Animation animationLineTop = generateLineRTLAnimation(mLineTop, 0);
Animation animationLineCenter = generateLineRTLAnimation(mLineCenter, OFFSET_FIRST);
Animation animationLineBottom = generateLineRTLAnimation(mLineBottom, OFFSET_FIRST * 2);
AnimationSet animationSet = new AnimationSet(false);
animationSet.addAnimation(animation);
animationSet.addAnimation(animationLineTop);
animationSet.addAnimation(animationLineCenter);
animationSet.addAnimation(animationLineBottom);
startAnimation(animationSet);
}
示例15: baseOut
import android.view.animation.Animation; //導入方法依賴的package包/類
private static void baseOut(View view, Animation animation, long durationMillis, long delayMillis) {
setEffect(animation, Default, durationMillis, delayMillis);
animation.setAnimationListener(new MyAnimationListener(view));
view.startAnimation(animation);
}