/**
         * Animate.
         *
         * @param progressBar the progress bar
         * @param listener    the listener
         */
        void Animate(LibraryHoloCircularProgressBar.HoloCircularProgressBar progressBar, Android.Animation.Animator.IAnimatorListener listener)
        {
            float progress = (float)(Java.Lang.Math.Random() * 2);
            int   duration = 3000;

            Animate(progressBar, listener, progress, duration);
        }
        void Animate(LibraryHoloCircularProgressBar.HoloCircularProgressBar progressBar, Android.Animation.Animator.IAnimatorListener listener, float progress, int duration)
        {
            _progressBarAnimator = ObjectAnimator.OfFloat(progressBar, "progress", progress);
            _progressBarAnimator.SetDuration(duration);
            progressBar1 = progressBar;
            progress1    = progress;
            _progressBarAnimator.AddListener(this);
            if (listener != null)
            {
                _progressBarAnimator.AddListener(listener);
            }
            _progressBarAnimator.Reverse();
            _progressBarAnimator.AddUpdateListener(this);

            progressBar.SetMarkerProgress(progress);
            _progressBarAnimator.Start();
        }
        /*
         * (non-Javadoc)
         *
         * @see android.app.Activity#onCreate(android.os.Bundle)
         */
        protected override void OnCreate(Bundle bundle)
        {
            if (Intent != null)
            {
                Bundle extras = Intent.Extras;
                if (extras != null)
                {
                    int theme = extras.GetInt("theme");
                    if (theme != 0)
                    {
                        SetTheme(theme);
                    }
                }
            }
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            holoCircularProgressBar = FindViewById <LibraryHoloCircularProgressBar.HoloCircularProgressBar> (Resource.Id.holoCircularProgressBar);

            btnRandomColor        = FindViewById <Button> (Resource.Id.btnRandomColor);
            btnRandomColor.Click += (object sender, EventArgs e) => {
                SwitchColor();
            };
            btnZero        = FindViewById <Button> (Resource.Id.btnZero);
            btnZero.Click += (object sender, EventArgs e) => {
                if (_progressBarAnimator != null)
                {
                    _progressBarAnimator.Cancel();
                }
                Animate(holoCircularProgressBar, null, 0f, 1000);
                holoCircularProgressBar.SetMarkerProgress(0f);
            };
            btnOne        = FindViewById <Button> (Resource.Id.btnOne);
            btnOne.Click += (object sender, EventArgs e) => {
                if (_progressBarAnimator != null)
                {
                    _progressBarAnimator.Cancel();
                }
                Animate(holoCircularProgressBar, null, 1f, 1000);
                holoCircularProgressBar.SetMarkerProgress(1f);
            };
            togAnimation = FindViewById <ToggleButton> (Resource.Id.togAnimation);
            togAnimation.SetOnCheckedChangeListener(this);
        }
		/*
     * (non-Javadoc)
     *
     * @see android.app.Activity#onCreate(android.os.Bundle)
     */
		protected override void OnCreate (Bundle bundle)
		{
			if (Intent != null) {
				Bundle extras = Intent.Extras;
				if (extras != null) {
					int theme = extras.GetInt ("theme");
					if (theme != 0) {
						SetTheme (theme);
					}
				}
			}
			base.OnCreate (bundle);
			SetContentView (Resource.Layout.Main);

			holoCircularProgressBar = FindViewById<LibraryHoloCircularProgressBar.HoloCircularProgressBar> (Resource.Id.holoCircularProgressBar);

			btnRandomColor = FindViewById<Button> (Resource.Id.btnRandomColor);
			btnRandomColor.Click += (object sender, EventArgs e) => {
				SwitchColor ();
			};
			btnZero = FindViewById<Button> (Resource.Id.btnZero);
			btnZero.Click += (object sender, EventArgs e) => {
				if (_progressBarAnimator != null) {
					_progressBarAnimator.Cancel ();
				}
				Animate (holoCircularProgressBar, null, 0f, 1000);
				holoCircularProgressBar.SetMarkerProgress (0f);
			};
			btnOne = FindViewById<Button> (Resource.Id.btnOne);
			btnOne.Click += (object sender, EventArgs e) => {
				if (_progressBarAnimator != null) {
					_progressBarAnimator.Cancel ();
				}
				Animate (holoCircularProgressBar, null, 1f, 1000);
				holoCircularProgressBar.SetMarkerProgress (1f);
			};
			togAnimation = FindViewById<ToggleButton> (Resource.Id.togAnimation);
			togAnimation.SetOnCheckedChangeListener (this);
		}
		void Animate(LibraryHoloCircularProgressBar.HoloCircularProgressBar progressBar, Android.Animation.Animator.IAnimatorListener listener,float progress, int duration) {

			_progressBarAnimator = ObjectAnimator.OfFloat(progressBar, "progress", progress);
			_progressBarAnimator.SetDuration(duration);
			progressBar1 = progressBar;
			progress1 = progress;
			_progressBarAnimator.AddListener (this);
			if (listener != null) {
				_progressBarAnimator.AddListener(listener);
			}
			_progressBarAnimator.Reverse();
			_progressBarAnimator.AddUpdateListener (this);

			progressBar.SetMarkerProgress(progress);
			_progressBarAnimator.Start();
		}