本文整理汇总了Java中android.animation.Animator.cancel方法的典型用法代码示例。如果您正苦于以下问题:Java Animator.cancel方法的具体用法?Java Animator.cancel怎么用?Java Animator.cancel使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类android.animation.Animator
的用法示例。
在下文中一共展示了Animator.cancel方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: addIndicator
import android.animation.Animator; //导入方法依赖的package包/类
private void addIndicator(int orientation, @DrawableRes int backgroundDrawableId,
Animator animator) {
if (animator.isRunning()) {
animator.end();
animator.cancel();
}
View Indicator = new View(getContext());
Indicator.setBackgroundResource(backgroundDrawableId);
addView(Indicator, mIndicatorWidth, mIndicatorHeight);
LayoutParams lp = (LayoutParams) Indicator.getLayoutParams();
if (orientation == HORIZONTAL) {
lp.leftMargin = mIndicatorMargin;
lp.rightMargin = mIndicatorMargin;
} else {
lp.topMargin = mIndicatorMargin;
lp.bottomMargin = mIndicatorMargin;
}
Indicator.setLayoutParams(lp);
animator.setTarget(Indicator);
animator.start();
}
示例2: snapChildIfNeeded
import android.animation.Animator; //导入方法依赖的package包/类
/**
* Called when a view is updated to be non-dismissable, if the view was being dismissed before
* the update this will handle snapping it back into place.
*
* @param view the view to snap if necessary.
* @param animate whether to animate the snap or not.
* @param targetLeft the target to snap to.
*/
public void snapChildIfNeeded(final View view, boolean animate, float targetLeft) {
if ((mDragging && mCurrView == view) || mSnappingChild) {
return;
}
boolean needToSnap = false;
Animator dismissPendingAnim = mDismissPendingMap.get(view);
if (dismissPendingAnim != null) {
needToSnap = true;
dismissPendingAnim.cancel();
} else if (getTranslation(view) != 0) {
needToSnap = true;
}
if (needToSnap) {
if (animate) {
snapChild(view, targetLeft, 0.0f /* velocity */);
} else {
snapChildInstantly(view);
}
}
}
示例3: stop
import android.animation.Animator; //导入方法依赖的package包/类
/**
* Call this to explicitly stop progress animation specified by {@code mType}.
*/
public void stop() {
Animator animator;
if (mAlphaValueAnimatorList != null) {
for (int i = 0; i < mAlphaValueAnimatorList.size(); ++i) {
animator = mAlphaValueAnimatorList.get(i);
if (animator != null) {
animator.cancel();
}
}
mAlphaValueAnimatorList.clear();
}
if (mBetaValueAnimatorList != null) {
for (int i = 0; i < mBetaValueAnimatorList.size(); ++i) {
animator = mBetaValueAnimatorList.get(i);
if (animator != null) {
animator.cancel();
}
}
mBetaValueAnimatorList.clear();
}
}
示例4: setAnimationStatus
import android.animation.Animator; //导入方法依赖的package包/类
/**
* make animation to start or end when target
* view was be Visible or Gone or Invisible.
* make animation to cancel when target view
* be onDetachedFromWindow.
* @param animStatus
*/
public void setAnimationStatus(AnimStatus animStatus){
if (mAnimators==null){
return;
}
int count=mAnimators.size();
for (int i = 0; i < count; i++) {
Animator animator=mAnimators.get(i);
boolean isRunning=animator.isRunning();
switch (animStatus){
case START:
if (!isRunning){
animator.start();
}
break;
case END:
if (isRunning){
animator.end();
}
break;
case CANCEL:
if (isRunning){
animator.cancel();
}
break;
}
}
}
示例5: onDestroyActivity
import android.animation.Animator; //导入方法依赖的package包/类
public static void onDestroyActivity() {
HashSet<Animator> animators = new HashSet<Animator>(sAnimators.keySet());
for (Animator a : animators) {
if (a.isRunning()) {
a.cancel();
}
sAnimators.remove(a);
}
}
示例6: dismiss
import android.animation.Animator; //导入方法依赖的package包/类
private void dismiss() {
for (Animator animator : mTotalAnimList) {
animator.cancel();
}
if (!mAlphaAnim.isRunning()) {
mAlphaAnim.start();
}
}
示例7: onDestroyActivity
import android.animation.Animator; //导入方法依赖的package包/类
static void onDestroyActivity() {
HashSet<Animator> animators = new HashSet<Animator>(sAnimators.keySet());
for (Animator a : animators) {
if (a.isRunning()) {
a.cancel();
}
sAnimators.remove(a);
}
}
示例8: cancelAnim
import android.animation.Animator; //导入方法依赖的package包/类
void cancelAnim(Animator animator) {
if (animator == null) {
//LogUtil.d("cancel anim : name you have given have animator is null or not exists");
return;
}
boolean cancel = isAnimatorCurrentlyRunning(animator) || isAnimatorCurrentlyPaused(animator);
//LogUtil.d("canceling animator : " + name + " canCancel : " + cancel);
if (cancel) {
animator.cancel();
}
}
示例9: stopWobble
import android.animation.Animator; //导入方法依赖的package包/类
@TargetApi(Build.VERSION_CODES.HONEYCOMB)
private void stopWobble(boolean resetRotation) {
for (Animator wobbleAnimator : mWobbleAnimators) {
wobbleAnimator.cancel();
}
mWobbleAnimators.clear();
for (int i = 0; i < getChildCount(); i++) {
View v = getChildAt(i);
if (v != null) {
if (resetRotation) v.setRotation(0);
v.setTag(R.id.wobble_tag, false);
}
}
}
示例10: cancel
import android.animation.Animator; //导入方法依赖的package包/类
/**
* cancel
*
* @param animator
* @return
*/
public static boolean cancel(Animator animator) {
if (animator != null) {
animator.cancel();
return true;
}
return false;
}
示例11: cancel
import android.animation.Animator; //导入方法依赖的package包/类
@Override
public void cancel() {
Animator a = mAnimator.get();
if(a != null){
a.cancel();
}
}
示例12: setAnimationStatus
import android.animation.Animator; //导入方法依赖的package包/类
/**
* make animation to start or end when target
* view was be Visible or Gone or Invisible.
* make animation to cancel when target view
* be onDetachedFromWindow.
*
* @param animStatus
*/
public void setAnimationStatus(AnimStatus animStatus) {
if (mAnimators == null) {
return;
}
int count = mAnimators.size();
for (int i = 0; i < count; i++) {
Animator animator = mAnimators.get(i);
boolean isRunning = animator.isRunning();
switch (animStatus) {
case START:
if (!isRunning) {
animator.start();
}
break;
case END:
if (isRunning) {
animator.end();
}
break;
case CANCEL:
if (isRunning) {
animator.cancel();
}
break;
}
}
}
示例13: cancel
import android.animation.Animator; //导入方法依赖的package包/类
@Override
public void cancel() {
Animator a = mAnimator.get();
if (a != null) {
a.cancel();
}
}
示例14: cancelAnimations
import android.animation.Animator; //导入方法依赖的package包/类
private void cancelAnimations() {
mTmpArray.addAll(mRunningAnimations);
int size = mTmpArray.size();
for (int i = 0; i < size; i++) {
Animator a = mTmpArray.get(i);
a.cancel();
}
mTmpArray.clear();
mRunningAnimations.clear();
}
示例15: setAnimationStatus
import android.animation.Animator; //导入方法依赖的package包/类
public void setAnimationStatus(BallSpinFadeLoadingView.AnimStatus status) {
if (mAnimators == null) {
return;
}
int count = mAnimators.size();
for (int i = 0; i < count; i++) {
Animator animator = mAnimators.get(i);
boolean isRunning = animator.isRunning();
switch (status) {
case START:
if (!isRunning) {
animator.start();
}
break;
case END:
if (isRunning) {
animator.end();
}
break;
case CANCEL:
if (isRunning) {
animator.cancel();
}
break;
}
}
}