Java Code Examples for android.animation.ObjectAnimator#setAutoCancel()
The following examples show how to use
android.animation.ObjectAnimator#setAutoCancel() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: RippleBackground.java From AcDisplay with GNU General Public License v2.0 | 6 votes |
/** * Starts the enter animation. */ public void enter() { cancel(); final int outerDuration = (int) (1000 * 1.0f / WAVE_OUTER_OPACITY_ENTER_VELOCITY); final ObjectAnimator outer = ObjectAnimator.ofFloat(this, "outerOpacity", 0, 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) outer.setAutoCancel(true); outer.setDuration(outerDuration); outer.setInterpolator(LINEAR_INTERPOLATOR); mAnimOuterOpacity = outer; // Enter animations always run on the UI thread, since it's unlikely // that anything interesting is happening until the user lifts their // finger. outer.start(); }
Example 2
Source File: RippleBackground.java From HeadsUp with GNU General Public License v2.0 | 6 votes |
/** * Starts the enter animation. */ public void enter() { cancel(); final int outerDuration = (int) (1000 * 1.0f / WAVE_OUTER_OPACITY_ENTER_VELOCITY); final ObjectAnimator outer = ObjectAnimator.ofFloat(this, "outerOpacity", 0, 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) outer.setAutoCancel(true); outer.setDuration(outerDuration); outer.setInterpolator(LINEAR_INTERPOLATOR); mAnimOuterOpacity = outer; // Enter animations always run on the UI thread, since it's unlikely // that anything interesting is happening until the user lifts their // finger. outer.start(); }
Example 3
Source File: RippleBackground.java From UltimateAndroid with Apache License 2.0 | 6 votes |
/** * Starts the enter animation. */ public void enter() { cancel(); final int outerDuration = (int) (1000 * 1.0f / WAVE_OUTER_OPACITY_ENTER_VELOCITY); final ObjectAnimator outer = ObjectAnimator.ofFloat(this, "outerOpacity", 0, 1); outer.setAutoCancel(true); outer.setDuration(outerDuration); outer.setInterpolator(LINEAR_INTERPOLATOR); mAnimOuterOpacity = outer; // Enter animations always run on the UI thread, since it's unlikely // that anything interesting is happening until the user lifts their // finger. outer.start(); }
Example 4
Source File: ProgressBar.java From android_9.0.0_r45 with Apache License 2.0 | 6 votes |
private synchronized void doRefreshProgress(int id, int progress, boolean fromUser, boolean callBackToApp, boolean animate) { int range = mMax - mMin; final float scale = range > 0 ? (progress - mMin) / (float) range : 0; final boolean isPrimary = id == R.id.progress; if (isPrimary && animate) { final ObjectAnimator animator = ObjectAnimator.ofFloat(this, VISUAL_PROGRESS, scale); animator.setAutoCancel(true); animator.setDuration(PROGRESS_ANIM_DURATION); animator.setInterpolator(PROGRESS_ANIM_INTERPOLATOR); animator.start(); } else { setVisualProgress(id, scale); } if (isPrimary && callBackToApp) { onProgressRefresh(scale, fromUser, progress); } }
Example 5
Source File: UDAnimator.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 6 votes |
/** * build a copy of given animator * * @return */ public Animator build() { //这种方式clone出来的animator不能重复播放 /* ObjectAnimator result = getAnimator().clone();//克隆一份 setupListeners(result); result.setupStartValues(); return result;*/ ObjectAnimator self = this.getAnimator(); ObjectAnimator anim = new ObjectAnimator(); anim.setTarget(self.getTarget()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { anim.setAutoCancel(true); } if (self.getValues() != null) { anim.setValues(self.getValues()); } anim.setInterpolator(self.getInterpolator()); anim.setDuration(self.getDuration()); anim.setStartDelay(self.getStartDelay()); anim.setRepeatCount(self.getRepeatCount()); anim.setRepeatMode(self.getRepeatMode()); setupListeners(anim); return anim; }
Example 6
Source File: Ripple.java From AcDisplay with GNU General Public License v2.0 | 5 votes |
/** * Starts the enter animation. */ public void enter() { cancel(); final int radiusDuration = (int) (1000 * Math.sqrt(mOuterRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensity) + 0.5); final ObjectAnimator radius = ObjectAnimator.ofFloat(this, "radiusGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) radius.setAutoCancel(true); radius.setDuration(radiusDuration); radius.setInterpolator(LINEAR_INTERPOLATOR); radius.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator cX = ObjectAnimator.ofFloat(this, "xGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) cX.setAutoCancel(true); cX.setDuration(radiusDuration); cX.setInterpolator(LINEAR_INTERPOLATOR); cX.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator cY = ObjectAnimator.ofFloat(this, "yGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) cY.setAutoCancel(true); cY.setDuration(radiusDuration); cY.setInterpolator(LINEAR_INTERPOLATOR); cY.setStartDelay(RIPPLE_ENTER_DELAY); mAnimRadius = radius; mAnimX = cX; mAnimY = cY; // Enter animations always run on the UI thread, since it's unlikely // that anything interesting is happening until the user lifts their // finger. radius.start(); cX.start(); cY.start(); }
Example 7
Source File: Ripple.java From AcDisplay with GNU General Public License v2.0 | 5 votes |
private void exitSoftware(int radiusDuration, int opacityDuration) { final ObjectAnimator radiusAnim = ObjectAnimator.ofFloat(this, "radiusGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) radiusAnim.setAutoCancel(true); radiusAnim.setDuration(radiusDuration); radiusAnim.setInterpolator(DECEL_INTERPOLATOR); final ObjectAnimator xAnim = ObjectAnimator.ofFloat(this, "xGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) xAnim.setAutoCancel(true); xAnim.setDuration(radiusDuration); xAnim.setInterpolator(DECEL_INTERPOLATOR); final ObjectAnimator yAnim = ObjectAnimator.ofFloat(this, "yGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) yAnim.setAutoCancel(true); yAnim.setDuration(radiusDuration); yAnim.setInterpolator(DECEL_INTERPOLATOR); final ObjectAnimator opacityAnim = ObjectAnimator.ofFloat(this, "opacity", 0); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) opacityAnim.setAutoCancel(true); opacityAnim.setDuration(opacityDuration); opacityAnim.setInterpolator(LINEAR_INTERPOLATOR); opacityAnim.addListener(mAnimationListener); mAnimRadius = radiusAnim; mAnimOpacity = opacityAnim; mAnimX = xAnim; mAnimY = yAnim; radiusAnim.start(); opacityAnim.start(); xAnim.start(); yAnim.start(); }
Example 8
Source File: UDAnimator.java From VideoOS-Android-SDK with GNU General Public License v3.0 | 5 votes |
public UDAnimator(Globals globals, LuaValue metaTable, Varargs varargs) { super(new ObjectAnimator(), globals, metaTable, varargs); ObjectAnimator animator = getAnimator(); if (animator != null) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { animator.setAutoCancel(true); } } }
Example 9
Source File: Ripple.java From UltimateAndroid with Apache License 2.0 | 5 votes |
/** * Starts the enter animation. */ public void enter() { cancel(); final int radiusDuration = (int) (1000 * Math.sqrt(mOuterRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensity) + 0.5); final ObjectAnimator radius = ObjectAnimator.ofFloat(this, "radiusGravity", 1); radius.setAutoCancel(true); radius.setDuration(radiusDuration); radius.setInterpolator(LINEAR_INTERPOLATOR); radius.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator cX = ObjectAnimator.ofFloat(this, "xGravity", 1); cX.setAutoCancel(true); cX.setDuration(radiusDuration); cX.setInterpolator(LINEAR_INTERPOLATOR); cX.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator cY = ObjectAnimator.ofFloat(this, "yGravity", 1); cY.setAutoCancel(true); cY.setDuration(radiusDuration); cY.setInterpolator(LINEAR_INTERPOLATOR); cY.setStartDelay(RIPPLE_ENTER_DELAY); mAnimRadius = radius; mAnimX = cX; mAnimY = cY; // Enter animations always run on the UI thread, since it's unlikely // that anything interesting is happening until the user lifts their // finger. radius.start(); cX.start(); cY.start(); }
Example 10
Source File: Ripple.java From UltimateAndroid with Apache License 2.0 | 5 votes |
private void exitSoftware(int radiusDuration, int opacityDuration) { final ObjectAnimator radiusAnim = ObjectAnimator.ofFloat(this, "radiusGravity", 1); radiusAnim.setAutoCancel(true); radiusAnim.setDuration(radiusDuration); radiusAnim.setInterpolator(DECEL_INTERPOLATOR); final ObjectAnimator xAnim = ObjectAnimator.ofFloat(this, "xGravity", 1); xAnim.setAutoCancel(true); xAnim.setDuration(radiusDuration); xAnim.setInterpolator(DECEL_INTERPOLATOR); final ObjectAnimator yAnim = ObjectAnimator.ofFloat(this, "yGravity", 1); yAnim.setAutoCancel(true); yAnim.setDuration(radiusDuration); yAnim.setInterpolator(DECEL_INTERPOLATOR); final ObjectAnimator opacityAnim = ObjectAnimator.ofFloat(this, "opacity", 0); opacityAnim.setAutoCancel(true); opacityAnim.setDuration(opacityDuration); opacityAnim.setInterpolator(LINEAR_INTERPOLATOR); opacityAnim.addListener(mAnimationListener); mAnimRadius = radiusAnim; mAnimOpacity = opacityAnim; mAnimX = xAnim; mAnimY = yAnim; radiusAnim.start(); opacityAnim.start(); xAnim.start(); yAnim.start(); }
Example 11
Source File: AddDeleteDrawable.java From MHViewer with Apache License 2.0 | 5 votes |
public void setShape(boolean delete, long duration) { if (!((!delete && mProgress == 0f) || (delete && mProgress == 1f))) { float endProgress = delete ? 1f : 0f; if (duration <= 0) { setProgress(endProgress); } else { ObjectAnimator oa = ObjectAnimator.ofFloat(this, "progress", endProgress); oa.setDuration(duration); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { oa.setAutoCancel(true); } oa.start(); } } }
Example 12
Source File: DrawerArrowDrawable.java From EhViewer with Apache License 2.0 | 5 votes |
public void setShape(boolean arrow, long duration) { if (!((!arrow && mProgress == 0f) || (arrow && mProgress == 1f))) { float endProgress = arrow ? 1f : 0f; if (duration <= 0) { setProgress(endProgress); } else { ObjectAnimator oa = ObjectAnimator.ofFloat(this, "progress", endProgress); oa.setDuration(duration); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { oa.setAutoCancel(true); } oa.start(); } } }
Example 13
Source File: AddDeleteDrawable.java From EhViewer with Apache License 2.0 | 5 votes |
public void setShape(boolean delete, long duration) { if (!((!delete && mProgress == 0f) || (delete && mProgress == 1f))) { float endProgress = delete ? 1f : 0f; if (duration <= 0) { setProgress(endProgress); } else { ObjectAnimator oa = ObjectAnimator.ofFloat(this, "progress", endProgress); oa.setDuration(duration); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { oa.setAutoCancel(true); } oa.start(); } } }
Example 14
Source File: Ripple.java From HeadsUp with GNU General Public License v2.0 | 5 votes |
/** * Starts the enter animation. */ public void enter() { cancel(); final int radiusDuration = (int) (1000 * Math.sqrt(mOuterRadius / WAVE_TOUCH_DOWN_ACCELERATION * mDensity) + 0.5); final ObjectAnimator radius = ObjectAnimator.ofFloat(this, "radiusGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) radius.setAutoCancel(true); radius.setDuration(radiusDuration); radius.setInterpolator(LINEAR_INTERPOLATOR); radius.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator cX = ObjectAnimator.ofFloat(this, "xGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) cX.setAutoCancel(true); cX.setDuration(radiusDuration); cX.setInterpolator(LINEAR_INTERPOLATOR); cX.setStartDelay(RIPPLE_ENTER_DELAY); final ObjectAnimator cY = ObjectAnimator.ofFloat(this, "yGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) cY.setAutoCancel(true); cY.setDuration(radiusDuration); cY.setInterpolator(LINEAR_INTERPOLATOR); cY.setStartDelay(RIPPLE_ENTER_DELAY); mAnimRadius = radius; mAnimX = cX; mAnimY = cY; // Enter animations always run on the UI thread, since it's unlikely // that anything interesting is happening until the user lifts their // finger. radius.start(); cX.start(); cY.start(); }
Example 15
Source File: Ripple.java From HeadsUp with GNU General Public License v2.0 | 5 votes |
private void exitSoftware(int radiusDuration, int opacityDuration) { final ObjectAnimator radiusAnim = ObjectAnimator.ofFloat(this, "radiusGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) radiusAnim.setAutoCancel(true); radiusAnim.setDuration(radiusDuration); radiusAnim.setInterpolator(DECEL_INTERPOLATOR); final ObjectAnimator xAnim = ObjectAnimator.ofFloat(this, "xGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) xAnim.setAutoCancel(true); xAnim.setDuration(radiusDuration); xAnim.setInterpolator(DECEL_INTERPOLATOR); final ObjectAnimator yAnim = ObjectAnimator.ofFloat(this, "yGravity", 1); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) yAnim.setAutoCancel(true); yAnim.setDuration(radiusDuration); yAnim.setInterpolator(DECEL_INTERPOLATOR); final ObjectAnimator opacityAnim = ObjectAnimator.ofFloat(this, "opacity", 0); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) opacityAnim.setAutoCancel(true); opacityAnim.setDuration(opacityDuration); opacityAnim.setInterpolator(LINEAR_INTERPOLATOR); opacityAnim.addListener(mAnimationListener); mAnimRadius = radiusAnim; mAnimOpacity = opacityAnim; mAnimX = xAnim; mAnimY = yAnim; radiusAnim.start(); opacityAnim.start(); xAnim.start(); yAnim.start(); }
Example 16
Source File: DrawerArrowDrawable.java From MHViewer with Apache License 2.0 | 5 votes |
public void setShape(boolean arrow, long duration) { if (!((!arrow && mProgress == 0f) || (arrow && mProgress == 1f))) { float endProgress = arrow ? 1f : 0f; if (duration <= 0) { setProgress(endProgress); } else { ObjectAnimator oa = ObjectAnimator.ofFloat(this, "progress", endProgress); oa.setDuration(duration); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) { oa.setAutoCancel(true); } oa.start(); } } }
Example 17
Source File: MainActivity.java From scissors with Apache License 2.0 | 4 votes |
@TargetApi(Build.VERSION_CODES.JELLY_BEAN_MR2) static void autoCancel(ObjectAnimator objectAnimator) { if (Build.VERSION.SDK_INT > Build.VERSION_CODES.JELLY_BEAN_MR2) { objectAnimator.setAutoCancel(true); } }