Java Code Examples for android.animation.ValueAnimator#setObjectValues()
The following examples show how to use
android.animation.ValueAnimator#setObjectValues() .
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: VerifyIdentityActivity.java From mollyim-android with GNU General Public License v3.0 | 6 votes |
private void setCodeSegment(final TextView codeView, String segment) { ValueAnimator valueAnimator = new ValueAnimator(); valueAnimator.setObjectValues(0, Integer.parseInt(segment)); valueAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { @Override public void onAnimationUpdate(ValueAnimator animation) { int value = (int) animation.getAnimatedValue(); codeView.setText(String.format(Locale.getDefault(), "%05d", value)); } }); valueAnimator.setEvaluator(new TypeEvaluator<Integer>() { public Integer evaluate(float fraction, Integer startValue, Integer endValue) { return Math.round(startValue + (endValue - startValue) * fraction); } }); valueAnimator.setDuration(1000); valueAnimator.start(); }
Example 2
Source File: WeatherView.java From Aurora with Apache License 2.0 | 6 votes |
private void startCloudTemplate(String mapTag, long delay, final CircleInfo circleInfo){ ValueAnimator valueAnimator=animMap.get(mapTag); if (valueAnimator==null){ valueAnimator=ValueAnimator.ofObject(new CircleTypeEvaluator(circleInfo),new CircleInfo(circleInfo.getX(),circleInfo.getY()+circleInfo.getRadius(),0) ,new CircleInfo(circleInfo.getX(),circleInfo.getY(),circleInfo.getRadius())); valueAnimator.setDuration(600); valueAnimator.addListener(new AnimatorListenerAdapter() { @Override public void onAnimationStart(Animator animation) { super.onAnimationStart(animation); circleInfo.setCanDraw(true); } }); animMap.put(mapTag,valueAnimator); } valueAnimator.setObjectValues(new CircleInfo(circleInfo.getX(),circleInfo.getY()+circleInfo.getRadius(),0) ,new CircleInfo(circleInfo.getX(),circleInfo.getY(),circleInfo.getRadius())); valueAnimator.setStartDelay(delay); startValueAnimator(valueAnimator); }
Example 3
Source File: CircularProgressView.java From NaviBee with GNU General Public License v3.0 | 5 votes |
private ValueAnimator getAnimator(double current, double next, long duration, ValueAnimator.AnimatorUpdateListener updateListener) { ValueAnimator animator = new ValueAnimator(); animator.setInterpolator(mInterpolator); animator.setDuration(duration); animator.setObjectValues(current, next); animator.setEvaluator(new FloatEvaluator() { public Integer evaluate(float fraction, float startValue, float endValue) { return Math.round(startValue + (endValue - startValue) * fraction); } }); animator.addUpdateListener(updateListener); return animator; }
Example 4
Source File: FragmentHome.java From AndroidSmartHome with Apache License 2.0 | 5 votes |
private void startCountAnimation(TextView textProgress, int duration, int from, int to) { ValueAnimator animator = new ValueAnimator(); animator.setObjectValues(from, to); animator.setDuration(duration); final TextView textView = textProgress; animator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() { public void onAnimationUpdate(ValueAnimator animation) { textView.setText("" + (int) animation.getAnimatedValue()+"%"); } }); animator.start(); }
Example 5
Source File: PathAnimatorInflater.java From ElasticProgressBar with Apache License 2.0 | 5 votes |
/** * Setup the Animator to achieve path morphing. * * @param anim The target Animator which will be updated. * @param arrayAnimator TypedArray for the ValueAnimator. * @return the PathDataEvaluator. */ private static TypeEvaluator setupAnimatorForPath(ValueAnimator anim, TypedArray arrayAnimator) { TypeEvaluator evaluator = null; String fromString = arrayAnimator.getString(R.styleable.Animator_vc_valueFrom); String toString = arrayAnimator.getString(R.styleable.Animator_vc_valueTo); PathParser.PathDataNode[] nodesFrom = PathParser.createNodesFromPathData(fromString); PathParser.PathDataNode[] nodesTo = PathParser.createNodesFromPathData(toString); if (nodesFrom != null) { if (nodesTo != null) { anim.setObjectValues(nodesFrom, nodesTo); if (!PathParser.canMorph(nodesFrom, nodesTo)) { throw new InflateException(arrayAnimator.getPositionDescription() + " Can't morph from " + fromString + " to " + toString); } } else { anim.setObjectValues((Object) nodesFrom); } evaluator = new PathDataEvaluator(PathParser.deepCopyNodes(nodesFrom)); } else if (nodesTo != null) { anim.setObjectValues((Object) nodesTo); evaluator = new PathDataEvaluator(PathParser.deepCopyNodes(nodesTo)); } if (DBG_ANIMATOR_INFLATER && evaluator != null) { Log.v(LOG_TAG, "create a new PathDataEvaluator here"); } return evaluator; }