private void SetValues()
        {
            _progressBar.SmoothProgressDrawableSpeed = _speed;
            _progressBar.SmoothProgressDrawableSectionsCount = _sectionsCount;
            _progressBar.SmoothProgressDrawableSeparatorLength = DpToPx(_separatorLength);
            _progressBar.SmoothProgressDrawableStrokeWidth = DpToPx(_strokeWidth);
            _progressBar.SmoothProgressDrawableReversed = _checkBoxReversed.Checked;
            _progressBar.SmoothProgressDrawableMirrorMode = _checkBoxMirror.Checked;

            IInterpolator interpolator;
            switch (_spinnerInterpolators.SelectedItemPosition)
            {
                case 1:
                    interpolator = new LinearInterpolator();
                    break;
                case 2:
                    interpolator = new AccelerateDecelerateInterpolator();
                    break;
                case 3:
                    interpolator = new DecelerateInterpolator();
                    break;
                default:
                    interpolator = new AccelerateInterpolator();
                    break;
            }

            _progressBar.SmoothProgressDrawableInterpolator = interpolator;
            _progressBar.SmoothProgressDrawableColors = IntsToColors(Resources.GetIntArray(Resource.Array.colors));
        }
Exemplo n.º 2
0
        private void bindChildAnimation(View child, int index, long duration)
        {
            bool expanded = mExpanded;
            int centerX = Width / 2;
            int centerY = Height / 2;
            int radius = expanded ? 0 : mRadius;

            int childCount = ChildCount;
            float perDegrees = (mToDegrees - mFromDegrees) / (childCount - 1);
            Rect frame = computeChildFrame(centerX, centerY, radius, mFromDegrees + index * perDegrees, mChildSize);

            int toXDelta = frame.Left - child.Left;
            int toYDelta = frame.Top - child.Top;

            IInterpolator interpolator;
            if (mExpanded)
                interpolator = new AccelerateInterpolator();
            else
                interpolator = new OvershootInterpolator(1.5f);
            long startOffset = computeStartOffset(childCount, mExpanded, index, 0.1f, duration, interpolator);

            Animation animation = mExpanded ? createShrinkAnimation(0, toXDelta, 0, toYDelta, startOffset, duration,
                    interpolator) : createExpandAnimation(0, toXDelta, 0, toYDelta, startOffset, duration, interpolator);

            bool isLast = getTransformedIndex(expanded, childCount, index) == childCount - 1;
            var animationListener = new AnimationListener(isLast);
            animationListener.OnAnimationEndEvent += () =>
                {
                    PostDelayed(new Action(
                    () =>
                    {
                        onAllAnimationsEnd();
                    }), 0);
                };
            animation.SetAnimationListener(animationListener);
            child.Animation = animation;
        }
		void SetInterpolator(int position) {
			IInterpolator CurrentInterpolator;
			switch (position) {
			case 1:
				CurrentInterpolator = new LinearInterpolator();
				_seekBarFactor.Enabled=false;
				break;
			case 2:
				CurrentInterpolator = new AccelerateDecelerateInterpolator();
				_seekBarFactor.Enabled=false;
				break;
			case 3:
				CurrentInterpolator = new DecelerateInterpolator(_factor);
				_seekBarFactor.Enabled=true;
				break;
			case 0:
			default:
				CurrentInterpolator = new AccelerateInterpolator(_factor);
				_seekBarFactor.Enabled=true;
				break;
			}

			_progressBar.SetSmoothProgressDrawableInterpolator(CurrentInterpolator);
			_progressBar.SetSmoothProgressDrawableColors(Resources.GetIntArray(Resource.Array.gplus_colors));
		}