Exemplo n.º 1
0
                    void PositionPrayedLabel( )
                    {
                        PrayerActionLayout.SetX((View.Bounds.Width - PrayerActionSize.Width) / 2.0f);

                        //float yPos = Rock.Mobile.Graphics.Util.UnitToPx( ( View.Bounds.Height - PrayerActionSize.Height ) );
                        float yPos = (View.Bounds.Height - (PrayerActionSize.Height / 3));

                        PrayerActionLayout.SetY(yPos);

                        PrayerActionLabel.Measure(0, 0);
                        PrayerActionLabel.SetX((PrayerActionSize.Width - PrayerActionLabel.MeasuredWidth) / 2.0f);
                        PrayerActionLabel.SetY(PrayerActionLabel.MeasuredHeight / 2);
                    }
Exemplo n.º 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( );
                        }
                    }