Пример #1
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( );
            }
        }
Пример #2
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( );
                        }
                    }