Exemplo n.º 1
0
        public static void AnimateBackgroundColor(PlatformBaseUI view, uint targetColor, SimpleAnimator.AnimationComplete onCompletion = null)
        {
            SimpleAnimator_Color animator = new SimpleAnimator_Color(view.BackgroundColor, targetColor, .15f, delegate(float percent, object value)
            {
                view.BackgroundColor = (uint)value;
            }
                                                                     , onCompletion);

            animator.Start( );
        }
Exemplo n.º 2
0
        public static void AnimateViewColor(uint currColor, uint targetColor, View uiView, SimpleAnimator.AnimationComplete complete)
        {
            SimpleAnimator_Color viewAnimator = new SimpleAnimator_Color(currColor, targetColor, .15f, delegate(float percent, object value)
            {
                uiView.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor((uint)value));
            }
                                                                         ,
                                                                         delegate
            {
                complete( );
            });

            viewAnimator.Start( );
        }
Exemplo n.º 3
0
        public void TogglePrayed(bool prayed)
        {
            // if the prayer state is changing
            if (prayed != Prayed)
            {
                Prayed = prayed;

                uint currColor   = 0;
                uint targetColor = 0;

                // if we are ACTIVATING prayed
                if (prayed == true)
                {
                    // update the circle color and send an analytic
                    RockApi.Put_PrayerRequests_Prayed(PrayerRequest.Id, null);

                    currColor   = 0;
                    targetColor = PrayerConfig.PrayedForColor;
                    PrayerActionCircle.Layer.BorderWidth = 0;

                    PrayerActionButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(0xFFFFFFFF), UIControlState.Normal);
                    PrayerActionButton.SetTitle(PrayerStrings.Prayer_After, UIControlState.Normal);
                    PrayerActionButton.SizeToFit( );
                }
                else
                {
                    // otherwise just update the color
                    currColor   = PrayerConfig.PrayedForColor;
                    targetColor = 0;
                    PrayerActionCircle.Layer.BorderWidth = 1;

                    PrayerActionButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), UIControlState.Normal);
                    PrayerActionButton.SetTitle(PrayerStrings.Prayer_Before, UIControlState.Normal);
                    PrayerActionButton.SizeToFit( );
                }

                PrayerActionButton.SizeToFit( );
                PositionPrayedLabel( );

                // animate the circle color to its new target
                SimpleAnimator_Color colorAnim = new SimpleAnimator_Color(currColor, targetColor, .35f,
                                                                          delegate(float percent, object value)
                {
                    PrayerActionCircle.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor((uint)value);
                }, null);
                colorAnim.Start( );
            }
        }
Exemplo n.º 4
0
                    public void TogglePrayed(bool prayed)
                    {
                        // ignore if the state remains the same
                        if (prayed != Prayed)
                        {
                            Prayed = prayed;

                            uint currColor   = 0;
                            uint targetColor = 0;

                            // if we are ACTIVATING prayed,
                            if (prayed == true)
                            {
                                // send an analytic
                                RockApi.Put_PrayerRequests_Prayed(PrayerRequest.Id, null);

                                // and fill in the circle
                                PrayerActionLabel.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor));
                                PrayerActionLabel.Text = PrayerStrings.Prayer_After;

                                currColor   = ControlStylingConfig.BG_Layer_BorderColor;
                                targetColor = PrayerConfig.PrayedForColor;
                                PrayerActionCircle.Style = Android.Graphics.Paint.Style.FillAndStroke;
                            }
                            else
                            {
                                // on deactivation, clear the circle
                                PrayerActionLabel.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor));
                                PrayerActionLabel.Text = PrayerStrings.Prayer_Before;

                                currColor   = PrayerConfig.PrayedForColor;
                                targetColor = ControlStylingConfig.BG_Layer_BorderColor;
                                PrayerActionCircle.Style = Android.Graphics.Paint.Style.Stroke;
                            }

                            PositionPrayedLabel( );

                            // animate the circle color to its new target
                            SimpleAnimator_Color colorAnim = new SimpleAnimator_Color(currColor, targetColor, .35f,
                                                                                      delegate(float percent, object value)
                            {
                                PrayerActionCircle.Color = Rock.Mobile.UI.Util.GetUIColor((uint)value);
                                PrayerActionCircle.Invalidate( );
                            }, null);
                            colorAnim.Start( );
                        }
                    }
        public void TogglePrayed( bool prayed )
        {
            // if the prayer state is changing
            if( prayed != Prayed )
            {
                Prayed = prayed;

                uint currColor = 0;
                uint targetColor = 0;

                // if we are ACTIVATING prayed
                if ( prayed == true )
                {
                    // update the circle color and send an analytic
                    RockApi.Put_PrayerRequests_Prayed( PrayerRequest.Id, null );

                    currColor = 0;
                    targetColor = PrayerConfig.PrayedForColor;
                    PrayerActionCircle.Layer.BorderWidth = 0;

                    PrayerActionButton.SetTitleColor( Rock.Mobile.UI.Util.GetUIColor( 0xFFFFFFFF ), UIControlState.Normal );
                    PrayerActionButton.SetTitle( PrayerStrings.Prayer_After, UIControlState.Normal );
                    PrayerActionButton.SizeToFit( );
                }
                else
                {
                    // otherwise just update the color
                    currColor = PrayerConfig.PrayedForColor;
                    targetColor = 0;
                    PrayerActionCircle.Layer.BorderWidth = 1;

                    PrayerActionButton.SetTitleColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ), UIControlState.Normal );
                    PrayerActionButton.SetTitle( PrayerStrings.Prayer_Before, UIControlState.Normal );
                    PrayerActionButton.SizeToFit( );
                }

                PrayerActionButton.SizeToFit( );
                PositionPrayedLabel( );

                // animate the circle color to its new target
                SimpleAnimator_Color colorAnim = new SimpleAnimator_Color( currColor, targetColor, .35f, 
                    delegate(float percent, object value )
                    {
                        PrayerActionCircle.BackgroundColor = Rock.Mobile.UI.Util.GetUIColor( (uint)value );
                    }, null );
                colorAnim.Start( );
            }
        }
                    public void TogglePrayed( bool prayed )
                    {
                        // ignore if the state remains the same
                        if ( prayed != Prayed )
                        {
                            Prayed = prayed;

                            uint currColor = 0;
                            uint targetColor = 0;

                            // if we are ACTIVATING prayed, 
                            if ( prayed == true )
                            {
                                // send an analytic 
                                RockApi.Put_PrayerRequests_Prayed( PrayerRequest.Id, null );

                                // and fill in the circle
                                PrayerActionLabel.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) );
                                PrayerActionLabel.Text = PrayerStrings.Prayer_After;

                                currColor = ControlStylingConfig.BG_Layer_BorderColor;
                                targetColor = PrayerConfig.PrayedForColor;
                                PrayerActionCircle.Style = Android.Graphics.Paint.Style.FillAndStroke;
                            }
                            else
                            {
                                // on deactivation, clear the circle
                                PrayerActionLabel.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) );
                                PrayerActionLabel.Text = PrayerStrings.Prayer_Before;

                                currColor = PrayerConfig.PrayedForColor;
                                targetColor = ControlStylingConfig.BG_Layer_BorderColor;
                                PrayerActionCircle.Style = Android.Graphics.Paint.Style.Stroke;
                            }

                            PositionPrayedLabel( );

                            // animate the circle color to its new target
                            SimpleAnimator_Color colorAnim = new SimpleAnimator_Color( currColor, targetColor, .35f, 
                                delegate(float percent, object value )
                                {
                                    PrayerActionCircle.Color = Rock.Mobile.UI.Util.GetUIColor( (uint)value );
                                    PrayerActionCircle.Invalidate( );
                                }, null );
                            colorAnim.Start( );
                        }
                    }