public PrimaryListItem(Context context) : base(context) { SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_Color)); Orientation = Android.Widget.Orientation.Vertical; Billboard = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView(Rock.Mobile.PlatformSpecific.Android.Core.Context); Billboard.LayoutParameters = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent); Billboard.SetScaleType(ImageView.ScaleType.CenterCrop); AddView(Billboard); Title = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); Title.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); Title.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Bold), TypefaceStyle.Normal); Title.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize); Title.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor)); Title.Text = ConnectStrings.Main_Connect_Header; ((LinearLayout.LayoutParams)Title.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(2); ((LinearLayout.LayoutParams)Title.LayoutParameters).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(15); ((LinearLayout.LayoutParams)Title.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(2); AddView(Title); }
public ListItem(Context context) : base(context) { Orientation = Android.Widget.Orientation.Vertical; SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); LinearLayout contentLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); contentLayout.Orientation = Android.Widget.Orientation.Horizontal; contentLayout.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); AddView(contentLayout); Thumbnail = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView(Rock.Mobile.PlatformSpecific.Android.Core.Context); Thumbnail.LayoutParameters = new LinearLayout.LayoutParams((int)Rock.Mobile.Graphics.Util.UnitToPx(PrivateConnectConfig.MainPage_ThumbnailDimension), (int)Rock.Mobile.Graphics.Util.UnitToPx(PrivateConnectConfig.MainPage_ThumbnailDimension)); ((LinearLayout.LayoutParams)Thumbnail.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(15); ((LinearLayout.LayoutParams)Thumbnail.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(15); ((LinearLayout.LayoutParams)Thumbnail.LayoutParameters).Gravity = GravityFlags.CenterVertical; Thumbnail.SetScaleType(ImageView.ScaleType.CenterCrop); contentLayout.AddView(Thumbnail); TitleLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); TitleLayout.Orientation = Android.Widget.Orientation.Vertical; TitleLayout.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).Gravity = GravityFlags.CenterVertical; ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(15); contentLayout.AddView(TitleLayout); Title = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); Title.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); Title.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Bold), TypefaceStyle.Normal); Title.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize); Title.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_ActiveTextColor)); Title.SetSingleLine( ); Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End; ((LinearLayout.LayoutParams)Title.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(2); TitleLayout.AddView(Title); SubTitle = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); SubTitle.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); SubTitle.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal); SubTitle.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize); SubTitle.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor)); ((LinearLayout.LayoutParams)SubTitle.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-4); ((LinearLayout.LayoutParams)SubTitle.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(2); TitleLayout.AddView(SubTitle); // fill the remaining space with a dummy view, and that will align our chevron to the right View dummyView = new View(Rock.Mobile.PlatformSpecific.Android.Core.Context); dummyView.LayoutParameters = new LinearLayout.LayoutParams(0, 0); ((LinearLayout.LayoutParams)dummyView.LayoutParameters).Weight = 1; contentLayout.AddView(dummyView); Chevron = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); Chevron.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)Chevron.LayoutParameters).Gravity = GravityFlags.CenterVertical | GravityFlags.Right; Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary); Chevron.SetTypeface(fontFace, TypefaceStyle.Normal); Chevron.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.MainPage_Table_IconSize); Chevron.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor)); Chevron.Text = PrivateConnectConfig.MainPage_Table_Navigate_Icon; contentLayout.AddView(Chevron); // add our own custom seperator at the bottom Seperator = new View(Rock.Mobile.PlatformSpecific.Android.Core.Context); Seperator.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, 0); Seperator.LayoutParameters.Height = 2; Seperator.SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BG_Layer_BorderColor)); AddView(Seperator); }
public PrimaryListItem( Context context ) : base( context ) { SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) ); Orientation = Android.Widget.Orientation.Vertical; Billboard = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Billboard.LayoutParameters = new ViewGroup.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent ); Billboard.SetScaleType( ImageView.ScaleType.CenterCrop ); AddView( Billboard ); Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal ); Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Large_FontSize ); Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) ); Title.Text = ConnectStrings.Main_Connect_Header; ( (LinearLayout.LayoutParams)Title.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 ); ( (LinearLayout.LayoutParams)Title.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); ( (LinearLayout.LayoutParams)Title.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 ); AddView( Title ); }
public ListItem( Context context ) : base( context ) { Orientation = Android.Widget.Orientation.Vertical; SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); LinearLayout contentLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); contentLayout.Orientation = Android.Widget.Orientation.Horizontal; contentLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent ); AddView( contentLayout ); Thumbnail = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Thumbnail.LayoutParameters = new LinearLayout.LayoutParams( (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ), (int)Rock.Mobile.Graphics.Util.UnitToPx( PrivateConnectConfig.MainPage_ThumbnailDimension ) ); ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); ( (LinearLayout.LayoutParams)Thumbnail.LayoutParameters ).Gravity = GravityFlags.CenterVertical; Thumbnail.SetScaleType( ImageView.ScaleType.CenterCrop ); contentLayout.AddView( Thumbnail ); TitleLayout = new LinearLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); TitleLayout.Orientation = Android.Widget.Orientation.Vertical; TitleLayout.LayoutParameters = new LinearLayout.LayoutParams( LayoutParams.WrapContent, LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).Gravity = GravityFlags.CenterVertical; ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 15 ); contentLayout.AddView( TitleLayout ); Title = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Title.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); Title.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Bold ), TypefaceStyle.Normal ); Title.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize ); Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_ActiveTextColor ) ); Title.SetSingleLine( ); Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End; ( (LinearLayout.LayoutParams)Title.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 ); TitleLayout.AddView( Title ); SubTitle = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); SubTitle.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); SubTitle.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal ); SubTitle.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize ); SubTitle.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); ( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 ); ( (LinearLayout.LayoutParams)SubTitle.LayoutParameters ).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( 2 ); TitleLayout.AddView( SubTitle ); // fill the remaining space with a dummy view, and that will align our chevron to the right View dummyView = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context ); dummyView.LayoutParameters = new LinearLayout.LayoutParams( 0, 0 ); ( (LinearLayout.LayoutParams)dummyView.LayoutParameters ).Weight = 1; contentLayout.AddView( dummyView ); Chevron = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Chevron.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)Chevron.LayoutParameters ).Gravity = GravityFlags.CenterVertical | GravityFlags.Right; Typeface fontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Secondary ); Chevron.SetTypeface( fontFace, TypefaceStyle.Normal ); Chevron.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.MainPage_Table_IconSize ); Chevron.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.TextField_PlaceholderTextColor ) ); Chevron.Text = PrivateConnectConfig.MainPage_Table_Navigate_Icon; contentLayout.AddView( Chevron ); // add our own custom seperator at the bottom Seperator = new View( Rock.Mobile.PlatformSpecific.Android.Core.Context ); Seperator.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, 0 ); Seperator.LayoutParameters.Height = 2; Seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_BorderColor ) ); AddView( Seperator ); }
public DoubleNewsListItem( Context context ) : base( context ) { Orientation = Orientation.Horizontal; SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BackgroundColor ) ); LeftLayout = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); LeftLayout.LayoutParameters = new LinearLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, LayoutParams.WrapContent ); AddView( LeftLayout ); LeftImage = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); LeftImage.LayoutParameters = new LinearLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)LeftImage.LayoutParameters ).Gravity = GravityFlags.CenterVertical; LeftImage.SetScaleType( ImageView.ScaleType.CenterCrop ); LeftLayout.AddView( LeftImage ); LeftButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); LeftButton.LayoutParameters = LeftImage.LayoutParameters; LeftButton.Background = null; LeftButton.Click += (object sender, EventArgs e ) => { // notify our parent that the image index was clicked ParentAdapter.RowItemClicked( LeftImageIndex ); }; LeftLayout.AddView( LeftButton ); LeftPrivateOverlay = new TextView( context ); LeftPrivateOverlay.LayoutParameters = new RelativeLayout.LayoutParams( ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent ); LeftPrivateOverlay.SetBackgroundColor( Android.Graphics.Color.Red ); LeftPrivateOverlay.Alpha = .60f; LeftPrivateOverlay.Text = "Private"; LeftPrivateOverlay.Gravity = GravityFlags.Center; LeftLayout.AddView( LeftPrivateOverlay ); RightLayout = new RelativeLayout( Rock.Mobile.PlatformSpecific.Android.Core.Context ); RightLayout.LayoutParameters = new LinearLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, LayoutParams.WrapContent ); AddView( RightLayout ); RightImage = new Rock.Mobile.PlatformSpecific.Android.Graphics.AspectScaledImageView( Rock.Mobile.PlatformSpecific.Android.Core.Context ); RightImage.LayoutParameters = new LinearLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, LayoutParams.WrapContent ); ( (LinearLayout.LayoutParams)RightImage.LayoutParameters ).Gravity = GravityFlags.CenterVertical; RightImage.SetScaleType( ImageView.ScaleType.CenterCrop ); RightLayout.AddView( RightImage ); RightButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context ); RightButton.LayoutParameters = RightImage.LayoutParameters; RightButton.Background = null; RightButton.Click += (object sender, EventArgs e ) => { // notify our parent that the image index was clicked ParentAdapter.RowItemClicked( LeftImageIndex + 1 ); }; RightLayout.AddView( RightButton ); RightPrivateOverlay = new TextView( context ); RightPrivateOverlay.LayoutParameters = new RelativeLayout.LayoutParams( NavbarFragment.GetCurrentContainerDisplayWidth( ) / 2, ViewGroup.LayoutParams.WrapContent ); RightPrivateOverlay.SetBackgroundColor( Android.Graphics.Color.Red ); RightPrivateOverlay.Alpha = .60f; RightPrivateOverlay.Text = "Private"; RightPrivateOverlay.Gravity = GravityFlags.Center; RightLayout.AddView( RightPrivateOverlay ); }