Exemplo n.º 1
0
 public DroidView( )
 {
     View = new BorderedRectView(Rock.Mobile.PlatformSpecific.Android.Core.Context);
     View.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
 }
Exemplo n.º 2
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);
                        }
                public void AddToView( ViewGroup parentView )
                {
                    // first, create the layout that will store the button and label
                    Layout = new BorderedRectView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Layout.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    parentView.AddView( Layout );

                    // now create the linearLayout that will store the button labels (Symbol & Text)
                    LinearLayout labelLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    labelLayout.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (RelativeLayout.LayoutParams)labelLayout.LayoutParameters ).AddRule( LayoutRules.CenterInParent );
                    Layout.AddView( labelLayout );

                    // add the button, which is just a frame wrapping the entire layout
                    Button = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Button.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent );
                    Button.Background = null;
                    Layout.AddView( Button );

                    // now set the icon
                    Icon = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    labelLayout.AddView( Icon );

                    // and lastly the text
                    Label = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Label.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)Label.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    labelLayout.AddView( Label );
                }
                        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 ? RockGeneralData.Instance.Data.PrayerIdToCategory( prayer.CategoryId.Value ) : RockGeneralData.Instance.Data.PrayerCategories[ 0 ].Name;
                            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 );
                        }