Ejemplo n.º 1
0
            public static void Post_PrayerRequests(Rock.Client.PrayerRequest prayer, HttpRequest.RequestResult resultHandler)
            {
                Rock.Client.PrayerRequestEntity prayerRequestEntity = new Rock.Client.PrayerRequestEntity();
                prayerRequestEntity.CopyPropertiesFrom(prayer);

                RestRequest request = GetRockRestRequest(Method.POST);

                request.AddBody(prayerRequestEntity);

                Request.ExecuteAsync(BaseUrl + EndPoint_PrayerRequests, request, resultHandler);
            }
Ejemplo n.º 2
0
        void SetPrayer(Rock.Client.PrayerRequest prayer)
        {
            PrayerRequest = prayer;

            // set the text for the name, size it so we get the height, then
            // restrict its bounds to the card itself
            Name.Text       = prayer.FirstName.ToUpper( );
            Category.Text   = PrayerRequest.CategoryId.HasValue ? RockLaunchData.Instance.Data.PrayerIdToCategory(PrayerRequest.CategoryId.Value) : RockLaunchData.Instance.Data.PrayerCategories[0].Key;
            Date.Text       = string.Format("{0:MM/dd/yy}", PrayerRequest.EnteredDateTime);
            PrayerText.Text = prayer.Text;

            LayoutChanged(View.Frame);
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Builds a prayer request from data in the UI Fields and kicks off the post UI Control
        /// </summary>
        void SubmitPrayerRequest(object sender, EventArgs e)
        {
            if (PickerAdjustManager.Revealed == true)
            {
                OnToggleCategoryPicker(false);
            }
            else
            {
                // if first and last name are valid, OR anonymous is on
                // and if there's text in the request field.
                if (CheckDebug( ) == false)
                {
                    if (ValidateInput( ))
                    {
                        Rock.Client.PrayerRequest prayerRequest = new Rock.Client.PrayerRequest();

                        EnableControls(false);

                        prayerRequest.FirstName = FirstName.Field.Text;
                        prayerRequest.LastName  = LastName.Field.Text;
                        prayerRequest.Email     = Email.Field.Text;

                        // see if there's a person alias ID to use.
                        int?personAliasId = null;
                        if (MobileApp.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId.HasValue)
                        {
                            personAliasId = MobileApp.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId;
                        }

                        prayerRequest.Text                   = PrayerRequest.Text;
                        prayerRequest.EnteredDateTime        = DateTime.Now;
                        prayerRequest.ExpirationDate         = DateTime.Now.Add(PrivatePrayerConfig.PrayerExpirationTime);
                        prayerRequest.CategoryId             = RockLaunchData.Instance.Data.PrayerCategoryToId(CategoryButton.Title(UIControlState.Normal));
                        prayerRequest.IsActive               = true;
                        prayerRequest.IsPublic               = UIPublicSwitch.On; // use the public switch's state to determine whether it's a public prayer or not.
                        prayerRequest.Guid                   = Guid.NewGuid( );
                        prayerRequest.IsApproved             = false;
                        prayerRequest.CreatedByPersonAliasId = /*UISwitchAnonymous.On == true ? null :*/ personAliasId;

                        // launch the post view controller
                        Prayer_PostUIViewController postPrayerVC = new Prayer_PostUIViewController();
                        postPrayerVC.PrayerRequest = prayerRequest;
                        Task.PerformSegue(this, postPrayerVC);
                    }
                }
            }
        }
Ejemplo n.º 4
0
                void SubmitPrayerRequest( )
                {
                    // if first and last name are valid, OR anonymous is on
                    // and if there's text in the request field.
                    if (CheckDebug( ) == false)
                    {
                        if (ValidateInput( ))
                        {
                            Rock.Client.PrayerRequest prayerRequest = new Rock.Client.PrayerRequest();

                            FirstNameText.Enabled = false;
                            LastNameText.Enabled  = false;
                            EmailText.Enabled     = false;
                            RequestText.Enabled   = false;

                            // setup the request
                            prayerRequest.FirstName = FirstNameText.Text;
                            prayerRequest.LastName  = LastNameText.Text;
                            prayerRequest.Email     = EmailText.Text;

                            int?personAliasId = null;
                            if (MobileApp.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId.HasValue)
                            {
                                personAliasId = MobileApp.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId;
                            }

                            prayerRequest.Text                   = RequestText.Text;
                            prayerRequest.EnteredDateTime        = DateTime.Now;
                            prayerRequest.ExpirationDate         = DateTime.Now.Add(PrivatePrayerConfig.PrayerExpirationTime);
                            prayerRequest.CategoryId             = MobileApp.Shared.Network.RockLaunchData.Instance.Data.PrayerCategoryToId(Spinner.SelectedItem.ToString( ));
                            prayerRequest.IsActive               = true;
                            prayerRequest.Guid                   = Guid.NewGuid( );
                            prayerRequest.IsPublic               = PublicSwitch.Checked;
                            prayerRequest.IsApproved             = false;
                            prayerRequest.CreatedByPersonAliasId = /*AnonymousSwitch.Checked == true ? null :*/ personAliasId;

                            ParentTask.OnClick(this, 0, prayerRequest);
                        }
                    }
                }
Ejemplo n.º 5
0
        public PrayerCard(Rock.Client.PrayerRequest prayer, CGRect bounds)
        {
            //setup the actual "card" outline
            View                 = PlatformView.Create( );
            View.Bounds          = new System.Drawing.RectangleF((float)bounds.X, (float)bounds.Y, (float)bounds.Width, (float)bounds.Height);
            View.BackgroundColor = ControlStylingConfig.BG_Layer_Color;
            View.BorderColor     = ControlStylingConfig.BG_Layer_BorderColor;
            View.CornerRadius    = ControlStylingConfig.Button_CornerRadius;
            View.BorderWidth     = ControlStylingConfig.BG_Layer_BorderWidth;

            // ensure we clip children
            ((UIView)View.PlatformNativeObject).ClipsToBounds = true;


            // setup the prayer request text field
            PrayerText                      = new PrayerTextView( );
            PrayerText.Editable             = false;
            PrayerText.BackgroundColor      = UIColor.Clear;
            PrayerText.Layer.AnchorPoint    = new CGPoint(0, 0);
            PrayerText.DelaysContentTouches = false; // don't allow delaying touch, we need to forward it
            PrayerText.TextColor            = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor);
            PrayerText.Font                 = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Medium_FontSize);
            PrayerText.TextContainerInset   = UIEdgeInsets.Zero;
            PrayerText.TextContainer.LineFragmentPadding = 0;


            // setup the bottom prayer button, and its fill-in circle
            PrayerActionButton = UIButton.FromType(UIButtonType.Custom);
            PrayerActionButton.Layer.AnchorPoint = new CGPoint(0, 0);
            PrayerActionButton.SetTitle(PrayerStrings.Prayer_Before, UIControlState.Normal);

            PrayerActionButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor), UIControlState.Normal);
            PrayerActionButton.SetTitleColor(Rock.Mobile.UI.Util.GetUIColor(Rock.Mobile.Graphics.Util.ScaleRGBAColor(ControlStylingConfig.TextField_PlaceholderTextColor, 2, false)), UIControlState.Highlighted);

            PrayerActionButton.Font = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Regular, ControlStylingConfig.Small_FontSize);
            PrayerActionButton.SizeToFit( );

            PrayerActionCircle                    = new UIView( );
            PrayerActionCircle.Bounds             = new CGRect(0, 0, 100, 100);
            PrayerActionCircle.Layer.CornerRadius = PrayerActionCircle.Bounds.Width / 2;
            PrayerActionCircle.Layer.BorderWidth  = 1;
            PrayerActionCircle.Layer.BorderColor  = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor).CGColor;
            PrayerActionCircle.Layer.AnchorPoint  = new CGPoint(0, 0);

            PrayerActionButton.TouchUpInside += (object sender, EventArgs e) =>
            {
                TogglePrayed(true);
            };


            // setup the name field
            NameLayer = new UIView( );
            NameLayer.Layer.AnchorPoint = new CGPoint(0, 0);
            NameLayer.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color).CGColor;
            NameLayer.BackgroundColor   = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor);

            Name = new UILabel( );
            Name.Layer.AnchorPoint = new CGPoint(0, 0);
            Name.TextColor         = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor);
            Name.Font            = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Bold, ControlStylingConfig.Medium_FontSize);
            Name.BackgroundColor = UIColor.Clear;
            Name.LineBreakMode   = UILineBreakMode.TailTruncation;

            // setup the date field
            DateLayer = new UIView( );
            DateLayer.Layer.AnchorPoint = new CGPoint(0, 0);
            DateLayer.Layer.BorderWidth = 1;
            DateLayer.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color).CGColor;
            DateLayer.BackgroundColor   = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor);

            Date = new UILabel( );
            Date.Layer.AnchorPoint = new CGPoint(0, 0);
            Date.TextColor         = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor);
            Date.Font            = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Small_FontSize);
            Date.BackgroundColor = UIColor.Clear;

            // setup the category field
            CategoryLayer = new UIView( );
            CategoryLayer.Layer.AnchorPoint = new CGPoint(0, 0);
            CategoryLayer.Layer.BorderWidth = 1;
            CategoryLayer.Layer.BorderColor = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color).CGColor;
            CategoryLayer.BackgroundColor   = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor);

            Category = new UILabel( );
            Category.Layer.AnchorPoint = new CGPoint(0, 0);
            Category.TextColor         = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor);
            Category.Font                      = Rock.Mobile.PlatformSpecific.iOS.Graphics.FontManager.GetFont(ControlStylingConfig.Font_Light, ControlStylingConfig.Small_FontSize);
            Category.BackgroundColor           = UIColor.Clear;
            Category.LineBreakMode             = UILineBreakMode.TailTruncation;
            Category.AdjustsFontSizeToFitWidth = false;


            // add the controls
            UIView nativeView = View.PlatformNativeObject as UIView;

            nativeView.AddSubview(NameLayer);
            nativeView.AddSubview(Name);
            nativeView.AddSubview(CategoryLayer);
            nativeView.AddSubview(Category);
            nativeView.AddSubview(DateLayer);
            nativeView.AddSubview(Date);
            nativeView.AddSubview(PrayerText);
            nativeView.AddSubview(PrayerActionCircle);
            nativeView.AddSubview(PrayerActionButton);
            PrayerText.Parent = nativeView;

            SetPrayer(prayer);
        }
        /// <summary>
        /// Builds a prayer request from data in the UI Fields and kicks off the post UI Control
        /// </summary>
        void SubmitPrayerRequest(object sender, EventArgs e)
        {
            if ( PickerAdjustManager.Revealed == true )
            {
                OnToggleCategoryPicker( false );
            }
            else
            {
                // if first and last name are valid, OR anonymous is on
                // and if there's text in the request field.
                if ( CheckDebug( ) == false )
                {
                    if ( ValidateInput( ) )
                    {
                        Rock.Client.PrayerRequest prayerRequest = new Rock.Client.PrayerRequest();

                        EnableControls( false );

                        prayerRequest.FirstName = FirstName.Field.Text;
                        prayerRequest.LastName = LastName.Field.Text;

                        // see if there's a person alias ID to use.
                        int? personAliasId = null;
                        if ( App.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId.HasValue )
                        {
                            personAliasId = App.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId;
                        }

                        prayerRequest.Text = PrayerRequest.Text;
                        prayerRequest.EnteredDateTime = DateTime.Now;
                        prayerRequest.ExpirationDate = DateTime.Now.Add( PrivatePrayerConfig.PrayerExpirationTime );
                        prayerRequest.CategoryId = RockGeneralData.Instance.Data.PrayerCategoryToId( CategoryButton.Title( UIControlState.Normal ) );
                        prayerRequest.IsActive = true;
                        prayerRequest.IsPublic = UIPublicSwitch.On; // use the public switch's state to determine whether it's a public prayer or not.
                        prayerRequest.Guid = Guid.NewGuid( );
                        prayerRequest.IsApproved = false;
                        prayerRequest.CreatedByPersonAliasId = UISwitchAnonymous.On == true ? null : personAliasId;

                        // launch the post view controller
                        Prayer_PostUIViewController postPrayerVC = new Prayer_PostUIViewController();
                        postPrayerVC.PrayerRequest = prayerRequest;
                        Task.PerformSegue( this, postPrayerVC );
                    }
                }
            }
        }
                void SubmitPrayerRequest( )
                {
                    // if first and last name are valid, OR anonymous is on
                    // and if there's text in the request field.
                    if ( CheckDebug( ) == false )
                    {
                        if ( ValidateInput( ) )
                        {
                            Rock.Client.PrayerRequest prayerRequest = new Rock.Client.PrayerRequest();

                            FirstNameText.Enabled = false;
                            LastNameText.Enabled = false;
                            RequestText.Enabled = false;

                            // setup the request
                            prayerRequest.FirstName = FirstNameText.Text;
                            prayerRequest.LastName = LastNameText.Text;

                            int? personAliasId = null;
                            if ( App.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId.HasValue )
                            {
                                personAliasId = App.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId;
                            }

                            prayerRequest.Text = RequestText.Text;
                            prayerRequest.EnteredDateTime = DateTime.Now;
                            prayerRequest.ExpirationDate = DateTime.Now.Add( PrivatePrayerConfig.PrayerExpirationTime );
                            prayerRequest.CategoryId = App.Shared.Network.RockGeneralData.Instance.Data.PrayerCategoryToId( Spinner.SelectedItem.ToString( ) );
                            prayerRequest.IsActive = true;
                            prayerRequest.Guid = Guid.NewGuid( );
                            prayerRequest.IsPublic = PublicSwitch.Checked;
                            prayerRequest.IsApproved = false;
                            prayerRequest.CreatedByPersonAliasId = AnonymousSwitch.Checked == true ? null : personAliasId;

                            ParentTask.OnClick( this, 0, prayerRequest );
                        }
                    }
                }
Ejemplo n.º 8
0
                        public PrayerLayoutRender(RectangleF bounds, float prayerActionHeight, Rock.Client.PrayerRequest prayer)
                        {
                            PrayerActionHeight = prayerActionHeight;

                            // Create the core layout that stores the prayer
                            LinearLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                            LinearLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                            LinearLayout.Orientation      = Orientation.Vertical;

                            // add the name
                            NameLayout = new BorderedRectView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                            NameLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                            NameLayout.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));
                            ((LinearLayout.LayoutParams)NameLayout.LayoutParameters).Weight = 1;
                            LinearLayout.AddView(NameLayout);

                            Name = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                            Name.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                            ((RelativeLayout.LayoutParams)Name.LayoutParameters).TopMargin    = (int)Rock.Mobile.Graphics.Util.UnitToPx(5);
                            ((RelativeLayout.LayoutParams)Name.LayoutParameters).LeftMargin   = (int)Rock.Mobile.Graphics.Util.UnitToPx(5);
                            ((RelativeLayout.LayoutParams)Name.LayoutParameters).RightMargin  = (int)Rock.Mobile.Graphics.Util.UnitToPx(5);
                            ((RelativeLayout.LayoutParams)Name.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(5);
                            Name.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor));
                            Name.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Bold), TypefaceStyle.Normal);
                            Name.SetTextSize(ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize);
                            Name.SetMaxLines(1);
                            Name.SetSingleLine( );
                            Name.SetHorizontallyScrolling(true);
                            Name.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                            Name.Text      = prayer.FirstName.ToUpper( );
                            NameLayout.AddView(Name);


                            // create the layout for managing the category / date
                            LinearLayout detailsLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context);

                            detailsLayout.Orientation      = Orientation.Horizontal;
                            detailsLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                            LinearLayout.AddView(detailsLayout);

                            // add the category layout
                            CategoryLayout = new BorderedRectView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                            CategoryLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                            CategoryLayout.BorderWidth      = 1;
                            CategoryLayout.SetBorderColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color));
                            CategoryLayout.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));
                            ((LinearLayout.LayoutParams)CategoryLayout.LayoutParameters).LeftMargin  = (int)Rock.Mobile.Graphics.Util.UnitToPx(-4);
                            ((LinearLayout.LayoutParams)CategoryLayout.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-1);
                            ((LinearLayout.LayoutParams)CategoryLayout.LayoutParameters).Weight      = 1;
                            detailsLayout.AddView(CategoryLayout);

                            // category
                            Category = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                            Category.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                            ((RelativeLayout.LayoutParams)Category.LayoutParameters).TopMargin    = (int)Rock.Mobile.Graphics.Util.UnitToPx(5);
                            ((RelativeLayout.LayoutParams)Category.LayoutParameters).LeftMargin   = (int)Rock.Mobile.Graphics.Util.UnitToPx(9);
                            ((RelativeLayout.LayoutParams)Category.LayoutParameters).RightMargin  = (int)Rock.Mobile.Graphics.Util.UnitToPx(9);
                            ((RelativeLayout.LayoutParams)Category.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(5);
                            Category.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor));
                            Category.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Light), TypefaceStyle.Normal);
                            Category.SetTextSize(ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize);
                            Category.SetMaxLines(1);
                            Category.SetSingleLine( );
                            Category.SetHorizontallyScrolling(true);
                            Category.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                            Category.Text      = prayer.CategoryId.HasValue ? RockLaunchData.Instance.Data.PrayerIdToCategory(prayer.CategoryId.Value) : RockLaunchData.Instance.Data.PrayerCategories[0].Key;
                            CategoryLayout.AddView(Category);



                            // add the date layout
                            DateLayout = new BorderedRectView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                            DateLayout.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent);
                            DateLayout.BorderWidth      = 1;
                            DateLayout.SetBorderColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color));
                            DateLayout.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor));
                            ((LinearLayout.LayoutParams)DateLayout.LayoutParameters).LeftMargin  = (int)Rock.Mobile.Graphics.Util.UnitToPx(-1);
                            ((LinearLayout.LayoutParams)DateLayout.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-4);
                            ((LinearLayout.LayoutParams)DateLayout.LayoutParameters).Weight      = 1;
                            detailsLayout.AddView(DateLayout);

                            // date
                            Date = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                            Date.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                            ((RelativeLayout.LayoutParams)Date.LayoutParameters).TopMargin    = (int)Rock.Mobile.Graphics.Util.UnitToPx(5);
                            ((RelativeLayout.LayoutParams)Date.LayoutParameters).RightMargin  = (int)Rock.Mobile.Graphics.Util.UnitToPx(13);
                            ((RelativeLayout.LayoutParams)Date.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(5);
                            ((RelativeLayout.LayoutParams)Date.LayoutParameters).AddRule(LayoutRules.AlignParentRight);
                            Date.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor));
                            Date.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Light), TypefaceStyle.Normal);
                            Date.SetTextSize(ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize);
                            Date.Text = string.Format("{0:MM/dd/yy}", prayer.EnteredDateTime);
                            DateLayout.AddView(Date);



                            // actual prayer
                            Prayer = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                            UpdatePrayerLayout(bounds);
                            Prayer.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor));
                            Prayer.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal);
                            Prayer.SetTextSize(ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize);
                            Prayer.Text = prayer.Text;
                            LinearLayout.AddView(Prayer);
                        }
Ejemplo n.º 9
0
                    static float PrayerActionDimension = 100;//Rock.Mobile.Graphics.Util.UnitToPx( 50 );

                    public PrayerCard(Rock.Client.PrayerRequest prayer, RectangleF bounds)
                    {
                        PrayerRequest = prayer;

                        View                 = PlatformView.Create( );
                        View.Bounds          = bounds;
                        View.BackgroundColor = ControlStylingConfig.BG_Layer_Color;
                        View.BorderColor     = ControlStylingConfig.BG_Layer_BorderColor;
                        View.CornerRadius    = ControlStylingConfig.Button_CornerRadius;
                        View.BorderWidth     = ControlStylingConfig.BG_Layer_BorderWidth;

                        // create a vertically oriented linearLayout that will act as our root
                        RelativeLayout root = new RelativeLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context);

                        //root.SetBackgroundColor( Android.Graphics.Color.GreenYellow );
                        root.LayoutParameters = new RelativeLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent);


                        // create the bottom prayer layout
                        PrayerActionSize = new System.Drawing.SizeF(Rock.Mobile.Graphics.Util.UnitToPx(PrayerActionDimension),
                                                                    Rock.Mobile.Graphics.Util.UnitToPx(PrayerActionDimension));


                        // create the layout that will contain the circle, button and label
                        PrayerActionLayout = new RelativeLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                        //frameLayout.SetBackgroundColor( Android.Graphics.Color.Aqua );
                        PrayerActionLayout.LayoutParameters = new LinearLayout.LayoutParams((int)PrayerActionSize.Width, (int)PrayerActionSize.Height);
                        ((LinearLayout.LayoutParams)PrayerActionLayout.LayoutParameters).Weight = 1;
                        root.AddView(PrayerActionLayout);


                        // Pray Button
                        PrayerActionButton                  = new Button(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                        PrayerActionButton.Enabled          = false;
                        PrayerActionButton.Background       = null;
                        PrayerActionButton.LayoutParameters = new RelativeLayout.LayoutParams((int)PrayerActionSize.Width, (int)PrayerActionSize.Height);
                        //Pray.SetBackgroundColor( Android.Graphics.Color.Green );
                        PrayerActionLayout.AddView(PrayerActionButton);


                        // Layout for the text and circle
                        PrayerActionCircle             = new Rock.Mobile.PlatformSpecific.Android.Graphics.CircleView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                        PrayerActionCircle.Color       = Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor);
                        PrayerActionCircle.StrokeWidth = 1;
                        //PrayerActionCircle.SetBackgroundColor( Android.Graphics.Color.Blue );
                        PrayerActionCircle.LayoutParameters = new RelativeLayout.LayoutParams((int)PrayerActionSize.Width, (int)PrayerActionSize.Height);
                        PrayerActionLayout.AddView(PrayerActionCircle);

                        // Setup the "I Prayed" label
                        PrayerActionLabel = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
                        PrayerActionLabel.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
                        PrayerActionLabel.Text             = PrayerStrings.Prayer_Before;
                        PrayerActionLabel.Gravity          = GravityFlags.Center;
                        //PrayerActionLabel.SetBackgroundColor( Android.Graphics.Color.Orange );
                        PrayerActionLabel.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal);
                        PrayerActionLabel.SetTextSize(ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize);
                        PrayerActionLabel.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor));
                        PrayerActionLayout.AddView(PrayerActionLabel);

                        PositionPrayedLabel( );

                        PrayerActionButton.Click += (object sender, EventArgs e) =>
                        {
                            TogglePrayed(true);
                        };
                        //

                        // add the controls
                        ViewGroup nativeView = View.PlatformNativeObject as ViewGroup;

                        nativeView.AddView(root);


                        // add it to this view
                        PrayerLayout = new PrayerLayoutRender(new RectangleF(bounds.Left, bounds.Top, bounds.Width, bounds.Height - PrayerActionSize.Height),
                                                              PrayerActionSize.Height * .75f,
                                                              prayer);
                        nativeView.AddView(PrayerLayout.LinearLayout);

                        PrayerActionButton.Enabled = true;
                    }
Ejemplo n.º 10
0
                void SubmitPrayerRequest( )
                {
                    // if first and last name are valid, OR anonymous is on
                    // and if there's text in the request field.
                    if ( ( ( string.IsNullOrEmpty( FirstNameText.Text ) == false && string.IsNullOrEmpty( LastNameText.Text ) == false ) || AnonymousSwitch.Checked == true ) &&
                             string.IsNullOrEmpty( RequestText.Text ) == false )
                    {
                        Rock.Client.PrayerRequest prayerRequest = new Rock.Client.PrayerRequest();

                        FirstNameText.Enabled = false;
                        LastNameText.Enabled = false;
                        RequestText.Enabled = false;

                        // respect their privacy settings
                        if ( AnonymousSwitch.Checked == true )
                        {
                            prayerRequest.FirstName = "Anonymous";
                            prayerRequest.LastName = "Anonymous";
                        }
                        else
                        {
                            prayerRequest.FirstName = FirstNameText.Text;
                            prayerRequest.LastName = LastNameText.Text;
                        }

                        int personAliasId = App.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId.HasValue ? App.Shared.Network.RockMobileUser.Instance.Person.PrimaryAliasId.Value : 0;

                        prayerRequest.Text = RequestText.Text;
                        prayerRequest.EnteredDateTime = DateTime.Now;
                        prayerRequest.ExpirationDate = DateTime.Now.AddYears( 1 );
                        prayerRequest.CategoryId = App.Shared.Network.RockGeneralData.Instance.Data.PrayerCategoryToId( Spinner.SelectedItem.ToString( ) );
                        prayerRequest.IsActive = true;
                        prayerRequest.Guid = Guid.NewGuid( );
                        prayerRequest.IsPublic = PublicSwitch.Checked;
                        prayerRequest.IsApproved = false;
                        prayerRequest.CreatedByPersonAliasId = AnonymousSwitch.Checked == true ? -1 : personAliasId;

                        ParentTask.OnClick( this, 0, prayerRequest );
                    }
                    else
                    {
                        // they forgot to fill something in, so show them what it was.

                        // Update the name background color
                        uint targetNameColor = ControlStylingConfig.BG_Layer_Color;
                        if( string.IsNullOrEmpty( FirstNameText.Text ) && AnonymousSwitch.Checked == false )
                        {
                            targetNameColor = ControlStylingConfig.BadInput_BG_Layer_Color;
                        }
                        Rock.Mobile.PlatformSpecific.Android.UI.Util.AnimateViewColor( FirstNameBGColor, targetNameColor, FirstNameBGLayer, delegate { FirstNameBGColor = targetNameColor; } );

                        // if they left the name field blank and didn't turn on Anonymous, flag the field.
                        uint targetLastNameColor = ControlStylingConfig.BG_Layer_Color;
                        if( string.IsNullOrEmpty( LastNameText.Text ) && AnonymousSwitch.Checked == false )
                        {
                            targetLastNameColor = ControlStylingConfig.BadInput_BG_Layer_Color;
                        }
                        Rock.Mobile.PlatformSpecific.Android.UI.Util.AnimateViewColor( LastNameBGColor, targetLastNameColor, LastNameBGLayer, delegate { LastNameBGColor = targetLastNameColor; } );

                        // Update the prayer background color
                        uint currPrayerColor = RequestBGColor;
                        uint targetPrayerColor = string.IsNullOrEmpty( RequestText.Text ) ? ControlStylingConfig.BadInput_BG_Layer_Color : ControlStylingConfig.BG_Layer_Color;
                        Rock.Mobile.PlatformSpecific.Android.UI.Util.AnimateViewColor( RequestBGColor, targetPrayerColor, RequestBGLayer, delegate { RequestBGColor = targetPrayerColor; } );

                        CheckDebug( );
                    }
                }