Example #1
0
        protected virtual View CreateDefaultControl(string value)
        {
            var innerDefaultControl = new Android.Widget.TextView(this.Context);

            innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
            innerDefaultControl.SetSingleLine(true);
            innerDefaultControl.Text = value;
            return(innerDefaultControl);
        }
        public TestResultsGroupView(Context context, TestRunInfo testRunInfo) : base(context)
        {
            var indicatorView = new View(context)
            {
                LayoutParameters = new LayoutParams(18, 18)
                {
                    LeftMargin = 60,
                    RightMargin = 14,
                    TopMargin = 14,
                    BottomMargin = 14,
                    Gravity = GravityFlags.CenterVertical
                }
            };
            indicatorView.SetBackgroundColor(
                testRunInfo.IsIgnored ? Color.Yellow
                : testRunInfo.Running ? Color.Gray
                : testRunInfo.Passed ? Color.Green
                : Color.Red);
            AddView(indicatorView);

            var container = new LinearLayout(context)
            {
                Orientation = Orientation.Vertical,
                LayoutParameters =
                    new ViewGroup.LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent)
            };
            AddView(container);

            var text1 = new TextView(context)
            {
                Text = testRunInfo.Description,
                Ellipsize = TextUtils.TruncateAt.Marquee,
                LayoutParameters =
                    new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };
            text1.SetTextSize(ComplexUnitType.Sp, 22);
            text1.SetSingleLine(true);
            text1.SetPadding(2, 2, 2, 2);
            container.AddView(text1);

            var text2 = new TextView(context)
            {
                Text = testRunInfo.TestCaseName,
                Ellipsize = TextUtils.TruncateAt.Marquee,
                LayoutParameters =
                    new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent)
            };
            text2.SetTextSize(ComplexUnitType.Sp, 14);
            text2.SetSingleLine(true);
            text2.SetPadding(2, 2, 2, 2);
            container.AddView(text2);
        }
Example #3
0
		public BaseCellView(Context context, Cell cell) : base(context)
		{
			_cell = cell;
			SetMinimumWidth((int)context.ToPixels(25));
			SetMinimumHeight((int)context.ToPixels(25));
			Orientation = Orientation.Horizontal;

			var padding = (int)context.FromPixels(8);
			SetPadding(padding, padding, padding, padding);

			_imageView = new ImageView(context);
			var imageParams = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.MatchParent)
			{
				Width = (int)context.ToPixels(60),
				Height = (int)context.ToPixels(60),
				RightMargin = 0,
				Gravity = GravityFlags.Center
			};
			using (imageParams)
				AddView(_imageView, imageParams);

			var textLayout = new LinearLayout(context) { Orientation = Orientation.Vertical };

			_mainText = new TextView(context);
			_mainText.SetSingleLine(true);
			_mainText.Ellipsize = TextUtils.TruncateAt.End;
			_mainText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
			_mainText.SetTextAppearanceCompat(context, global::Android.Resource.Style.TextAppearanceSmall);

			using (var lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent))
				textLayout.AddView(_mainText, lp);

			_detailText = new TextView(context);
			_detailText.SetSingleLine(true);
			_detailText.Ellipsize = TextUtils.TruncateAt.End;
			_detailText.SetPadding((int)context.ToPixels(15), padding, padding, padding);
			_detailText.Visibility = ViewStates.Gone;
			_detailText.SetTextAppearanceCompat(context, global::Android.Resource.Style.TextAppearanceSmall);

			using (var lp = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent))
				textLayout.AddView(_detailText, lp);

			var layoutParams = new LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent) { Width = 0, Weight = 1, Gravity = GravityFlags.Center };

			using (layoutParams)
				AddView(textLayout, layoutParams);

			SetMinimumHeight((int)context.ToPixels(DefaultMinHeight));
			_androidDefaultTextColor = Color.FromUint((uint)_mainText.CurrentTextColor);
		}
Example #4
0
 //protected Visibility NativeComputedHorizontalScrollBarVisibility
 //{
 //    get
 //    {
 //        return ((NativeScrollViewer)this.ContentNativeUIElement).VerticalScrollBarEnabled;
 //    }
 //    set
 //    {
 //    }
 //}
 //protected Visibility NativeComputedVerticalScrollBarVisibility
 //{
 //    get
 //    {
 //        return ((NativeScrollViewer)this.ContentNativeUIElement).VerticalScrollBarEnabled;
 //    }
 //    set
 //    {
 //    }
 //}
 protected override View CreateDefaultControl(string value)
 {
     var innerDefaultControl = new NativeScrollViewer(this.Context);
     innerDefaultControl.ScrollChanged += innerDefaultControl_ScrollChanged;
     innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
     if (this.Background != null)
         innerDefaultControl.SetBackgroundDrawable(this.Background.ToDrawable());
     var text = new Android.Widget.TextView(this.Context);
     text.LayoutParameters = this.CreateLayoutParams();
     text.Text = value;
     text.SetSingleLine(true);
     innerDefaultControl.ChildView = text;
     this.ContentNativeUIElement = innerDefaultControl;
     return innerDefaultControl;
 }
Example #5
0
		public void InitView(List<BookingDocumentDto> _bookingDocs) {
			this.RemoveAllViews ();
			int size = _bookingDocs.Count;
			for(int i = 0; i < size; i ++) {
				LinearLayout ll = new LinearLayout (_context);
				ll.Orientation = Orientation.Horizontal;
				ll.SetVerticalGravity (GravityFlags.CenterVertical);

				ImageView imgFile = new ImageView (_context);
				imgFile.SetImageResource (Resource.Drawable.ic_attach);

				var tvFileAttach = new TextView (_context) {
					Text = _bookingDocs[i].OriginalFileName
				};
				tvFileAttach.Id = i;
				tvFileAttach.SetTextColor (Color.Blue);
				tvFileAttach.PaintFlags = PaintFlags.UnderlineText;
				tvFileAttach.SetTypeface (null, TypefaceStyle.Bold);
				tvFileAttach.SetSingleLine (true);
				tvFileAttach.Ellipsize = global::Android.Text.TextUtils.TruncateAt.Middle;
				tvFileAttach.SetPadding (5, 0, 10, 0);
				LayoutParams param = new TableRow.LayoutParams(0, LayoutParams.WrapContent, 1f);
				tvFileAttach.LayoutParameters = param;
				tvFileAttach.Click += (sender, e) => {
					utilsAndroid.onViewFile(_context, _bookingDocs[tvFileAttach.Id].S3FileName);
				};

				ImageButton imgDelete = new ImageButton (_context);
				imgDelete.Id = i;
				imgDelete.SetImageResource (Resource.Drawable.ic_delete);
				imgDelete.SetMinimumWidth (50);
				imgDelete.SetMinimumHeight (50);
				imgDelete.SetBackgroundColor (Color.Transparent);
				imgDelete.Click += (sender, e) => {
					_deleteFile.onDeleteFile(_isInConference, _bookingDocs[imgDelete.Id]);
				};

				ll.AddView (imgFile);
				ll.AddView (tvFileAttach);
				ll.AddView (imgDelete);
				ll.SetPadding (0, 5, 0, 5);

				this.AddView (ll);
			}
		}
        //protected Visibility NativeComputedHorizontalScrollBarVisibility
        //{
        //    get
        //    {
        //        return ((NativeScrollViewer)this.ContentNativeUIElement).VerticalScrollBarEnabled;
        //    }
        //    set
        //    {
        //    }
        //}

        //protected Visibility NativeComputedVerticalScrollBarVisibility
        //{
        //    get
        //    {
        //        return ((NativeScrollViewer)this.ContentNativeUIElement).VerticalScrollBarEnabled;
        //    }
        //    set
        //    {
        //    }
        //}

        protected override View CreateDefaultControl(string value)
        {
            var innerDefaultControl = new NativeScrollViewer(this.Context);

            innerDefaultControl.ScrollChanged   += innerDefaultControl_ScrollChanged;
            innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
            if (this.Background != null)
            {
                innerDefaultControl.SetBackgroundDrawable(this.Background.ToDrawable());
            }
            var text = new Android.Widget.TextView(this.Context);

            text.LayoutParameters = this.CreateLayoutParams();
            text.Text             = value;
            text.SetSingleLine(true);
            innerDefaultControl.ChildView = text;
            this.ContentNativeUIElement   = innerDefaultControl;
            return(innerDefaultControl);
        }
Example #7
0
 protected override View CreateDefaultControl(string value)
 {
     if (this.Content is string)
     {
         var control = new TextBlock
         {
             FontFamily = this.FontFamily,
             Text       = this.Content as string,
             FontSize   = this.FontSize,
             FontStyle  = this.FontStyle,
             Foreground = this.Foreground
         };
         LogicalTreeHelper.AddLogicalChild(this, control);
         return(control.NativeUIElement);
     }
     else
     {
         var innerDefaultControl = new Android.Widget.TextView(this.Context);
         innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
         innerDefaultControl.SetSingleLine(true);
         innerDefaultControl.TextFormatted = Html.FromHtml(String.Format("<a href=\"\">{0}</a>", value));
         return(innerDefaultControl);
     }
 }
		void Initialize ()
		{
			this.LayoutParameters = new RelativeLayout.LayoutParams(-1,-2);// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			this.SetGravity(GravityFlags.CenterHorizontal);


			imBack = new ImageView (context);
			image = new LinearLayout(context);
			txtDescription = new TextView (context);
			txtTitle = new TextView (context);
			background = new LinearLayout (context);
			relTemp = new LinearLayout(context);


			//LinearLayout.LayoutParams paramL = new new LinearLayout.LayoutParams (Configuration.getWidth (530), Configuration.getHeight (356));

			background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (530), -2);
			background.Orientation = Orientation.Vertical;



			//background.SetBackgroundColor (Color.ParseColor ("#50000000"));
			//background.BaselineAligned = true;

			image.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), -2);
			image.Orientation = Orientation.Vertical;
			//image.SetGravity (GravityFlags.Center);

			relTemp.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), -2);
			//relTemp.SetGravity (GravityFlags.Center);

			//RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(Configuration.getWidth (530), Configuration.getHeight (356));

			//param.AddRule (LayoutRules.CenterInParent);

			relTemp.AddView (background);


			txtTitle.SetTextColor (Color.ParseColor("#424242"));
			txtDescription.SetTextColor(Color.ParseColor("#424242"));
			//txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			//txtDescription.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));

			txtTitle.SetTextSize (ComplexUnitType.Dip, 21.0f);
			txtDescription.SetTextSize (ComplexUnitType.Dip, 12.0f);
			txtDescription.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
			txtDescription.SetSingleLine (false);
			//txtDescription.SetMaxLines (9);
			//txtDescription.line


			background.AddView (txtTitle);
			background.AddView (txtDescription);



			image.AddView (relTemp);
			image.AddView (imBack);
			this.AddView (image);
			//this.AddView (background);


		}
		void Initialize ()
		{
			this.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			this.Orientation = Orientation.Vertical;

			linea_separador = new View (context);
			linea_separador.LayoutParameters = new ViewGroup.LayoutParams (-1, 5);
			linea_separador.SetBackgroundColor (Color.ParseColor ("#eeeeee"));

			imgUser = new ImageView (context);
			scrollImage = new HorizontalScrollView (context);
			scrollImage.HorizontalScrollBarEnabled = false;
			linearImage = new LinearLayout (context);
			linearPanelScroll = new LinearLayout (context);
			linearContainer = new LinearLayout (context);
			linearAll = new LinearLayout (context);

			txtAuthor = new TextView (context);
			txtContainer = new TextView (context);
			txtTitle = new TextView (context);


			linearAll.LayoutParameters = new LinearLayout.LayoutParams (-1,-2);
			linearImage.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(140),-2);
			linearContainer.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(500),-2);
			linearPanelScroll.LayoutParameters = new LinearLayout.LayoutParams (-2,-2);
			scrollImage.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (500), -2);


			linearAll.Orientation = Orientation.Horizontal;
			linearImage.Orientation = Orientation.Vertical;
			linearContainer.Orientation = Orientation.Vertical;

			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight(40));
			txtAuthor.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (30));
			txtContainer.SetTextSize(ComplexUnitType.Px, Configuration.getHeight (45));
			txtAuthor.SetTextColor (Color.ParseColor("#3c3c3c"));
			txtContainer.SetTextColor (Color.ParseColor("#3c3c3c"));

			txtTitle.SetSingleLine (true);
			txtAuthor.SetSingleLine (true);
			txtContainer.SetSingleLine (false);
			txtContainer.SetPadding (0, 0, 20, 0);
			txtContainer.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf");
			txtAuthor.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeueLight.ttf");

			scrollImage.AddView (linearPanelScroll);
			linearAll.AddView (linearImage);
			linearAll.AddView (linearContainer);

			linearImage.AddView (imgUser);

			linearContainer.AddView (txtTitle);
			linearContainer.AddView (txtAuthor);
			linearContainer.AddView (txtContainer);
			linearContainer.AddView (scrollImage);

			int space = Configuration.getHeight (50);



			scrollImage.SetPadding (0, 0, 0, space);
			this.AddView (linearAll);
			this.AddView (linea_separador);
			this.SetPadding (0, 0,0, space);


		}
Example #10
0
        protected virtual void SetInputType(TextView txt, InputType inputType)
        {
            switch (inputType) {

                case InputType.Email:
                    txt.InputType = InputTypes.ClassText | InputTypes.TextVariationEmailAddress;
                    txt.SetSingleLine(true);
                    break;

                case InputType.Name:
                    txt.InputType = InputTypes.TextVariationPersonName;
                    txt.SetSingleLine(true);
                    break;

                case InputType.Number:
                    txt.InputType = InputTypes.ClassNumber;
                    txt.SetSingleLine(true);
                    break;

                case InputType.NumericPassword:
                    txt.InputType = InputTypes.ClassNumber;
                    txt.TransformationMethod = PasswordTransformationMethod.Instance;
                    break;

                case InputType.Password:
                    txt.TransformationMethod = PasswordTransformationMethod.Instance;
                    txt.InputType = InputTypes.ClassText | InputTypes.TextVariationPassword;
                    break;

                case InputType.Phone:
                    txt.InputType = InputTypes.ClassPhone;
                    txt.SetSingleLine(true);
                    break;

                case InputType.Url:
                    txt.InputType = InputTypes.TextVariationUri;
                    txt.SetSingleLine(true);
                    break;
            }
        }
Example #11
0
		private void Init(){
			this.Orientation = Orientation.Vertical;
			this.SetBackgroundResource(Resource.Color.bg_color);
			int iSpecializationSize = specInfos.SpecialistDetail.Specializations.Count;
			for (int k = 0; k < iSpecializationSize; k++) {
				var tvSpecialisation = new TextView (this.Context) {
					Text = specInfos.SpecialistDetail.Specializations [k].ProfessionalOrTrade
				};
				tvSpecialisation.SetTextColor (Color.Black);
				tvSpecialisation.SetTypeface (null, TypefaceStyle.Bold);
				tvSpecialisation.SetPadding (padLeft, padTop, 0, 0);
				this.AddView (tvSpecialisation);

				var tvSpecialisationMajor = new TextView (this.Context) {
					Text = specInfos.SpecialistDetail.Specializations [k].Name
				};
				tvSpecialisationMajor.SetTextColor (Color.Black);
				tvSpecialisationMajor.SetTypeface (null, TypefaceStyle.Bold);
				tvSpecialisationMajor.SetPadding (padLeft1, padTop, 0, 0);
				this.AddView (tvSpecialisationMajor);

				string sTextLicense = " No";
				if (specInfos.SpecialistDetail.Specializations [k].LicenceToOperate) {
					sTextLicense = " Yes";
				}
				var tvLicence = new TextView (this.Context) {
					Text = context.GetString (Resource.String.licence_title) + sTextLicense
				};
				tvLicence.SetTextColor (Color.Black);
				tvLicence.SetPadding (padLeft2, padTop, 0, 0);
				tvLicence.SetTypeface (null, TypefaceStyle.Bold);
				this.AddView (tvLicence);
				if (specInfos.SpecialistDetail.Specializations [k].LicenceToOperate) {
					var tvLicenceNumber = new TextView (this.Context) {
						Text = "License Number: " + specInfos.SpecialistDetail.Specializations [k].LicenseNumber
					};
					tvLicenceNumber.SetTextColor (Color.Black);
					tvLicenceNumber.SetPadding (padLeft2, padTop, 0, 0);
					tvLicenceNumber.SetTypeface (null, TypefaceStyle.Bold);
					tvLicenceNumber.SetSingleLine (true);
					tvLicenceNumber.Ellipsize = global::Android.Text.TextUtils.TruncateAt.End;
					this.AddView (tvLicenceNumber);


//				ImageView img = new ImageView (context);
//				if (specInfos.SpecialistDetail.Specializations [k].LicenceToOperate)
//					img.SetImageResource (Resource.Drawable.ic_check);
//				else
//					img.SetImageResource (Resource.Drawable.ic_close_large);
//
//				RelativeLayout.LayoutParams param = new RelativeLayout.LayoutParams(32 ,32);
//				param.TopMargin = 15;
//				img.LayoutParameters = param;
//				LinearLayout ll = new LinearLayout (context);
//				ll.Orientation = Orientation.Horizontal;
//				ll.SetVerticalGravity (GravityFlags.CenterVertical);
//				ll.AddView (tvLicence);
//				ll.AddView (img);
//
//				this.AddView (ll);

					var tvCountryPermittedTitle = new TextView (this.Context) {
						Text = context.GetString (Resource.String.country_permitted)
					};
					tvCountryPermittedTitle.SetTextColor (Color.Black);
					tvCountryPermittedTitle.SetPadding (padLeft2, padTop, 0, 0);
					tvCountryPermittedTitle.SetTypeface (null, TypefaceStyle.Bold);
					this.AddView (tvCountryPermittedTitle);

					int size = specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted.Count;
					for (int n = 0; n < size; n++) {
						var tvCountry = new TextView (this.Context) {
							Text = specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].Name
						};
						tvCountry.SetTextColor (Color.Black);
						tvCountry.SetPadding (padLeft3, padTop, 0, 0);
						tvCountry.SetTypeface (null, TypefaceStyle.Bold);
						this.AddView (tvCountry);

						int size1 = specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].StatesAndRegulatories.Count;
						for (int i = 0; i < size1; i++) {
							var tvState = new TextView (this.Context) {
								Text = "State: " + specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].StatesAndRegulatories [i].State
							};
							tvState.SetTextColor (Color.Black);
							tvState.SetPadding (padLeft4, padTop1, 0, 0);

							var tvRegulatory = new TextView (this.Context) {
								Text = "Regulatory Authority: " + specInfos.SpecialistDetail.Specializations [k].lstCountryPermitted [n].StatesAndRegulatories [i].Regulatory
							};
							tvRegulatory.SetTextColor (Color.Black);
							tvRegulatory.SetPadding (padLeft4, padTop1, 0, padTop2);

							this.AddView (tvState);
							this.AddView (tvRegulatory);
						}
					}

					var tvProof = new TextView (this.Context) {
						Text = context.GetString (Resource.String.proof_title)
					};
					tvProof.SetTextColor (Color.Black);
					tvProof.SetPadding (padLeft2, 0, 0, 0);
					tvProof.SetTypeface (null, TypefaceStyle.Bold);
					this.AddView (tvProof);

					for (int i = 0; i < specInfos.SpecialistDetail.Specializations [k].POCs.Count; i++) {
						listFileName.Add (specInfos.SpecialistDetail.Specializations [k].POCs [i].S3FileName);
						var tvPOCPath = new TextView (this.Context) {
							Text = specInfos.SpecialistDetail.Specializations [k].POCs [i].S3FileName
						};
						tvPOCPath.Id = i;
						tvPOCPath.SetTextColor (Color.Blue);
						tvPOCPath.SetPadding (padLeft3, 5, 0, 0);
						tvPOCPath.PaintFlags = PaintFlags.UnderlineText;
						tvPOCPath.SetTypeface (null, TypefaceStyle.Bold);
						tvPOCPath.SetSingleLine (true);
						tvPOCPath.Ellipsize = global::Android.Text.TextUtils.TruncateAt.Middle;
						tvPOCPath.Click += (sender, e) => {
							utilsAndroid.onViewFile (context, listFileName [tvPOCPath.Id]);
						};

						this.AddView (tvPOCPath);
					}
				}
				string str = "GST applies: No";
				if (specInfos.SpecialistDetail.Specializations [k].GST)
					str = "GST applies: Yes";
				var tvGST = new TextView (this.Context) {
					Text = str
				};
				tvGST.SetTextColor (Color.Black);
				tvGST.SetPadding (padLeft2, padTop, 0, 5);
				tvGST.SetTypeface (null, TypefaceStyle.Bold);
				this.AddView (tvGST);
			}
		}
                        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 );
                        }
		public HomePage ()
		{
			InitializeComponent ();

#if __IOS__
			const string originalText = "Native UILabel.";
			const string longerText = "Native UILabel. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue.";

			var uiLabel = new UILabel {
				MinimumFontSize = 14f,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = originalText,
			};
			stackLayout.Children.Add (uiLabel);

			var uiButton = new UIButton (UIButtonType.RoundedRect);
			uiButton.SetTitle ("Change Text", UIControlState.Normal);
			uiButton.Font = UIFont.FromName ("Helvetica", 14f);
			uiButton.TouchUpInside += (sender, args) => {
				uiLabel.Text = uiLabel.Text == originalText ? longerText : originalText;
				uiLabel.SizeToFit ();
			};
			stackLayout.Children.Add (uiButton);

			var explanation1 = new UILabel {
				MinimumFontSize = 14f,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = "The next control is a CustomControl (a customized UILabel with a bad SizeThatFits implementation).",
			};
			stackLayout.Children.Add (explanation1);

			var brokenControl = new CustomControl {
				MinimumFontSize = 14,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = "This control has incorrect sizing - there's empty space above and below it."
			};
			stackLayout.Children.Add (brokenControl);

			var explanation2 = new UILabel {
				MinimumFontSize = 14f,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = "The next control is a CustomControl, but an override to the GetDesiredSize method is passed in when adding the control to the layout.",
			};
			stackLayout.Children.Add (explanation2);

			var fixedControl = new CustomControl {
				MinimumFontSize = 14,
				Lines = 0,
				LineBreakMode = UILineBreakMode.WordWrap,
				Text = "This control has correct sizing - there's no empty space above and below it."
			};
			stackLayout.Children.Add (fixedControl, FixSize);
#endif

#if __ANDROID__
			const string originalText = "Native TextView.";
			const string longerText = "Native TextView. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue.";

			var textView = new TextView (Forms.Context) { Text = originalText, TextSize = 14 };
			textView.SetSingleLine (false);
			textView.SetLines (3);
			stackLayout.Children.Add (textView);

			var button = new Android.Widget.Button (Forms.Context) { Text = "Change Text" };
			button.Click += (sender, args) => {
				textView.Text = textView.Text == originalText ? longerText : originalText;
			};
			stackLayout.Children.Add (button);

			var explanation1 = new TextView (Forms.Context) {
				Text = "The next control is a CustomControl (a customized TextView with a bad OnMeasure implementation).",
				TextSize = 14
			};
			stackLayout.Children.Add (explanation1);

			var brokenControl = new CustomControl (Forms.Context) {
				Text = "This control has incorrect sizing - it doesn't occupy the available width of the device.",
				TextSize = 14
			};
			stackLayout.Children.Add (brokenControl);

			var explanation2 = new TextView (Forms.Context) {
				Text = "The next control is a CustomControl, but with a custom GetDesiredSize delegate to accomodate it's sizing problem.",
				TextSize = 14
			};
			stackLayout.Children.Add (explanation2);

			var goodControl = new CustomControl (Forms.Context) {
				Text = "This control has correct sizing - it occupies the available width of the device.",
				TextSize = 14
			};
			stackLayout.Children.Add (goodControl, FixSize);
#endif

#if WINDOWS_PHONE_APP
            const string originalText = "Native TextBlock.";
            const string longerText = "Native TextBlock. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue.";

            var textBlock = new TextBlock
            {
                Text = originalText,
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(textBlock);

            var button = new Windows.UI.Xaml.Controls.Button { Content = "Change Text" };
            button.Click += (sender, args) => { textBlock.Text = textBlock.Text == originalText ? longerText : originalText; };
            stackLayout.Children.Add(button);

            var explanation1 = new TextBlock
            {
                Text = "The next control is a CustomControl (a customized TextBlock with a bad ArrangeOverride implementation).",
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(explanation1);

            var brokenControl = new CustomControl { Text = "This control has incorrect sizing - it doesn't occupy the available width of the device." };
            stackLayout.Children.Add(brokenControl);

            var explanation2 = new TextBlock
            {
                Text = "The next control is a CustomControl, but an ArrangeOverride delegate is passed in when adding the control to the layout.",
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(explanation2);

            var fixedControl = new CustomControl { Text = "This control has correct sizing - it occupies the available width of the device." };
            stackLayout.Children.Add(fixedControl, arrangeOverrideDelegate: (renderer, finalSize) =>
            {
                if (finalSize.Width <= 0 || double.IsInfinity(finalSize.Width))
                {
                    return null;
                }
                var frameworkElement = renderer.Control;
                frameworkElement.Arrange(new Rect(0, 0, finalSize.Width * 2, finalSize.Height));
                return finalSize;
            }); 
#endif

#if WINDOWS_UWP
            const string originalText = "Native TextBlock.";
            const string longerText = "Native TextBlock. Lorem ipsum dolor sit amet, consectetur adipiscing elit. Ut vel elit orci. Nam sollicitudin consectetur congue.";

            var textBlock = new TextBlock
            {
                Text = originalText,
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(textBlock);

            var button = new Windows.UI.Xaml.Controls.Button { Content = "Change Text" };
            button.Click += (sender, args) => { textBlock.Text = textBlock.Text == originalText ? longerText : originalText; };
            stackLayout.Children.Add(button);

            var explanation1 = new TextBlock
            {
                Text = "The next control is a CustomControl (a customized TextBlock with a bad ArrangeOverride implementation).",
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(explanation1);

            var brokenControl = new CustomControl { Text = "This control has incorrect sizing - it doesn't occupy the available width of the device." };
            stackLayout.Children.Add(brokenControl);

            var explanation2 = new TextBlock
            {
                Text = "The next control is a CustomControl, but an ArrangeOverride delegate is passed in when adding the control to the layout.",
                FontSize = 14,
                FontFamily = new FontFamily("HelveticaNeue"),
                TextWrapping = TextWrapping.Wrap
            };
            stackLayout.Children.Add(explanation2);

            var fixedControl = new CustomControl { Text = "This control has correct sizing - it occupies the available width of the device." };
            stackLayout.Children.Add(fixedControl, arrangeOverrideDelegate: (renderer, finalSize) =>
            {
                if (finalSize.Width <= 0 || double.IsInfinity(finalSize.Width))
                {
                    return null;
                }
                var frameworkElement = renderer.Control;
                frameworkElement.Arrange(new Rect(0, 0, finalSize.Width * 2, finalSize.Height));
                return finalSize;
            });
#endif
		}
        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow header = new TableRow (Activity);
            header.SetMinimumHeight (88);
            TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
            hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Gravity = GravityFlags.Center;
            //			hParamsDrug.Span = 2;

            TextView hDrug = new TextView (Activity);
            hDrug.Text = @"Препараты";
            hDrug.LayoutParameters = hParamsDrug;
            header.AddView(hDrug);

            TableRow.LayoutParams p = new TableRow.LayoutParams ();
            p.Height = TableLayout.LayoutParams.WrapContent;
            p.Width = TableLayout.LayoutParams.WrapContent;
            p.Gravity = GravityFlags.Center;

            TableLayout tlHeader = new TableLayout (Activity);
            TableRow rAttendance = new TableRow (Activity);

            foreach (var attendace in currentAttendances) {
                TextView hAttendace = new TextView (Activity);
                hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
                hAttendace.LayoutParameters = p;
                hAttendace.Rotation = -70;
                header.AddView (hAttendace);
            //				rAttendance.AddView(hAttendace);
            }
            //			tlHeader.AddView (rAttendance);
            //			header.AddView (tlHeader);
            //			table.AddView(header);

            foreach (var info in infos) {
                TableRow r = new TableRow (Activity);

                TextView v = new TextView (Activity);
                v.Gravity = GravityFlags.Center;
                v.SetSingleLine (false);
                v.SetMinimumHeight (72);
                v.SetMinimumWidth (68);
                v.Rotation = -90;
                //				v.SetBackgroundResource (Resource.Style.text_row);
                //				v.SetB
                //				v.Text = info.infoID.ToString();
                //				v.Text = GetInfo(info.infoID).name;
                //				v.SetHorizontallyScrolling (false);
                v.Text = info.name;
                v.LayoutParameters = p;

                r.AddView (v);

                TableLayout tl = new TableLayout (Activity);
                if (header.Parent == null) {
                    tl.AddView (header);
                }
                tl.Id = info.id;
                foreach (var drug in drugs) {
                    TableRow rr = new TableRow (Activity);
                    rr.Id = drug.id;

                    TextView vv = new TextView (Activity);
                    vv.Gravity = GravityFlags.Center;
                    vv.SetMinimumHeight (42);
                    vv.SetMinimumWidth (76);
                    //					vv.Text = drugInfo.drugID.ToString();
                    //					vv.Text = GetDrug(drugInfo.drugID).fullName;
                    vv.Text = drug.fullName;
                    vv.LayoutParameters = p;
                    rr.AddView (vv);

                    foreach (var attendace in currentAttendances) {
                        RelativeLayout rl = new RelativeLayout(Activity);
                        rl.SetGravity (GravityFlags.Center);
                        rl.SetMinimumHeight (68);
                        rl.SetMinimumWidth (68);
                        rl.LayoutParameters = p;
                        rl.Id = attendace.id;

                        string value = string.Empty;
                        if (attendace.id != -1) {
                            value = AttendanceResultManager.GetAttendanceResultValue (attendace.id, info.id, drug.id);
                        } else {
                            value = AttendanceResultManager.GetResultValue (newAttendanceResults, info.id, drug.id);
                            rl.Click += Rl_Click;
                        }

                        TextView vvv = new TextView (Activity);
                        vvv.Gravity = GravityFlags.Center;
                        if (string.IsNullOrEmpty (value) || value.Equals(@"N")) {
                            vvv.SetTextAppearance (Activity, Resource.Style.text_danger);
            //							rl.SetBa
                            rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
            //							rl.SetBackgroundResource(Resource.Style.alert_success);
                        } else {
                            vvv.SetTextAppearance (Activity, Resource.Style.text_success);
            //							vvv.SetTextSize (ComplexUnitType.Sp, 24);
            //							vvv.SetTextColor(Android.Graphics.Color.Argb);

                            rl.SetBackgroundColor (Android.Graphics.Color.LightGreen);
                        }
                        vvv.Text = AttendanceResult.StringBoolToRussian(value);
                        rl.AddView (vvv);
                        rr.AddView (rl);
                    }

                    tl.AddView (rr);
                }

                r.AddView (tl);
                table.AddView (r);
            }
        }
        void RefreshTable()
        {
            table.RemoveAllViews ();

            TableRow header = new TableRow (Activity);
            header.SetMinimumHeight (70);
            TableRow.LayoutParams hParamsDrug = new TableRow.LayoutParams ();
            hParamsDrug.Height = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Width = TableLayout.LayoutParams.WrapContent;
            hParamsDrug.Gravity = GravityFlags.Center;
            //			hParamsDrug.Span = 2;

            TextView hDrug = new TextView (Activity);
            hDrug.Text = @"Препараты";
            hDrug.LayoutParameters = hParamsDrug;
            header.AddView(hDrug);

            TableRow.LayoutParams p = new TableRow.LayoutParams ();
            p.Height = TableLayout.LayoutParams.WrapContent;
            p.Width = TableLayout.LayoutParams.WrapContent;
            p.Gravity = GravityFlags.Center;

            TableLayout tlHeader = new TableLayout (Activity);
            TableRow rAttendance = new TableRow (Activity);

            foreach (var attendace in drugInfo.attendaces) {
                TextView hAttendace = new TextView (Activity);
                hAttendace.Text = attendace.date.ToString(@"dd-MMM ddd");
                hAttendace.LayoutParameters = p;
                hAttendace.Rotation = -60;
                header.AddView (hAttendace);
            //				rAttendance.AddView(hAttendace);
            }
            //			tlHeader.AddView (rAttendance);
            //			header.AddView (tlHeader);
            //			table.AddView(header);

            foreach (var info in infos) {
                TableRow r = new TableRow (Activity);

                TextView v = new TextView (Activity);
                v.Gravity = GravityFlags.Center;
                v.SetSingleLine (false);
                v.SetMinimumHeight (72);
                v.SetMinimumWidth (68);
                v.Rotation = -90;
                //				v.SetBackgroundResource (Resource.Style.text_row);
                //				v.SetB
                //				v.Text = info.infoID.ToString();
                //				v.Text = GetInfo(info.infoID).name;
                //				v.SetHorizontallyScrolling (false);
                v.Text = info.name;
                v.LayoutParameters = p;

                r.AddView (v);

                TableLayout tl = new TableLayout (Activity);
                if (header.Parent == null) {
                    tl.AddView (header);
                }
                tl.Id = info.id;
                foreach (var drug in drugs) {
                    TableRow rr = new TableRow (Activity);
                    rr.Id = drug.id;

                    TextView vv = new TextView (Activity);
                    vv.Gravity = GravityFlags.Center;
                    vv.SetMinimumHeight (42);
                    vv.SetMinimumWidth (76);
                    //					vv.Text = drugInfo.drugID.ToString();
                    //					vv.Text = GetDrug(drugInfo.drugID).fullName;
                    vv.Text = drug.fullName;
                    vv.LayoutParameters = p;
                    rr.AddView (vv);

                    foreach (var attendace in drugInfo.attendaces) {
                        RelativeLayout rl = new RelativeLayout(Activity);
                        rl.SetGravity (GravityFlags.Center);
                        rl.SetMinimumHeight (68);
                        rl.SetMinimumWidth (68);
                        rl.LayoutParameters = p;
                        rl.Id = attendace.id;
                        rl.Click += (object sender, EventArgs e) => {
                            RelativeLayout rlAttendace = (RelativeLayout) sender;
                            TableRow trDrug = (TableRow) rl.Parent;
                            TableLayout trInfo = (TableLayout) rl.Parent.Parent;

                            string message = string.Format(@"Click to RL.id:{0}, P,id:{1}, PP.id:{2}", rlAttendace.Id, trDrug.Id, trInfo.Id);

                            Toast.MakeText(Activity,  message, ToastLength.Short).Show();

                            FragmentTransaction trans = FragmentManager.BeginTransaction ();
                            DrugInfoValueDialog drugInfoValueDialog = new DrugInfoValueDialog ();
                            Bundle args = new Bundle();
                            args.PutInt(DrugInfoValueDialog.ATTENDANCE_ID, rlAttendace.Id);
                            args.PutInt(DrugInfoValueDialog.DRUG_ID, trDrug.Id);
                            args.PutInt(DrugInfoValueDialog.INFO_ID, trInfo.Id);
            //							args.PutString(DrugInfoValueDialog.VALUE, GetDrugInfoValue(drugInfo.attendaces[rlAttendace.Id - 1].results, trInfo.Id, trDrug.Id));

                            drugInfoValueDialog.Arguments = args;
                            drugInfoValueDialog.AfterSave += DrugInfoValueDialog_AfterSave;

                            drugInfoValueDialog.Show (trans, "dialog fragment");

                            Log.Info ("ifSignInButton", "Click");
                        };

            //						string value = GetDrugInfoValue (attendace.results, info.id, drug.id);

                        if (string.IsNullOrEmpty (value)) {
                            ImageView iv = new ImageView (Activity);
                            iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp);
                            rl.SetBackgroundColor (Android.Graphics.Color.LightPink);
            //							rl.SetBackgroundResource(Resource.Style.alert_success);
                            rl.AddView (iv);
                        } else {
                            TextView vvv = new TextView (Activity);
                            vvv.Gravity = GravityFlags.Center;
                            vvv.Text = value;
                            vvv.SetTextAppearance (Activity, Resource.Style.text_success);
            //							vvv.SetTextSize (ComplexUnitType.Sp, 24);
            //							vvv.SetTextColor(Android.Graphics.Color.Argb);

                            rl.SetBackgroundColor (Android.Graphics.Color.LightGreen);
                            rl.AddView (vvv);
                        }

                        rr.AddView (rl);
                    }

                    //					for (int i = 0; i < 2; i++) { // Values
                    //						ImageView iv = new ImageView (Activity);
                    //						iv.SetImageResource (Resource.Drawable.ic_add_circle_white_24dp);
                    //						rr.AddView (iv);
                    //					}

                    tl.AddView (rr);
                }

                r.AddView (tl);
                table.AddView (r);
            }
        }
        private void Init()
        {
            base.RemoveAllViews();

            hintTextView = new EditText(Context);
            textTextView = new NoCursorMovingEditText(Context, BackKeyPressed);

            linearLayout = new LinearLayout(Context);
            linearLayout.LayoutParameters = new ViewGroup.LayoutParams(LinearLayout.LayoutParams.MatchParent, (int)GetContainerHeight());

            textLayout = new RelativeLayout(Context);
            textLayout.LayoutParameters = new LinearLayout.LayoutParams(0, LinearLayout.LayoutParams.MatchParent, 1);
            textLayout.SetGravity(GravityFlags.Center);

            linearLayout.AddView(textLayout);

            textTextView.SetTextAppearance(Context, Resource.Style.judo_payments_CardText);
            hintTextView.SetTextAppearance(Context, Resource.Style.judo_payments_HintText);

            LayoutParams lp = new LayoutParams(LinearLayout.LayoutParams.MatchParent,
                LinearLayout.LayoutParams.WrapContent);
            lp.AddRule(LayoutRules.CenterVertical);

            hintTextView.LayoutParameters = lp;
            textTextView.LayoutParameters = lp;
            hintTextView.Enabled = false;
            hintTextView.Focusable = false;

            textTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;
            hintTextView.InputType = InputTypes.ClassNumber | InputTypes.TextFlagNoSuggestions;

            hintTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
            textTextView.SetBackgroundColor(Resources.GetColor(Android.Resource.Color.Transparent));
            int horizontalPadding =
                Resources.GetDimensionPixelOffset(Resource.Dimension.backgroundhinttextview_horizontal_padding);
            hintTextView.SetPadding(horizontalPadding, 0 , horizontalPadding, 0);
            textTextView.SetPadding(horizontalPadding, 0, horizontalPadding, 0);

            textErrorView = new EditText(Context);
            RelativeLayout.LayoutParams errorLP = new RelativeLayout.LayoutParams(LayoutParams.MatchParent,
                LayoutParams.WrapContent);
            errorLP.AddRule(LayoutRules.CenterVertical);

            int margin = UiUtils.ToPixels(Context, 2);
            errorLP.SetMargins(margin, 0, margin, 0);

            textErrorView.LayoutParameters = errorLP;
            textErrorView.Enabled = false;
            textErrorView.Focusable = false;
            textErrorView.Visibility = ViewStates.Gone;
            textErrorView.SetBackgroundColor(Color.Red);
            int errorVerticalPadding =
                Context.Resources.GetDimensionPixelOffset(
                    Resource.Dimension.backgroundhinttextview_error_vertical_padding);
            textErrorView.SetPadding(horizontalPadding, errorVerticalPadding, horizontalPadding, errorVerticalPadding);
            textErrorView.Text = errorText;
            textErrorView.SetSingleLine(true);
            textErrorView.Gravity = GravityFlags.Center;
            textErrorView.SetTextAppearance(Context, Resource.Style.judo_payments_ErrorText);

            //set courier font
            Typeface type = Typefaces.LoadTypefaceFromRaw(Context, Resource.Raw.courier);
            //hintTextView.Typeface = type;
            hintTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            //textTextView.Typeface = type;
            textTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            textErrorView.Typeface = type;


            textLayout.AddView(hintTextView);
            textLayout.AddView(textTextView);

            AddView(linearLayout);

            IEnumerable<char> previousCharSequence;
            EventHandler<TextChangedEventArgs> beforeTextChanged = (sender, args) =>
                                                                    {
                                                                        previousCharSequence = args.Text;
                                                                    };

            EventHandler<TextChangedEventArgs> textChanged = (sender, args) =>
                                                            {
                                                                beforeTextSize = args.BeforeCount;
                                                            };

            EventHandler<AfterTextChangedEventArgs> afterTextChanged = null;

            
            Action<string> updateTextView = newText =>
            {
                textTextView.TextChanged -= textChanged;
                textTextView.BeforeTextChanged -= beforeTextChanged;
                textTextView.AfterTextChanged -= afterTextChanged;

                textTextView.Text = newText;

                textTextView.TextChanged += textChanged;
                textTextView.BeforeTextChanged += beforeTextChanged;
                textTextView.AfterTextChanged += afterTextChanged;
            };

            afterTextChanged = (sender, args) =>
            {
                var length = args.Editable.ToString().Length;
                var deleting = beforeTextSize == 1;

                if (deleting)
                {
                    nextMustBeDeleted = false;
                }
                else
                {
                    if (nextMustBeDeleted && length > 0)
                    {
                        updateTextView(args.Editable.SubSequence(0, length - 1));
                        UpdateHintTextForCurrentTextEntry();
                        return;
                    }
                }

                // If we are deleting (we've just removed a space char, so delete another char please:
                // Or if we've pressed space don't allow it!
                if ((deleting && skipCharsAtPositions.Contains(length)) ||
                    (length > 0 && IsCharInFilter(args.Editable.CharAt(length - 1)) &&
                     !skipCharsAtPositions.Contains(length - 1)))
                {
                    updateTextView(length == 0 ? "" : args.Editable.SubSequence(0, length - 1));
                    textTextView.SetSelection(length == 0 ? 0 : length - 1);
                    UpdateHintTextForCurrentTextEntry();
                    return;
                }

                // Adds a non numeric char at positions needed
                for (int i = 0; i < skipCharsAtPositions.Count; ++i)
                {
                    // We rescan all letters recursively to catch when a users pastes into the edittext
                    int charPosition = skipCharsAtPositions[i];
                    if (length > charPosition)
                    {
                        if (hintText[charPosition] != args.Editable.ToString()[charPosition])
                        {
                            updateTextView(args.Editable.SubSequence(0, charPosition) + "" + hintText[charPosition] +
                                           args.Editable.SubSequence(charPosition, args.Editable.Length()));
                            UpdateHintTextForCurrentTextEntry();
                            return;
                        }
                    }
                    else
                    {
                        if (length == charPosition)
                        {
                            updateTextView(textTextView.Text + "" + hintText[charPosition]);
                        }
                    }
                }

                UpdateHintTextForCurrentTextEntry();

                // We've got all the chars we need, fire off our listener
                if (length >= LengthToStartValidation())
                {
                    try
                    {
                        ValidateInput(args.Editable.ToString());
                        if (OnEntryComplete != null)
                        {
                            OnEntryComplete(args.Editable.ToString());
                        } 
                        return;
                    }
                    catch (Exception exception)
                    {
                        Log.Error(JudoSDKManager.DEBUG_TAG, exception.Message, exception);
                    }

                    ShowInvalid();
                }
                else
                {
                    if (OnProgress != null)
                    {
                        OnProgress(length);
                    }
                }
            };

            textTextView.BeforeTextChanged += beforeTextChanged;

            textTextView.TextChanged += textChanged;

            textTextView.AfterTextChanged += afterTextChanged;
        }
Example #17
0
 protected virtual View CreateDefaultControl(string value)
 {
     var innerDefaultControl = new Android.Widget.TextView(this.Context);
     innerDefaultControl.LayoutParameters = this.CreateLayoutParams();
     innerDefaultControl.SetSingleLine(true);
     innerDefaultControl.Text = value;
     return innerDefaultControl;
 }
                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 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 );

                    // 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;

                    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.MatchParent, 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( 15 );
                    ( (LinearLayout.LayoutParams)TitleLayout.LayoutParameters ).BottomMargin = (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.SetSingleLine( );
                    Title.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
                    Title.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
                    TitleLayout.AddView( Title );

                    Date = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Date.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    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 ) );
                    ( (LinearLayout.LayoutParams)Date.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
                    TitleLayout.AddView( Date );

                    Speaker = new TextView( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    Speaker.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    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 ) );
                    ( (LinearLayout.LayoutParams)Speaker.LayoutParameters ).TopMargin = (int)Rock.Mobile.Graphics.Util.UnitToPx( -4 );
                    Speaker.SetMaxLines( 1 );
                    TitleLayout.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 ).Weight = 1;
                    ( (LinearLayout.LayoutParams)ListenButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    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 ).Weight = 1;
                    ( (LinearLayout.LayoutParams)WatchButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    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 );

                    TakeNotesButton = new Button( Rock.Mobile.PlatformSpecific.Android.Core.Context );
                    TakeNotesButton.LayoutParameters = new LinearLayout.LayoutParams( ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent );
                    ( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Weight = 1;
                    ( (LinearLayout.LayoutParams)TakeNotesButton.LayoutParameters ).Gravity = GravityFlags.CenterVertical;
                    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 );
                        };
                }
        private void Init()
        {
            RemoveAllViews();
 
            Orientation = Orientation.Horizontal;

            LayoutParams lp = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            lp.Gravity = GravityFlags.CenterVertical;
            LayoutParameters = lp;

            cardImageLayout = new FrameLayout(Context);

            LayoutParams cardImageLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            cardImageLayoutParams.Gravity = GravityFlags.CenterVertical;
            cardImageLayout.LayoutParameters = cardImageLayoutParams;

            cardImageLayout.SetPadding(0, 0, UiUtils.ToPixels(Context, 8), 0);

            SetCardImageWithoutAnimation(Resource.Drawable.ic_card_cv2);

            cv2TextView = new CV2TextView(Context);

            LayoutParams parameters = new LayoutParams(LayoutParams.WrapContent, LayoutParams.WrapContent);
            parameters.Weight = 1;
            parameters.Gravity = GravityFlags.Center;

            cv2TextView.LayoutParameters = parameters;

            cv2TextView.OnEntryComplete += cardNumber =>
            {
                if (OnCreditCardEntered != null)
                {
                    OnCreditCardEntered(cardNumber);
                }
            };

            LayoutParams textViewLayoutParams = new LayoutParams(LayoutParams.WrapContent, LayoutParams.MatchParent);
            textViewLayoutParams.Gravity = GravityFlags.Center;

            last4CCNosTextView = new TextView(Context);
            last4CCNosTextView.Gravity = GravityFlags.Center;
            last4CCNosTextView.Text = "0000";
            last4CCNosTextView.LayoutParameters = textViewLayoutParams;
            last4CCNosTextView.SetTypeface(Typeface.Monospace, TypefaceStyle.Normal);
            last4CCNosTextView.TextSize = 18;
            last4CCNosTextView.SetTextColor(Resources.GetColor(Resource.Color.normal_text));
            last4CCNosTextView.Focusable = false;
            last4CCNosTextView.Enabled = false;
            last4CCNosTextView.SetSingleLine();
            last4CCNosTextView.SetBackgroundDrawable(null);

            AddView(cardImageLayout);
            AddView(last4CCNosTextView);
            AddView(cv2TextView);
        }