Beispiel #1
0
		public AndroidTicker()
		{
			_val = new ValueAnimator();
			_val.SetIntValues(0, 100); // avoid crash
			_val.RepeatCount = ValueAnimator.Infinite;
			_val.Update += OnValOnUpdate;
		}
Beispiel #2
0
		public void Dispose()
		{
			if (_val != null)
			{
				_val.Update -= OnValOnUpdate;
				_val.Dispose();
			}
			_val = null;
		}
Beispiel #3
0
        public void Disappear()
        {
            if (animator != null) {
                animator.Cancel ();
                animator = null;
            }

            Alpha = 0;
        }
		public void SetCountAnimated (int count)
		{
			if (alphaAnimator != null) {
				alphaAnimator.Cancel ();
				alphaAnimator = null;
			}
			const int Duration = 300;

			alphaAnimator = ObjectAnimator.OfInt (this, "alpha", 0xFF, 0);
			alphaAnimator.SetDuration (Duration);
			alphaAnimator.RepeatMode = ValueAnimatorRepeatMode.Reverse;
			alphaAnimator.RepeatCount = 1;
			alphaAnimator.AnimationRepeat += (sender, e) => {
				((Animator)sender).RemoveAllListeners ();
				this.count = count;
			};
			alphaAnimator.Start ();
		}
        public void OnAnimationUpdate(ValueAnimator animation)
        {
            switch (success)
            {
                case true:
                    int value = (int)animation.AnimatedValue;
                    cirbutton.Progress = value;
                    break;

                case false:
                    int value2 = (int)animation.AnimatedValue;
                    cirbutton.Progress = value2;
                    if (value2 == 99)
                    {
                        cirbutton.Progress = -1;
                    }
                    break;

            }
        }
			protected override void OnAnimatorAttached()
			{
				base.OnAnimatorAttached();

				mHeaderText = Header.FindViewById(Resource.Id.header_text_layout);
				var tv = new TypedValue();
				int actionBarHeight = 0;
				if (mContext.Theme.ResolveAttribute(Android.Resource.Attribute.ActionBarSize, tv, true))
				{
					actionBarHeight = TypedValue.ComplexToDimensionPixelSize(tv.Data, mContext.Resources.DisplayMetrics);
				}
				mMinHeightTextHeader = mContext.Resources.GetDimensionPixelSize(Resource.Dimension.min_height_textheader_materiallike);

				mHeightStartAnimation = actionBarHeight + mMinHeightTextHeader;

				valueAnimator = ValueAnimator.OfInt(0);
				valueAnimator.SetDuration(mContext.Resources.GetInteger(Android.Resource.Integer.ConfigShortAnimTime));
				valueAnimator.Update += (sender, e) =>
				{
					ViewGroup.LayoutParams layoutParams = mHeaderText.LayoutParameters;
					layoutParams.Height = (int)e.Animation.AnimatedValue;
					mHeaderText.LayoutParameters = layoutParams;
				};
			}
Beispiel #7
0
        public void OnAnimationUpdate(ValueAnimator animation)
        {
            // update the mask scale
            int yPos = ((Java.Lang.Integer)animation.GetAnimatedValue("")).IntValue();

            ButtonLayout.SetY( yPos );
        }
 //@Override
 public   void OnAnimationUpdate(ValueAnimator animation)
 {
     ViewGroup.LayoutParams layoutParams = mView.LayoutParameters;
     layoutParams.Height = (int)animation.AnimatedValue;
     mView.LayoutParameters = layoutParams;
 }
Beispiel #9
0
        public void SetOrientation(ArrowOrientation orientation, bool animate = true)
        {
            Orientation = orientation;

            animator = ValueAnimator.OfFloat (0f, 1f);
            animator.SetDuration (250);
            animator.Update += (sender, e) => Alpha = (float)e.Animation.AnimatedValue;
            animator.AnimationEnd += (sender, e) => { animator.RemoveAllListeners (); animator = null; };
            animator.Start ();
        }
        void Initialize()
        {
            var display = Resources.DisplayMetrics;
            // Numbers and dots
            mainPaint = new Paint
            {
                AntiAlias = true,
                Color = Color.White,
                TextSize = TypedValue.ApplyDimension(ComplexUnitType.Sp, 12, display),
            };
            linePaint = new Paint
            {
                AntiAlias = true,
                Color = Color.Argb(0xaa, 0xff, 0xff, 0xff),
            };
            linePaint.SetStyle(Paint.Style.Stroke);
            ripple = Context.Resources.GetDrawable(Resource.Drawable.ripple_background);

            radius = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, BaseRadius, display);
            textMargin = (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 10, display);

            heightVariants = new []
            {
                0,
                (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 16, display),
                -(int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 14, display),
                (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 9, display),
            };

            shiverOffsets = new []
            {
                (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 9, display),
                (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 3, display),
                -(int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 8, display),
                (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 4, display),
                -(int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 7, display),
                (int)TypedValue.ApplyDimension(ComplexUnitType.Dip, 6, display),
            };
            shiverAnimator = ObjectAnimator.OfFloat(this, "scaleX", 0, 1);
            shiverAnimator.SetInterpolator(new TriangleWave());
            shiverAnimator.SetDuration(8000);
            shiverAnimator.RepeatCount = ValueAnimator.Infinite;
            shiverAnimator.AnimationRepeat += (sender, e) => shiverIndex++;
        }
Beispiel #11
0
        private static IntPtr n_SetDuration_J(IntPtr jnienv, IntPtr native__this, long duration)
        {
            ValueAnimator @object = Java.Lang.Object.GetObject <ValueAnimator> (native__this, JniHandleOwnership.DoNotTransfer) !;

            return(JNIEnv.ToJniHandle(@object.SetDuration(duration)));
        }
 public void OnAnimationUpdate(ValueAnimator valueAnimator)
 {
     // *** WARNING ***: triggering layout at each animation frame highly impacts
     // performance so you should only do this for simple layouts. More complicated
     // layouts can be better served with individual animations on child views to
     // avoid the performance penalty of layout.
     if (isPortrait) {
         lp.Height = (int) (Java.Lang.Integer) valueAnimator.AnimatedValue;
     } else {
         lp.Width = (int) (Java.Lang.Integer) valueAnimator.AnimatedValue;
     }
     titlesView.LayoutParameters = lp;
 }
			public void OnAnimationUpdate (ValueAnimator animation)
			{
				_onAnimationUpdate (animation);
			}
 //@Override
 public  void OnAnimationUpdate(ValueAnimator animation)
 {
     mAnimatingHoverDrawable.setTop((int)animation.AnimatedValue);
     minst.mWrapper.getListView().PostInvalidate();
 }
		public async void OnGlobalLayout ()
		{
			productImage.ViewTreeObserver.RemoveGlobalOnLayoutListener (this);

			const int DeltaX = 100;

			var img1 = Images.FromUrl (Product.ImageForSize (images [0], Images.ScreenWidth));
			var img2 = Images.FromUrl (Product.ImageForSize (images [1], Images.ScreenWidth));

			productDrawable = new KenBurnsDrawable (Color.DarkBlue);
			productDrawable.FirstBitmap = await img1;
			productDrawable.SecondBitmap = await img2;
			productImage.SetImageDrawable (productDrawable);
			currentIndex++;

			var evaluator = new MatrixEvaluator ();
			var finalMatrix = new Matrix ();
			finalMatrix.SetTranslate (-DeltaX, -(float)productDrawable.FirstBitmap.Height / 1.3f + (float)productImage.Height);
			finalMatrix.PostScale (1.27f, 1.27f);
			kenBurnsMovement = ValueAnimator.OfObject (evaluator, new Matrix (), finalMatrix);
			kenBurnsMovement.Update += (sender, e) => productDrawable.SetMatrix ((Matrix)e.Animation.AnimatedValue);
			kenBurnsMovement.SetDuration (14000);
			kenBurnsMovement.RepeatMode = ValueAnimatorRepeatMode.Reverse;
			kenBurnsMovement.RepeatCount = ValueAnimator.Infinite;
			kenBurnsMovement.Start ();

			kenBurnsAlpha = ObjectAnimator.OfInt (productDrawable, "alpha", 0, 0, 0, 255, 255, 255);
			kenBurnsAlpha.SetDuration (kenBurnsMovement.Duration);
			kenBurnsAlpha.RepeatMode = ValueAnimatorRepeatMode.Reverse;
			kenBurnsAlpha.RepeatCount = ValueAnimator.Infinite;
			kenBurnsAlpha.AnimationRepeat += (sender, e) => NextImage ();
			kenBurnsAlpha.Start ();
		}
Beispiel #16
0
        public void OnAnimationUpdate(ValueAnimator animation)
        {
            // update the container position
            int xPos = ((Java.Lang.Integer)animation.GetAnimatedValue("")).IntValue();

            PanContainerViews( xPos );
        }
Beispiel #17
0
        public CompassView(Context context, Android.Util.IAttributeSet attrs, int defStyle)
            : base(context, attrs, defStyle)
        {
            _paint = new Paint();
            _paint.SetStyle(Paint.Style.Fill);
            _paint.AntiAlias = true;
            _paint.TextSize = (float)DIRECTION_TEXT_HEIGHT;
            _paint.SetTypeface(Typeface.Create("sans-serif-thin", TypefaceStyle.Normal));

            _tickPaint = new Paint();
            _tickPaint.SetStyle(Paint.Style.Stroke);
            _tickPaint.StrokeWidth = (float)TICK_WIDTH;
            _tickPaint.AntiAlias = true;
            _tickPaint.Color = Color.White;

            _placePaint = new TextPaint();
            _placePaint.SetStyle(Paint.Style.Fill);
            _placePaint.AntiAlias = true;
            _placePaint.Color = Color.White;
            _placePaint.TextSize = (float)PLACE_TEXT_HEIGHT;
            _placePaint.SetTypeface(Typeface.Create("sans-serif-light", TypefaceStyle.Normal));

            _path = new Path();
            _textBounds = new Rect();
            _allBounds = new List<Rect>();

            _distanceFormat = NumberFormat.GetNumberInstance(Locale.Default);
            _distanceFormat.MinimumFractionDigits = 0;
            _distanceFormat.MaximumFractionDigits = 1;

            _placeBitmap = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.place_mark);
            _animatedHeading = Double.NaN;

            _directions = context.Resources.GetStringArray(Resource.Array.direction_abbreviations);

            _animator = new ValueAnimator();
            setupAnimator();
        }
Beispiel #18
0
 public void OnAnimationUpdate(ValueAnimator animation)
 {
     _animatedHeading = MathUtils.mod((float)_animator.GetAnimatedValue(null), 360.0f);
     Invalidate();
 }
Beispiel #19
0
		void OnValOnUpdate(object sender, ValueAnimator.AnimatorUpdateEventArgs e)
		{
			SendSignals();
		}
Beispiel #20
0
		public ExpandHelper(Context context, Callback callback, int small, int large) {
			this.smallSize = small;
			this.maximumStretch = Math.Max (smallSize, 1) * StretchInterval;
			this.largeSize = large;
			this.context = context;
			this.callback = callback;
			this.scaler = new ViewScaler();
			this.gravity = GravityFlags.Top;

			//this.scaleAnimation = ObjectAnimator.OfFloat (scaler, "Height", 0f);
			this.scaleAnimation = ValueAnimator.OfFloat (0f);
			this.scaleAnimation.Update += (sender, e) => scaler.Height = (float)e.Animation.AnimatedValue;
			this.scaleAnimation.SetDuration (ExpandDuration);

			AnimatorListenerAdapter glowVisibilityController = new AnimatorListener ();
			glowTopAnimation = ObjectAnimator.OfFloat (null, "alpha", 0f);
			glowTopAnimation.AddListener (glowVisibilityController);
			glowBottomAnimation = ObjectAnimator.OfFloat (null, "alpha", 0f);
			glowBottomAnimation.AddListener (glowVisibilityController);
			glowAnimationSet = new AnimatorSet();
			glowAnimationSet.Play (glowTopAnimation).With(glowBottomAnimation);
			glowAnimationSet.SetDuration(GlowDuration);

			detector = new DoubleSwipeDetector(context, new GestureDetector (this));
		}
		void ValueAnimator.IAnimatorUpdateListener.OnAnimationUpdate (ValueAnimator animation)
		{
			progressBar1.SetProgress((float) animation.AnimatedValue);
		}
Beispiel #22
0
		public void OnAnimationUpdate(ValueAnimator animation) {
			mBlurringView.Invalidate();
		}
Beispiel #23
0
 private void OnScrollAnimationUpdate (object sender, ValueAnimator.AnimatorUpdateEventArgs e)
 {
     translateY = (float)e.Animation.AnimatedValue;
     UpdateChildrenTranslationY ();
 }
Beispiel #24
0
        public void SetOpened(bool opened, bool animated = true)
        {
            this.opened = opened;
            if (!animated)
                SetNewOffset (opened ? MaxOffset : 0);
            else {
                if (animator != null) {
                    animator.Cancel ();
                    animator = null;
                }

                animator = ValueAnimator.OfInt (contentOffsetX, opened ? MaxOffset : 0);
                animator.SetInterpolator (interpolator);
                animator.SetDuration (Context.Resources.GetInteger (Android.Resource.Integer.ConfigMediumAnimTime));
                animator.Update += (sender, e) => SetNewOffset ((int)e.Animation.AnimatedValue);
                animator.AnimationEnd += (sender, e) => { animator.RemoveAllListeners (); animator = null; };
                animator.Start ();
            }
        }
		private ValueAnimator GetFocusToUnfocusAnimation() {
			if (_focusToUnfocusAnimation == null) {
				_focusToUnfocusAnimation = GetFocusAnimation(UnFocusedColor, _focusedColor);
			}
			return _focusToUnfocusAnimation;
		}
Beispiel #26
0
        private async void OnRequestOnboardingPage(OnboardingViewModel oVm)
        {
            _viewModel = oVm;
            AnimationInitUI();
            BindEvents();
            
            var mainAnimatorSet = new AnimatorSet();

            var appNameLayoutFinalTopSpace = TypedValue.ApplyDimension(ComplexUnitType.Dip, 55.0f, Application.Context.Resources.DisplayMetrics);

            var decelerateInterpolator = new DecelerateInterpolator(1.0f);

            var appNameLayoutAnimator = new ValueAnimator();
            appNameLayoutAnimator.SetDuration(750);
            appNameLayoutAnimator.SetInterpolator(decelerateInterpolator);
            appNameLayoutAnimator.SetFloatValues(_appNameLayout.GetY(), appNameLayoutFinalTopSpace);
            appNameLayoutAnimator.Update += (o, args) => { _appNameLayout.SetY((float)args.Animation.AnimatedValue); };

            var whatAccountsAnimator = new ValueAnimator();
            whatAccountsAnimator.SetDuration(750);
            whatAccountsAnimator.SetInterpolator(decelerateInterpolator);
            whatAccountsAnimator.SetFloatValues(0.0f, 1.0f);
            whatAccountsAnimator.Update += (o, args) => { _whatAccounts.Alpha = (float)args.Animation.AnimatedValue; };

            var appNameAnimationSet = new AnimatorSet();
            appNameAnimationSet.PlayTogether(appNameLayoutAnimator, whatAccountsAnimator);


            var socialButtonsAnimatorSet = new AnimatorSet();

            var overshootInterpolator = new OvershootInterpolator(3f);

            var facebookButtonAnimator = new ValueAnimator();
            facebookButtonAnimator.SetDuration(500);
            facebookButtonAnimator.SetInterpolator(overshootInterpolator);
            facebookButtonAnimator.SetFloatValues(_facebookButton.GetY() + _facebookButton.Height, _facebookButton.GetY());
            facebookButtonAnimator.Update += (o, args) =>
                {
                    _facebookButton.SetY((float)args.Animation.AnimatedValue);
                    _facebookButton.Alpha = args.Animation.AnimatedFraction;
                };

            var twitterButtonAnimator = new ValueAnimator();
            twitterButtonAnimator.SetDuration(500);
            twitterButtonAnimator.SetInterpolator(overshootInterpolator);
            twitterButtonAnimator.SetFloatValues(_facebookButton.GetY() + _facebookButton.Height, _facebookButton.GetY());
            twitterButtonAnimator.Update += (o, args) =>
                {
                    _twitterButton.SetY((float)args.Animation.AnimatedValue);
                    _twitterButton.Alpha = args.Animation.AnimatedFraction;
                };
            socialButtonsAnimatorSet.PlaySequentially(facebookButtonAnimator, twitterButtonAnimator);
            socialButtonsAnimatorSet.StartDelay = 500;

            var letsGoButtonAnimator = new ValueAnimator();
            letsGoButtonAnimator.SetDuration(500);
            letsGoButtonAnimator.SetInterpolator(decelerateInterpolator);
            letsGoButtonAnimator.SetFloatValues(0.0f, 1.0f);
            letsGoButtonAnimator.Update += (sender, args) =>
                {
                    _goButton.Alpha = (float)args.Animation.AnimatedValue;
                };

            mainAnimatorSet.PlaySequentially(appNameAnimationSet, socialButtonsAnimatorSet, letsGoButtonAnimator);

            await _viewModel.DidLoad();

            await Task.Delay(2000);

            mainAnimatorSet.Start();
            await _viewModel.DidAppear();
        }
 public void OnAnimationUpdate(ValueAnimator animation)
 {
     _marker.Alpha = (float)animation.AnimatedValue;
 }