本文整理匯總了Java中android.animation.ObjectAnimator.cancel方法的典型用法代碼示例。如果您正苦於以下問題:Java ObjectAnimator.cancel方法的具體用法?Java ObjectAnimator.cancel怎麽用?Java ObjectAnimator.cancel使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類android.animation.ObjectAnimator
的用法示例。
在下文中一共展示了ObjectAnimator.cancel方法的9個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: releaseAnimation
import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void releaseAnimation(){
ObjectAnimator animator = mAnimator.get();
if(animator != null){
animator.cancel();
mAnimator = new WeakReference<>(null);
}
}
示例2: destroy
import android.animation.ObjectAnimator; //導入方法依賴的package包/類
/**
* Need to call when Activity or Fragment destroy
*/
public void destroy() {
for (ObjectAnimator a : animators) {
a.removeAllListeners();
a.cancel();
}
}
示例3: cancelAndStartAnimators
import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private static void cancelAndStartAnimators(final ObjectAnimator animatorToCancel,
final ObjectAnimator animatorToStart) {
if (animatorToCancel == null || animatorToStart == null) {
// TODO: Stop using null as a no-operation animator.
return;
}
float startFraction = 0.0f;
if (animatorToCancel.isStarted()) {
animatorToCancel.cancel();
startFraction = 1.0f - animatorToCancel.getAnimatedFraction();
}
final long startTime = (long)(animatorToStart.getDuration() * startFraction);
animatorToStart.start();
animatorToStart.setCurrentPlayTime(startTime);
}
示例4: startDisplayLanguageOnSpacebar
import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public void startDisplayLanguageOnSpacebar(final boolean subtypeChanged,
final int languageOnSpacebarFormatType,
final boolean hasMultipleEnabledIMEsOrSubtypes) {
if (subtypeChanged) {
KeyPreviewView.clearTextCache();
}
mLanguageOnSpacebarFormatType = languageOnSpacebarFormatType;
mHasMultipleEnabledIMEsOrSubtypes = hasMultipleEnabledIMEsOrSubtypes;
final ObjectAnimator animator = mLanguageOnSpacebarFadeoutAnimator;
if (animator == null) {
mLanguageOnSpacebarFormatType = LanguageOnSpacebarUtils.FORMAT_TYPE_NONE;
} else {
if (subtypeChanged
&& languageOnSpacebarFormatType != LanguageOnSpacebarUtils.FORMAT_TYPE_NONE) {
setLanguageOnSpacebarAnimAlpha(Constants.Color.ALPHA_OPAQUE);
if (animator.isStarted()) {
animator.cancel();
}
animator.start();
} else {
if (!animator.isStarted()) {
mLanguageOnSpacebarAnimAlpha = mLanguageOnSpacebarFinalAlpha;
}
}
}
invalidateKey(mSpaceKey);
}
示例5: removePetView
import android.animation.ObjectAnimator; //導入方法依賴的package包/類
public void removePetView(int index) {
if (mPetViews.size() == 0) {
return;
}
PetView petView = mPetViews.get(index);
ObjectAnimator objectAnimator = petView.getObjectAnimator();
if (objectAnimator != null) {
objectAnimator.cancel();
}
mWindowManager.removeViewImmediate(petView);
mPetViews.remove(index);
mLayoutParams.remove(index);
}
示例6: cancelAnimator
import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private ObjectAnimator cancelAnimator(ObjectAnimator animator) {
if (animator != null) {
animator.removeAllListeners();
animator.cancel();
}
return null;
}
示例7: animatePicker
import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void animatePicker(boolean hoursToMinutes, long duration) {
final float target = hoursToMinutes ? HOURS : MINUTES;
if (mHoursToMinutes == target) {
// If we have a pending or running animator, cancel it.
if (mHoursToMinutesAnimator != null && mHoursToMinutesAnimator.isStarted()) {
mHoursToMinutesAnimator.cancel();
mHoursToMinutesAnimator = null;
}
// We're already showing the correct picker.
return;
}
ObjectAnimator oldHoursToMinutes = mHoursToMinutesAnimator;
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
mHoursToMinutesAnimator = ObjectAnimator.ofFloat(this, HOURS_TO_MINUTES, target);
} else {
mHoursToMinutesAnimator = ObjectAnimator.ofFloat(this, HOURS_TO_MINUTES_OLD, target);
}
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
mHoursToMinutesAnimator.setAutoCancel(true);
} else {
if (oldHoursToMinutes != null) {
oldHoursToMinutes.cancel();
}
}
mHoursToMinutesAnimator.setDuration(duration);
mHoursToMinutesAnimator.start();
}
示例8: cancelAnimator
import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private ObjectAnimator cancelAnimator(ObjectAnimator animator) {
if (animator != null) {
animator.cancel();
}
return null;
}
示例9: stopAnim
import android.animation.ObjectAnimator; //導入方法依賴的package包/類
private void stopAnim(ObjectAnimator mRotateAntiClockwiseAnimator) {
mCurrentPlayTime = mRotateAntiClockwiseAnimator.getCurrentPlayTime();
mRotateAntiClockwiseAnimator.cancel();
}