コード例 #1
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);
        }
コード例 #2
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 );
        }