コード例 #1
0
ファイル: SliderView.cs プロジェクト: 42Spikes/F2S
        private void animateCountTo(float paramFloat)
        {
            if ((this.countAnimator != null) && (this.countAnimator.IsRunning))
                this.countAnimator.Cancel();

            float[] arrayOfFloat = new float[2];
            arrayOfFloat[0] = this.animatedCount;
            arrayOfFloat[1] = paramFloat;
            this.countAnimator = ObjectAnimator.OfFloat(this, "animatedCount", arrayOfFloat);
            this.countAnimator.SetDuration(300L);
            this.countAnimator.Start();
        }
コード例 #2
0
 void HideSwipeDown()
 {
     ActionBar.Show ();
     swipeText.Visibility = ViewStates.Invisible;
     bar1Fade = ObjectAnimator.OfInt (bar1, "progress", bar1.Progress, 0);
     bar1Fade.SetDuration (250);
     bar1Fade.Start ();
     bar2Fade = ObjectAnimator.OfInt (bar2, "progress", bar2.Progress, 0);
     bar2Fade.SetDuration (250);
     bar2Fade.Start ();
     bar2Fade.AnimationEnd += (sender, e) => loadingBars.Visibility = ViewStates.Gone;
     setup = false;
 }
コード例 #3
0
		void _fadeOut_AnimationEnd (object sender, EventArgs e)
		{
			this._Token.Cancel ();
			this._Token.Dispose ();
			this._Token = null;

			_Layout.Touch -= LayoutTouched;
			_Layout.Visibility = ViewStates.Gone;
			_fadeOut.AnimationEnd -= _fadeOut_AnimationEnd;

			_Set.Dispose ();
			_Set = null;

			_fadeOut.RemoveAllListeners ();
			_fadeOut.Dispose ();
			_fadeOut = null;

			_Layout.Dispose ();
			_Layout = null;
		}
コード例 #4
0
		protected override void OnFinishInflate()
		{
			base.OnFinishInflate();
			label = FindViewById<TextView>(Resource.Id.Label);
			circle = FindViewById<CircledImageView>(Resource.Id.Circle);

			expandCircleRadius = circle.CircleRadius;
			shrinkCircleRadius = expandCircleRadius * ShrinkCricleRatio;

			shrinkCircleAnimator = ObjectAnimator.OfFloat(circle, "circleRadius", expandCircleRadius, shrinkCircleRadius);
			shrinkLabelAnimator = ObjectAnimator.OfFloat(label, "alpha", ExpandLabelAlpha, ShrinkLabelAlpha);

			// FIXME Xamarin: new AnimatorSet().SetDuration(long) should return an AnimatorSet
			shrinkAnimator = new AnimatorSet();
			shrinkAnimator.SetDuration(AnimationDurationMs);
			shrinkAnimator.PlayTogether(shrinkCircleAnimator, shrinkLabelAnimator);

			expandCircleAnimator = ObjectAnimator.OfFloat(circle, "circleRadius", shrinkCircleRadius, expandCircleRadius);
			expandLabelAnimator = ObjectAnimator.OfFloat(label, "alpha", ShrinkLabelAlpha, ExpandLabelAlpha);
			expandAnimator = new AnimatorSet();
			expandAnimator.SetDuration(AnimationDurationMs);
			expandAnimator.PlayTogether(expandCircleAnimator, expandLabelAnimator);
		}
コード例 #5
0
ファイル: FastScroller.cs プロジェクト: dbeattie71/FastScroll
 private void showBubble()
 {
     bubble.Visibility = ViewStates.Visible;
     if(currentAnimator!=null)
         currentAnimator.Cancel();
     currentAnimator = (ObjectAnimator)ObjectAnimator.OfFloat(bubble, "alpha", 0f, 1f).SetDuration(BUBBLE_ANIMATION_DURATION);
     currentAnimator.Start();
 }
コード例 #6
0
ファイル: FastScroller.cs プロジェクト: dbeattie71/FastScroll
 private void hideBubble()
 {
     if(currentAnimator != null)
         currentAnimator.Cancel();
     currentAnimator = (ObjectAnimator)ObjectAnimator.OfFloat(bubble,"alpha",1f,0f).SetDuration(BUBBLE_ANIMATION_DURATION);
     currentAnimator.AddListener(new MyListener(this));
     currentAnimator.Start();
 }
コード例 #7
0
        private void SetupAnimations()
        {
            _objectAnimatorAngle = ObjectAnimator.OfFloat(this, _angleProperty, 360f);
            _objectAnimatorAngle.SetInterpolator(ANGLE_INTERPOLATOR);
            _objectAnimatorAngle.SetDuration(ANGLE_ANIMATOR_DURATION);
            _objectAnimatorAngle.RepeatMode = ValueAnimatorRepeatMode.Restart;
            _objectAnimatorAngle.RepeatCount = ValueAnimator.Infinite;

            _objectAnimatorSweep = ObjectAnimator.OfFloat(this, _sweepProperty, 360f - MIN_SWEEP_ANGLE * 2);
            _objectAnimatorSweep.SetInterpolator(SWEEP_INTERPOLATOR);
            _objectAnimatorSweep.SetDuration(SWEEP_ANIMATOR_DURATION);
            _objectAnimatorSweep.RepeatMode = ValueAnimatorRepeatMode.Restart;
            _objectAnimatorSweep.RepeatCount = ValueAnimator.Infinite;
            _objectAnimatorSweep.AnimationRepeat += (e, s) =>
            {
                ToggleAppearingMode();
            };
        }
コード例 #8
0
		private async Task Stop()
		{	
			if (_fadeOut != null && _Set != null && _Set.IsRunning)
			{
				await Task.Delay(_Delay);
			}

			if (_Layout != null) {

				if (this._Token != null) {
					this._Token.Cancel ();
					this._Token.Dispose ();
					this._Token = null;
				}

				_Layout.Touch -= LayoutTouched;

				Xamarin.Forms.Device.BeginInvokeOnMainThread (() => {
					if (this._Layout != null)
					{
						this._Layout.Visibility = ViewStates.Gone;
						this._Layout.Dispose ();
						this._Layout = null;
					}
				});
			}

			if (_Set != null) {	
				this._Set.RemoveAllListeners ();
				this._Set.End ();
				this._Set.Cancel ();
				this._Set.Dispose ();
				this._Set = null;
			}
			if (_fadeOut != null) {

				this._fadeOut.AnimationEnd -= _fadeOut_AnimationEnd;
				this._fadeOut.RemoveAllListeners ();
				this._fadeOut.Dispose ();
				this._fadeOut = null;
			}
		}
コード例 #9
0
 void ShowSwipeDown()
 {
     if (!setup) {
         ActionBar.Hide ();
         if (bar1Fade != null) {
             bar1Fade.Cancel ();
             bar1Fade = null;
         }
         if (bar2Fade != null) {
             bar2Fade.Cancel ();
             bar2Fade = null;
         }
         loadingBars.Visibility = ViewStates.Visible;
         swipeText.TranslationY = -(ActionBar.Height + swipeText.Height + 4);
         swipeText.Visibility = ViewStates.Visible;
         swipeText.Animate ().TranslationY (0).SetStartDelay (50).Start ();
         accumulatedDeltaY = 0;
         setup = true;
     }
 }
コード例 #10
0
		public async Task Show(TopAlert alert)
		{
			await Stop ();

			this._Token = new CancellationTokenSource ();

			this._Delay = alert.Duration;

			var activity = Xamarin.Forms.Forms.Context as Android.App.Activity;
			IWindowManager windowManager = Xamarin.Forms.Forms.Context.GetSystemService(Android.App.Service.WindowService).JavaCast<IWindowManager>();
			this._Layout = (LinearLayout)activity.LayoutInflater.Inflate(Resource.Layout.AlertBox, null, false);
			this._Layout.LayoutParameters = new ViewGroup.LayoutParams (ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);

			var submain = this._Layout.FindViewById<LinearLayout> (Resource.Id.linearLayout3);
			submain.SetBackgroundColor (alert.BackgroundColor.ToAndroid());

			var main = _Layout.FindViewById<LinearLayout> (Resource.Id.linearLayout1);

			var id = Xamarin.Forms.Forms.Context.Resources.GetIdentifier ("alertborder", "drawable", Xamarin.Forms.Forms.Context.PackageName);
			Android.Graphics.Drawables.GradientDrawable drawable = 
				Xamarin.Forms.Forms.Context.Resources.GetDrawable (id).JavaCast<Android.Graphics.Drawables.GradientDrawable>();


			var text = submain.FindViewById<TextView> (Resource.Id.textView1);
			text.SetTextColor (alert.TextColor.ToAndroid ());
			text.Text = alert.Text;

			if (alert.TextSize > 0) {
				text.TextSize = alert.TextSize;
			}

			drawable.SetColor (alert.BorderColor.ToAndroid ());
			drawable.SetCornerRadius (alert.BorderWidth);
			main.SetBackground (drawable);

			//activity.ActionBar.Hide ();

			var actionBarHeight = activity.ActionBar.Height;

			var intent = alert.Intent;

			var p = new WindowManagerLayoutParams (
				windowManager.DefaultDisplay.Width - intent * 2,
				(alert.AlertHeight < 0 ? 200 : (int)alert.AlertHeight),
				WindowManagerTypes.SystemAlert,
				0 | WindowManagerFlags.NotFocusable,
				Android.Graphics.Format.Translucent);

			var yOffset = alert.TopOffset;
			p.Gravity = GravityFlags.Top | GravityFlags.Left;
			p.X = intent;
			p.Y = alert.TopOffset + yOffset + (activity.ActionBar.IsShowing ? actionBarHeight : 0);
			p.Height = (alert.AlertHeight < 0 ? 200 : (int)alert.AlertHeight);
			windowManager.AddView (_Layout, p);

			this._Layout.Touch += LayoutTouched;

			Task.Run (async() => {

				await Task.Delay(alert.Duration, this._Token.Token);

				if (this._Token != null && this._Token.IsCancellationRequested == false)
				{
					if(alert.FadeOut)
					{
						Xamarin.Forms.Device.BeginInvokeOnMainThread( () => {
							// this works
							this._fadeOut = ObjectAnimator.OfFloat(_Layout, "alpha", 1f, 0f);
							this._fadeOut.SetDuration(1000);
							this._fadeOut.AnimationEnd += _fadeOut_AnimationEnd;
							this._Set = new AnimatorSet();
							this._Set.Play(_fadeOut);
							this._Set.Start();
						});
					}
					else
					{
						Stop();
					}
				}
			});
		}
コード例 #11
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here
            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.login);

            SupportToolbar mToolbar = FindViewById<SupportToolbar>(Resource.Id.loginToolbar);
            SetSupportActionBar(mToolbar);
            SupportActionBar.SetHomeButtonEnabled(true);
            SupportActionBar.SetDisplayShowTitleEnabled(true);

            progressBar = FindViewById<ProgressBar>(Resource.Id.progressBar);

            animation = ObjectAnimator.OfInt(progressBar, "progress", 0, 500); // see this max value coming back here, we animale towards that value
            animation.RepeatMode = ValueAnimatorRepeatMode.Reverse;
            animation.RepeatCount = 100;
            animation.SetDuration(1500);
            animation.SetInterpolator(new FastOutLinearInInterpolator());

            var btnTwitter = FindViewById<ImageButton>(Resource.Id.btnTwitter);
            var btnAnon = FindViewById<ImageButton>(Resource.Id.btnAnon);
            var client = new JsonServiceClient(MainActivity.BaseUrl);
            
            btnTwitter.Click += (sender, args) =>
            {
                StartProgressBar();
                Account existingAccount;
                // If cookies saved from twitter login, automatically continue to chat activity.
                if (TryResolveAccount(out existingAccount))
                {
                    try
                    {
                        client.CookieContainer = existingAccount.Cookies;
                        var task = client.GetAsync(new GetUserDetails());
                        task.ConfigureAwait(false);
                        task.ContinueWith(res =>
                        {
                            if (res.Exception != null)
                            {
                                // Failed with current cookie 
                                client.ClearCookies();
                                PerformServiceStackAuth(client);
                                StopProgressBar();
                            }
                            else
                            {
                                StartAuthChatActivity(client, existingAccount);
                                StopProgressBar();
                            }
                            
                        });
                    }
                    catch (Exception)
                    {
                        // Failed with current cookie 
                        client.ClearCookies();
                        StopProgressBar();
                        PerformServiceStackAuth(client);
                    }
                }
                else
                {
                    StopProgressBar();
                    PerformServiceStackAuth(client);
                }
                    
            };

            btnAnon.Click += (sender, args) =>
            {
                StartProgressBar();
                StartGuestChatActivity(client);
                StopProgressBar();
            };
        }
            public ColorItem(Context context)
                : base(context)
            {
                View.Inflate (context, Resource.Layout.ColorPickerItem, this);

                label = FindViewById<TextView> (Resource.Id.Label);
                colorView = FindViewById<CircledImageView> (Resource.Id.Color);

                expandCircleRadius = colorView.CircleRadius;
                shrinkCircleRadius = expandCircleRadius * ShrinkCricleRatio;

                shrinkCircleAnimator = ObjectAnimator.OfFloat (colorView, "circleRadius",
                    expandCircleRadius, shrinkCircleRadius);
                shrinkLabelAnimator = ObjectAnimator.OfFloat (label, "alpha",
                    ExpandLabelAlpha, ShrinkLabelAlpha);

                // FIXME Xamarin: new AnimatorSet().SetDuration(long) should return an AnimatorSet
                shrinkAnimator = new AnimatorSet ();
                shrinkAnimator.SetDuration (AnimationDurationMs);
                shrinkAnimator.PlayTogether (shrinkCircleAnimator, shrinkLabelAnimator);

                expandCircleAnimator = ObjectAnimator.OfFloat (colorView, "circleRadius",
                    shrinkCircleRadius, expandCircleRadius);
                expandLabelAnimator = ObjectAnimator.OfFloat (label, "alpha",
                    ShrinkLabelAlpha, ExpandLabelAlpha);
                expandAnimator = new AnimatorSet ();
                expandAnimator.SetDuration (AnimationDurationMs);
                expandAnimator.PlayTogether (expandCircleAnimator, expandLabelAnimator);
            }
コード例 #13
0
        /// <summary>
        /// Playes a series of animations.
        /// </summary>
        /// <param name="animations">The series of animations to be played.</param>
        protected void PlayAnimations(ObjectAnimator[] animations)
        {
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.PlaySequentially(animations);
            animatorSet.Start();

            //animatorSet.AnimationEnd
            //animatorSet.Pause
        }
コード例 #14
0
        /// <summary>
        /// Converts a sequence to an array of animations.
        /// </summary>
        /// <param name="sequence">The sequence from which to gather animations information.</param>
        /// <returns>Returns a series of animations.</returns>
        protected ObjectAnimator[] PrepareNotesAnimations(Sequence sequence)
        {
            ObjectAnimator[] animations = new ObjectAnimator[sequence.Length];

            for (int i = 0; i < sequence.Length; i++)
            {
                //Get note from sequence.
                Note note = sequence[i];
                //Create a new visual representation of that note.
                NoteRepresentation noteRep = new NoteRepresentation(_activity, note);
                //Create the note's animation, and add that animation to the animations array.
                animations[i] = noteRep.CreateNoteAnimation();
				//Sign up for sound input window events.
				noteRep.OnNoteArraival += NotesPlayer_OnNoteArraival;
				noteRep.OnNoteGone += NotesPlayer_OnNoteGone;
            }

            return animations;
        }
コード例 #15
0
 public void animar3(Java.Lang.Object imagen)
 {
     Android.Animation.ObjectAnimator animacion = Android.Animation.ObjectAnimator.OfFloat(imagen, "translationY", 1000, 0);
     animacion.SetDuration(500);
     animacion.Start();
 }
コード例 #16
0
		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();
		}
コード例 #17
0
ファイル: ExpandHelper.cs プロジェクト: Andrea/FriendTab
		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));
		}