public GroupListItem(Context context) : base(context) { SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); LayoutParameters = new AbsListView.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); Orientation = Orientation.Vertical; LinearLayout contentLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); contentLayout.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); contentLayout.Orientation = Orientation.Horizontal; AddView(contentLayout); TitleLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); TitleLayout.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent); TitleLayout.Orientation = Orientation.Vertical; ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).Weight = 1; ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).Gravity = GravityFlags.CenterVertical; ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(15); ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(5); ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).BottomMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(5); 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.SetSingleLine( ); Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End; Title.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor)); TitleLayout.AddView(Title); Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary); JoinButton = new Button(Rock.Mobile.PlatformSpecific.Android.Core.Context); JoinButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)JoinButton.LayoutParameters).Weight = 0; ((LinearLayout.LayoutParams)JoinButton.LayoutParameters).Gravity = GravityFlags.CenterVertical; JoinButton.SetTypeface(buttonFontFace, TypefaceStyle.Normal); JoinButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateConnectConfig.GroupFinder_Join_IconSize); JoinButton.Text = PrivateConnectConfig.GroupFinder_JoinIcon; JoinButton.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor)); JoinButton.Background = null; JoinButton.FocusableInTouchMode = false; JoinButton.Focusable = false; contentLayout.AddView(JoinButton); JoinButton.Click += (object sender, EventArgs e) => { ParentAdapter.OnClick(Position, 1); }; MeetingTime = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); MeetingTime.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); MeetingTime.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Light), TypefaceStyle.Normal); MeetingTime.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize); MeetingTime.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor)); TitleLayout.AddView(MeetingTime); Distance = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); Distance.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); Distance.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Light), TypefaceStyle.Normal); Distance.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize); Distance.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor)); TitleLayout.AddView(Distance); Childcare = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); Childcare.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); Childcare.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Light), TypefaceStyle.Normal); Childcare.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize); Childcare.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor)); TitleLayout.AddView(Childcare); // add our own custom seperator at the bottom View 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 MessageListItem(Context context) : base(context) { SetBackgroundColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.BackgroundColor)); LayoutParameters = new AbsListView.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); Orientation = Orientation.Vertical; // Content Layout will hold all the items for this row LinearLayout contentLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); contentLayout.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); contentLayout.Orientation = Orientation.Vertical; AddView(contentLayout); // Title Layout holds the title, and the MessageDetailsLayout (which contains date / speaker) TitleLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); TitleLayout.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); TitleLayout.Orientation = Orientation.Horizontal; ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).Weight = 1; ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(15); ((LinearLayout.LayoutParams)TitleLayout.LayoutParameters).TopMargin = (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); ((LinearLayout.LayoutParams)Title.LayoutParameters).Gravity = GravityFlags.Top; ((LinearLayout.LayoutParams)Title.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-4); 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.SetSingleLine( ); Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End; Title.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.Label_TextColor)); TitleLayout.AddView(Title); // This Stores the Date / Speaker MessageDetailsLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); MessageDetailsLayout.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.WrapContent); MessageDetailsLayout.Orientation = Orientation.Vertical; ((LinearLayout.LayoutParams)MessageDetailsLayout.LayoutParameters).Weight = 1; ((LinearLayout.LayoutParams)MessageDetailsLayout.LayoutParameters).Gravity = GravityFlags.Right; ((LinearLayout.LayoutParams)MessageDetailsLayout.LayoutParameters).LeftMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(15); ((LinearLayout.LayoutParams)MessageDetailsLayout.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(15); ((LinearLayout.LayoutParams)MessageDetailsLayout.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(15); TitleLayout.AddView(MessageDetailsLayout); Date = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); Date.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)Date.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-4); ((LinearLayout.LayoutParams)Date.LayoutParameters).Gravity = GravityFlags.Right; Date.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal); Date.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize); Date.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor)); MessageDetailsLayout.AddView(Date); Speaker = new TextView(Rock.Mobile.PlatformSpecific.Android.Core.Context); Speaker.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)Speaker.LayoutParameters).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-4); ((LinearLayout.LayoutParams)Speaker.LayoutParameters).Gravity = GravityFlags.Right; Speaker.SetTypeface(Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(ControlStylingConfig.Font_Regular), TypefaceStyle.Normal); Speaker.SetTextSize(Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Small_FontSize); Speaker.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(ControlStylingConfig.TextField_PlaceholderTextColor)); Speaker.SetMaxLines(1); MessageDetailsLayout.AddView(Speaker); // add our own custom seperator at the bottom View 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); // setup the buttons LinearLayout buttonLayout = new LinearLayout(Rock.Mobile.PlatformSpecific.Android.Core.Context); buttonLayout.LayoutParameters = new LinearLayout.LayoutParams(LayoutParams.MatchParent, LayoutParams.MatchParent); ((LinearLayout.LayoutParams)buttonLayout.LayoutParameters).Weight = 1; buttonLayout.Orientation = Orientation.Horizontal; contentLayout.AddView(buttonLayout); Typeface buttonFontFace = Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont(PrivateControlStylingConfig.Icon_Font_Secondary); ListenButton = new Button(Rock.Mobile.PlatformSpecific.Android.Core.Context); ListenButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)ListenButton.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-10); ListenButton.SetTypeface(buttonFontFace, TypefaceStyle.Normal); ListenButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize); ListenButton.Text = PrivateNoteConfig.Series_Table_Listen_Icon; ListenButton.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(NoteConfig.Details_Table_IconColor)); ListenButton.Background = null; buttonLayout.AddView(ListenButton); WatchButton = new Button(Rock.Mobile.PlatformSpecific.Android.Core.Context); WatchButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)WatchButton.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-10); WatchButton.SetTypeface(buttonFontFace, TypefaceStyle.Normal); WatchButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize); WatchButton.Text = PrivateNoteConfig.Series_Table_Watch_Icon; WatchButton.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(NoteConfig.Details_Table_IconColor)); WatchButton.Background = null; buttonLayout.AddView(WatchButton); DiscussionGuideButton = new Button(Rock.Mobile.PlatformSpecific.Android.Core.Context); DiscussionGuideButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)DiscussionGuideButton.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-10); DiscussionGuideButton.SetTypeface(buttonFontFace, TypefaceStyle.Normal); DiscussionGuideButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize); DiscussionGuideButton.Text = PrivateNoteConfig.Series_Table_DiscussionGuide_Icon; DiscussionGuideButton.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(NoteConfig.Details_Table_IconColor)); DiscussionGuideButton.Background = null; buttonLayout.AddView(DiscussionGuideButton); TakeNotesButton = new Button(Rock.Mobile.PlatformSpecific.Android.Core.Context); TakeNotesButton.LayoutParameters = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent); ((LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters).RightMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx(-10); TakeNotesButton.SetTypeface(buttonFontFace, TypefaceStyle.Normal); TakeNotesButton.SetTextSize(Android.Util.ComplexUnitType.Dip, PrivateNoteConfig.Details_Table_IconSize); TakeNotesButton.Text = PrivateNoteConfig.Series_Table_TakeNotes_Icon; TakeNotesButton.SetTextColor(Rock.Mobile.UI.Util.GetUIColor(NoteConfig.Details_Table_IconColor)); TakeNotesButton.Background = null; buttonLayout.AddView(TakeNotesButton); ListenButton.Click += (object sender, EventArgs e) => { ParentAdapter.OnClick(Position, 0); }; WatchButton.Click += (object sender, EventArgs e) => { ParentAdapter.OnClick(Position, 1); }; TakeNotesButton.Click += (object sender, EventArgs e) => { ParentAdapter.OnClick(Position, 2); }; DiscussionGuideButton.Click += (object sender, EventArgs e) => { ParentAdapter.OnClick(Position, 3); }; }