Пример #1
0
		public static void TextViewDialog(Context context, string path, string text = null)
		{
			var textView = new TextView(context);
			textView.SetPadding(10, 10, 10, 10);
			textView.SetTextSize(ComplexUnitType.Sp, 10f);
			var scrollView = new ScrollView(context);
			scrollView.AddView(textView);
			AlertDialog.Builder dialog = new AlertDialog.Builder(context);
			dialog.SetView(scrollView);

			if (text == null) {
				try {
					using (StreamReader sr = new StreamReader(path, Encoding.GetEncoding("euc-kr"))) {
						textView.Text = sr.ReadToEnd();
						sr.Close();
					}
				} catch { }
			} else {
				textView.Text = text;
			}

			dialog.SetPositiveButton("닫기", delegate
			{ });

			dialog.Show();
		}
Пример #2
0
		void Initialize ()
		{
			this.LayoutParameters = new RelativeLayout.LayoutParams(-1,-1);
			this.SetGravity(GravityFlags.CenterHorizontal);

			mainLinearLayout = new LinearLayout (context);
			mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
			mainLinearLayout.Orientation = Orientation.Vertical;

			imBack = new ImageView (context);
			txtDescription = new TextView (context);
			txtTitle = new TextView (context);

			txtTitle.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(38));
			txtDescription.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32));
			txtTitle.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
			txtDescription.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");


			int padW = Configuration.getWidth(30);
			int padH = Configuration.getHeight (0);
			this.SetPadding (padW,padH,padW,padH);
	
			mainLinearLayout.AddView (txtTitle);
			mainLinearLayout.AddView (imBack);
			mainLinearLayout.AddView (txtDescription);

			this.AddView (mainLinearLayout);
			//this.AddView (background);


		}
Пример #3
0
		void Initialize ()
		{
			this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			this.SetGravity(GravityFlags.Center);


			image = new RelativeLayout(context);
			txtDescription = new TextView (context);
			txtTitle = new TextView (context);
			background = new LinearLayout (context);

			image.SetGravity (GravityFlags.Center);
			background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (530), Configuration.getHeight (356));
			background.Orientation = Orientation.Vertical;
			background.SetBackgroundColor (Color.ParseColor ("#50000000"));

			image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));

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

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



			image.AddView (background);

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


		}
Пример #4
0
		void Initialize ()
		{
			this.LayoutParameters = new RelativeLayout.LayoutParams(-1,Configuration.getHeight (412));// LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			this.SetGravity(GravityFlags.Center);


			image = new RelativeLayout(context);

			txtTitle = new TextView (context);
			background = new LinearLayout (context);
			linearTitle = new LinearLayout (context);
			linearButton = new LinearLayout (context);
			imgPlay = new ImageButton (context);
			video = new VideoView (context);

			image.SetGravity (GravityFlags.Bottom);
			background.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (111));
			background.Orientation = Orientation.Horizontal;
			background.SetBackgroundColor (Color.ParseColor ("#50000000"));

			linearTitle.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (482), Configuration.getHeight (111));
			linearTitle.Orientation = Orientation.Horizontal;
			linearTitle.SetGravity (GravityFlags.Center);

			linearButton.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (100), Configuration.getHeight (111));
			linearButton.Orientation = Orientation.Horizontal;
			linearButton.SetGravity (GravityFlags.Center);


			image.LayoutParameters = new RelativeLayout.LayoutParams (Configuration.getWidth (582), Configuration.getHeight (394));
			//image.SetGravity (GravityFlags.Bottom);
			video.LayoutParameters = new ViewGroup.LayoutParams(Configuration.getWidth(582),Configuration.getHeight(394));


			imgPlay.Alpha = 255.0f;
			imgPlay.SetBackgroundColor (Color.Transparent);

			txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
			txtTitle.SetPadding (Configuration.getWidth (20), 0, 0, 0);
			txtTitle.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			txtTitle.Ellipsize = Android.Text.TextUtils.TruncateAt.End;
			txtTitle.SetMaxLines (2);

			//imgPlay.SetImageBitmap (Bitmap.CreateStxtcaledBitmap (getBitmapFromAsset ("icons/"), Configuration.getWidth (83), Configuration.getHeight (83), true));
			linearTitle.AddView (txtTitle);
			linearButton.AddView (imgPlay);

			background.AddView (linearTitle);
			background.AddView (linearButton);



			image.AddView (background);

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


		}
Пример #5
0
        public static void StyleUILabel( TextView label, string font, uint size )
        {
            label.SetTextColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.Label_TextColor ) );
            label.SetBackgroundColor( Android.Graphics.Color.Transparent );

            label.SetTypeface( Rock.Mobile.PlatformSpecific.Android.Graphics.FontManager.Instance.GetFont( font ), TypefaceStyle.Normal );
            label.SetTextSize( Android.Util.ComplexUnitType.Dip, size );
        }
        protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
        {
            base.OnElementChanged(e);
            nativeTextView = Control;
            if (nativeTextView == null)
            {
                return;
            }

			if (this.Element != null)
				formsEntry = this.Element as CustomEntry;

			if (formsEntry != null && !string.IsNullOrEmpty (formsEntry.BackGroundImageName)) {
				Android.Graphics.Drawables.Drawable drawable = Resources.GetDrawable (Resource.Drawable.comnt_box);
				nativeTextView.Background = drawable;
			} 
			else 
			{
				nativeTextView.SetBackgroundColor(Android.Graphics.Color.White);
				nativeTextView.SetHintTextColor(Android.Graphics.Color.Gray);
			}

            nativeTextView.SetTextColor(Android.Graphics.Color.Gray);
            if (nativeTextView != null)
            {
                if (nativeTextView.Text != null)
                {
                   // nativeTextView.SetTextColor(Android.Graphics.Color.Black);
                }
                
            }
            if (App.screenDensity > 1.5)
            {
                nativeTextView.SetTextSize(Android.Util.ComplexUnitType.Pt, 8);
            }
            else
            {
                nativeTextView.SetTextSize(Android.Util.ComplexUnitType.Pt, 9);
            }
        }
        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);
        }
			public Content (Context context, IAttributeSet attrs) : base (context, attrs)
			{
				mNavHider = () => SetNavVisibility (false);
				mText = new TextView (context);
				mText.SetTextSize (ComplexUnitType.Dip, 16);
				mText.Text = context.GetString (Resource.String.alert_dialog_two_buttons2ultra_msg);
				mText.Clickable = false;
				mText.SetOnClickListener (this);
				mText.SetTextIsSelectable (true);
				AddView (mText, new ViewGroup.LayoutParams (
					ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.WrapContent));

				SetOnSystemUiVisibilityChangeListener (this);
			}
        void UpdateToolbarTextFont(Android.Widget.TextView textView, Font customFont, Typeface originalFont)
        {
            if (customFont != null)
            {
                textView.Typeface = customFont.ToTypeface();

                float tValue = customFont.ToScaledPixel();
                textView.SetTextSize(ComplexUnitType.Sp, tValue);
            }
            else
            {
                textView.Typeface = originalFont;
            }
        }
		public double MeasureTextSize(string text, double width, double fontSize, string fontName = null)
		{
			var textView = new TextView(global::Android.App.Application.Context);
			textView.Typeface = GetTypeface(fontName);
			textView.SetText(text, TextView.BufferType.Normal);
			textView.SetTextSize(ComplexUnitType.Px, (float)fontSize);

			int widthMeasureSpec = AViews.View.MeasureSpec.MakeMeasureSpec(
				(int)width, AViews.MeasureSpecMode.AtMost);
			int heightMeasureSpec = AViews.View.MeasureSpec.MakeMeasureSpec(
				0, AViews.MeasureSpecMode.Unspecified);

			textView.Measure(widthMeasureSpec, heightMeasureSpec);

			return (double)textView.MeasuredHeight;
		}
Пример #11
0
		void Initialize ()
		{

			this.LayoutParameters = new RelativeLayout.LayoutParams (-1,-2);
			this.SetGravity (GravityFlags.Center);

			linearAll = new LinearLayout (context);
			linearTextContainer= new LinearLayout (context);
			linearBarra = new LinearLayout (context);

			txtAuthor = new TextView (context);
			txtPhrase = new TextView (context);
			imgBarra = new ImageView (context);
			imgComilla = new ImageView (context);

			linearAll.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (582), -2);
			linearTextContainer.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(552),-2);
			linearBarra.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(30),-2);

			linearAll.Orientation = Orientation.Horizontal;
			linearBarra.Orientation = Orientation.Vertical;
			linearTextContainer.Orientation = Orientation.Vertical;

			linearAll.SetGravity (GravityFlags.Center);
			//linearBarra.SetGravity (GravityFlags.CenterHorizontal);
			linearTextContainer.SetGravity (GravityFlags.CenterVertical);

			//txtPhrase.SetTextSize (ComplexUnitType.Px, Configuration.getHeight (40));
			//txtAuthor.SetTextSize(ComplexUnitType.Px, Configuration.getHeight (30));

			txtPhrase.SetTextSize (ComplexUnitType.Dip, 21.0f);
			txtAuthor.SetTextSize(ComplexUnitType.Dip, 16.0f);

			txtAuthor.SetTextColor (Color.ParseColor("#b0afb5"));

			linearBarra.AddView (imgComilla);
			//linearBarra.AddView (imgBarra);
			linearTextContainer.AddView (txtPhrase);
			linearTextContainer.AddView (txtAuthor);

			linearAll.AddView (linearBarra);
			linearAll.AddView (linearTextContainer);

			this.AddView (linearAll);

		}
Пример #12
0
        public PackageRow(Context context)
            : base(context)
        {
            SetBackgroundColor(Color.Rgb(240, 240, 240));

            Orientation = Orientation.Horizontal;

            textContainer = new LinearLayout(context);
            textContainer.Orientation = Orientation.Vertical;

            AddView(textContainer);

            buttonContainer = new LinearLayout(context);
            AddView(buttonContainer);

            int height = context.Resources.DisplayMetrics.HeightPixels / 10;
            LayoutParameters = new AbsListView.LayoutParams(LayoutParams.MatchParent, height);

            textContainer.LayoutParameters = new LinearLayout.LayoutParams(0, LayoutParams.MatchParent, 7);
            buttonContainer.LayoutParameters = new LinearLayout.LayoutParams(0, LayoutParams.MatchParent, 3);

            nameLabel = new TextView(context);
            nameLabel.SetTextColor(Color.Black);
            nameLabel.Gravity = Android.Views.GravityFlags.CenterVertical;
            nameLabel.Typeface = Typeface.Create("Helvetica Neue", TypefaceStyle.Normal);
            nameLabel.SetTextSize(Android.Util.ComplexUnitType.Dip, 16);
            textContainer.AddView(nameLabel);

            statusLabel = new TextView(context);
            statusLabel.SetTextColor(Color.DarkGray);
            statusLabel.Gravity = Android.Views.GravityFlags.Top;
            statusLabel.Typeface = Typeface.Create("Helvetica Neue", TypefaceStyle.Normal);

            textContainer.AddView(statusLabel);

            Button = new PMButton(context);
            buttonContainer.AddView(Button);

            buttonContainer.Measure(0, 0);

            padding = buttonContainer.MeasuredHeight / 3;

            Button.LayoutParameters = GetButtonParams(padding);
        }
Пример #13
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.CameraOverlayed);
            textView = FindViewById<TextView>(Resource.Id.textView);
            textView.Text = "test";
            textView.SetTextColor(Color.AliceBlue);
            textView.SetTextSize(ComplexUnitType.Px, 30);

            SurfaceView surface = FindViewById<SurfaceView>(Resource.Id.camerapreview);
            var holder = surface.Holder;
            holder.AddCallback(this);
            holder.SetType(Android.Views.SurfaceType.PushBuffers);

            counter = 5;
            timer = new System.Timers.Timer(1000);
            timer.Elapsed += Timer_Elapsed;
            timer.Start();
        }
Пример #14
0
		public void ini(){


			var textFormat = Android.Util.ComplexUnitType.Px;

			mainLayout = new RelativeLayout (context);
			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);


			contenLayout = new LinearLayout (context);
			contenLayout.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
			contenLayout.Orientation = Orientation.Vertical;


			//LIST

			contentListLayout = new LinearLayout (context);
			contentListLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(583),Configuration.getHeight(300));
			contentListLayout.Orientation = Orientation.Vertical;
			titleHeaderList = new TextView (context);
			contentList = new ListView (context);

			//titleHeaderList.Text = "Tipos de Aves";
			titleHeaderList.SetTextColor (Color.ParseColor ("#FF0080"));
			titleHeaderList.SetTextSize (textFormat, Configuration.getHeight (38));
			titleHeaderList.SetMaxWidth (Configuration.getWidth (510));

			contentListLayout.SetBackgroundResource (Resource.Drawable.border);
			contentListLayout.AddView (titleHeaderList);
			contentListLayout.AddView (contentList);


			contentListLayout.SetX (Configuration.getHeight (25));
			//contentListLayout.SetY (Configuration.getWidth (450));


			//ENDLIST

			imBorderList = new ImageView (context);
			mainLayout.AddView (contentListLayout);
		}
Пример #15
0
			public override View GetView (int position, View convertView, ViewGroup parent)
			{
				var layout = convertView as LinearLayout;
				if (layout == null) {
					var ntv = new TextView (activity) {
						Id = 42,
						LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent) {
							TopMargin = 12,
							BottomMargin = 12,
						},
					};
					ntv.SetTextColor (Color.White);
					ntv.SetTextSize (Android.Util.ComplexUnitType.Sp, 20);
					layout = new LinearLayout (activity);
					layout.AddView (ntv);
				}
				var item = fixtures[position];
				var tv = layout.FindViewById<TextView> (42);
				tv.Text = item.Name;
				return layout;
			}
Пример #16
0
		private void Initialize()
		{
			ImageView logo = new ImageView(Context) { Id = 0x0fffff2a };
			logo.SetImageResource(Resource.Drawable.logo);
			logo.SetAdjustViewBounds(true);
			logo.SetMinimumHeight(60);
			logo.SetMaxHeight(60);

			_imageCategoryView = new ImageView(Context);
			_imageCategoryView.SetAdjustViewBounds(true);
			_imageCategoryView.SetMinimumHeight(60);
			_imageCategoryView.SetMaxHeight(60);
			_imageCategoryView.Id = 0x0fffff2b;
			_imageCategoryView.SetMinimumWidth(60);
			_imageCategoryView.SetMaxWidth(60);
			_imageCategoryView.Measure(60, 60);

			_textCategoryView = new TextView(Context);
			_textCategoryView.SetMaxHeight(60);
			_textCategoryView.SetTextColor(Color.Black);
			_textCategoryView.Id = 0x0fffff2c;
			_textCategoryView.SetTextSize(ComplexUnitType.Sp, 15);
			_textCategoryView.Gravity = GravityFlags.CenterVertical;

			LayoutParams lp = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
			lp.AddRule(LayoutRules.AlignParentRight);
			lp.AddRule(LayoutRules.CenterVertical);
			AddView(logo, lp);

			lp = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
			lp.AddRule(LayoutRules.AlignParentLeft);
			lp.AddRule(LayoutRules.CenterVertical);
			AddView(_imageCategoryView, lp);

			lp = new LayoutParams(ViewGroup.LayoutParams.WrapContent, ViewGroup.LayoutParams.WrapContent);
			lp.AddRule(LayoutRules.RightOf, _imageCategoryView.Id);
			lp.AddRule(LayoutRules.CenterVertical);
			lp.SetMargins(60, 0, 60, 0);
			AddView(_textCategoryView, lp);
		}
Пример #17
0
        public View GetCustomTabView(ViewGroup p0, int p1)
        {
            var header = new LinearLayout(p0.Context);
            header.Orientation = Orientation.Vertical;
            var model = _pages[p1];
            var parameter = new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent)
            {
                Gravity = GravityFlags.Center
            };

            parameter.SetMargins(0,3,0,3);
            View viewUpper;
            TextView viewBottom = new TextView(p0.Context) {LayoutParameters = parameter};
            viewBottom.SetTextColor(new Color(ResourceExtension.BrushText));
            if (model is CalendarSummaryPivotPage)
            {
                var img = new ImageView(p0.Context) {LayoutParameters = new LinearLayout.LayoutParams(-2,-2) {Gravity = GravityFlags.Center} };
                img.ScaleX = .7f;
                img.ScaleY = .7f;
                img.SetImageDrawable(p0.Context.Resources.GetDrawable(Resource.Drawable.icon_list));
                viewUpper = img;
                viewBottom.Text = "Summary";
                (viewBottom.LayoutParameters as LinearLayout.LayoutParams).SetMargins(0,4,0,0);
            }
            else
            {
                var txt = new TextView(p0.Context) { LayoutParameters = parameter };
                txt.Text = model.Header;
                txt.SetTextColor(new Color(ResourceExtension.BrushText));
                txt.SetTextSize(ComplexUnitType.Sp, 18);
                viewBottom.Text = model.Sub;
                viewUpper = txt;
            }
            header.AddView(viewUpper);
            header.AddView(viewBottom);
            return header;
        }
Пример #18
0
		public void ini(){

			var textFormat = Android.Util.ComplexUnitType.Px;

			mainLayout = new RelativeLayout (context);
			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);

			contenLayout = new LinearLayout (context);
			contenLayout.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
			contenLayout.Orientation = Orientation.Vertical;

			titleHeader = new TextView (context);
			content = new TextView (context);

			titleHeader.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
			content.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");

			//titleHeader.Text = "El Perú cuenta con mas de 357000 tipos de aves";
			titleHeader.SetTypeface(null,TypefaceStyle.Bold);
			titleHeader.SetTextSize (textFormat, Configuration.getHeight (52));
			titleHeader.SetMaxWidth (Configuration.getWidth (583));

			//content.Text = "Los factores geográficos, climáticos y evolutivos  convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de pájaros(segun la lista oficial del SACC/CRAP), tambien es considerado el";
			content.SetTextSize (textFormat, Configuration.getHeight (26));
			content.SetMaxWidth (Configuration.getWidth(583));

			contenLayout.AddView (titleHeader);
			contenLayout.AddView(content);

			//contenLayout.SetX (Configuration.getHeight (45));
			int padW = Configuration.getWidth(45);
			int padH = Configuration.getHeight (15);
			//contenLayout.SetPadding (padW,padH,padW,padH);

			//contenLayout.SetY (Configuration.getWidth (12));
			mainLayout.SetPadding (padW,padH,padW,padH);
			mainLayout.AddView(contenLayout);
		}
Пример #19
0
        public void OnCreateView( View parentView )
        {
            Layout = parentView.FindViewById<RelativeLayout>( LayoutId );
            Icon = Layout.FindViewById<TextView>( Resource.Id.icon );
            Button = Layout.FindViewById<Button>( Resource.Id.button );
            Text = Layout.FindViewById<TextView>( Resource.Id.text );

            Typeface fontFace = FontManager.Instance.GetFont( PrivateControlStylingConfig.Icon_Font_Primary );
            Icon.SetTypeface( fontFace, TypefaceStyle.Normal );
            Icon.SetTextSize( Android.Util.ComplexUnitType.Dip, PrivateSpringboardConfig.Element_FontSize );
            Icon.SetX( Icon.GetX() - Icon.Width / 2 );
            Icon.Text = IconStr;

            Text.Text = ElementLabel;
            Text.SetTypeface( FontManager.Instance.GetFont( ControlStylingConfig.Font_Regular ), TypefaceStyle.Normal );
            Text.SetTextSize( Android.Util.ComplexUnitType.Dip, ControlStylingConfig.Medium_FontSize );

            Button.Background = null;

            // setup the seperator color
            View seperator = Layout.FindViewById<View>( Resource.Id.seperator );
            seperator.SetBackgroundColor( Rock.Mobile.UI.Util.GetUIColor( ControlStylingConfig.BG_Layer_Color ) );
        }
Пример #20
0
		public void init(){



			var textFormat = Android.Util.ComplexUnitType.Px;

			_dialog = new ProgressDialog(this);


			//popupBuilder.SetView(_dialog);


			_dialog.SetMessage("Espere por favor...");
			_dialog.SetCancelable(false);
			//_dialog.Show();

			mainLayout = new RelativeLayout (this);
			relSingup = new RelativeLayout (this);
			relLogin = new RelativeLayout (this);
			linearLicencia = new LinearLayout (this);
			linearLogin = new LinearLayout (this);
			linearSingup = new LinearLayout (this);
			linearLogo = new LinearLayout (this);

			imgLogo = new ImageView (this);
			btnLogin = new ImageButton (this);
			btnSingUp = new ImageButton (this);
			btnFacebook = new ImageButton (this);
			chkLogin = new CheckBox (this);
			txtLicencia_a = new TextView (this);
			txtLicencia_b = new TextView (this);

			txtlogin_a1 = new TextView (this);
			txtlogin_a2 = new TextView (this);
			txtlogin_b1 = new TextView (this);
			txtlogin_b2 = new TextView (this);
			txtlogin_c1 = new TextView (this);
			txtlogin_c2 = new TextView (this);

			initText (txtlogin_a1, "", "#00c6ff");
			txtlogin_a1.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			initText (txtlogin_a2, "", "#ffffff");
			txtlogin_a2.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			initText (txtlogin_b1, "", "#00c6ff");
			txtlogin_b1.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			initText (txtlogin_b2, "","#ffffff");
			txtlogin_b2.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			initText (txtlogin_c1, "", "#00c6ff");
			txtlogin_c1.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			initText (txtlogin_c2, "", "#ffffff");
			txtlogin_c2.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
		

			linearTxta = new LinearLayout (this);
			linearTxtb = new LinearLayout (this);
			linearTxtc = new LinearLayout (this);
			linearContentText = new LinearLayout (this);

			linearTxta.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			linearTxtb.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			linearTxtc.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			linearContentText.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);

			linearTxta.Orientation = Orientation.Horizontal;
			linearTxta.SetGravity (GravityFlags.Center);
			linearTxtb.Orientation = Orientation.Horizontal;
			linearTxtb.SetGravity (GravityFlags.Center);
			linearTxtc.Orientation = Orientation.Horizontal;
			linearTxtc.SetGravity (GravityFlags.Center);

			linearContentText.Orientation = Orientation.Vertical;
			linearContentText.SetGravity (GravityFlags.Center);


			linearTxta.AddView (txtlogin_a1); linearTxta.AddView (txtlogin_a2);
			linearTxtb.AddView (txtlogin_b1); linearTxtb.AddView (txtlogin_b2);
			linearTxtc.AddView (txtlogin_c1); linearTxtc.AddView (txtlogin_c2);

			linearContentText.AddView (linearTxta);
			linearContentText.AddView (linearTxtb);
			linearContentText.AddView (linearTxtc);


			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1, -1);
			Drawable d = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/afondo.png"), 768, 1024, true));
			mainLayout.SetBackgroundDrawable (d);

			relSingup.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);
			relLogin.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);


			linearLicencia.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearLicencia.Orientation = Orientation.Horizontal;
			linearLicencia.SetGravity (GravityFlags.Center);

			linearLogin.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearLogin.Orientation = Orientation.Horizontal;
			linearLogin.SetGravity (GravityFlags.Right);

			linearSingup.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearSingup.Orientation = Orientation.Vertical;
			linearSingup.SetGravity (GravityFlags.Center);


			linearLogo.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearLogo.Orientation = Orientation.Vertical;
			linearLogo.SetGravity (GravityFlags.Center);



			txtLicencia_a.Text = "TO REGISTER, ACCEPT THE";
			txtLicencia_a.SetTextSize(textFormat,Configuration.getHeight(25));
			txtLicencia_a.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
			txtLicencia_a.SetTextColor (Color.ParseColor ("#ffffff"));
			txtLicencia_b.Text = " TERMS OF USE";
			txtLicencia_b.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtLicencia_b.SetTextSize(textFormat,Configuration.getHeight(25));
			txtLicencia_b.SetTextColor (Color.ParseColor ("#00c6ff"));
			chkLogin.Checked = false;

			chkLogin.SetBackgroundColor(Color.ParseColor("#ffffff"));

			imgLogo.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/logo.png"), Configuration.getWidth(360), Configuration.getHeight(230),true));
			btnLogin.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/login.png"), Configuration.getWidth(210), Configuration.getHeight(60),true));
			btnFacebook.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signupface.png"), Configuration.getWidth(507), Configuration.getHeight(80),true));
			btnSingUp.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signupnolisto.png"), Configuration.getWidth(507), Configuration.getHeight(80),true));

			Drawable dc = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/toregister.png"), Configuration.getWidth(47), Configuration.getHeight(47), true));
			chkLogin.SetBackgroundDrawable (dc);

			initButtonColor (btnLogin);
			initButtonColor (btnFacebook);
			initButtonColor (btnSingUp);
			linearLicencia.AddView (chkLogin);
			linearLicencia.AddView (txtLicencia_a);
			linearLicencia.AddView (txtLicencia_b);

			linearLogin.AddView (btnLogin);
			linearSingup.AddView (linearLicencia);
			linearSingup.AddView (btnSingUp);
			linearSingup.AddView (btnFacebook);

			linearLogo.AddView (imgLogo);

			linearLogo.SetX (0); linearLogo.SetY (Configuration.getHeight(373));
			linearContentText.SetX (0); linearContentText.SetY (Configuration.getHeight(557));
			linearLogin.SetX (0); linearLogin.SetY (Configuration.getHeight(30));
			linearSingup.SetX (0); linearSingup.SetY (Configuration.getHeight(785));

			relSingup.AddView (linearLogo);
			relSingup.AddView (linearContentText);
			relSingup.AddView (linearLogin);
			relSingup.AddView (linearSingup);
			mainLayout.AddView (relSingup);


			btnSingUp.Click+= delegate {

				if(chkLogin.Checked==true){
					var com = ((LoginViewModel)this.DataContext).SignUpCommand;
					com.Execute(null);
				}
			};


			btnLogin.Click+= BtnLogin_Click;

			btnFacebook.Click += async delegate {


				await Authenticate(MobileServiceAuthenticationProvider.Facebook);

				/*var com = ((LoginViewModel)this.DataContext).FacebookLoginCommand;
				com.Execute(null);
				*/
			};


			chkLogin.CheckedChange += delegate {
				if(chkLogin.Checked==true){
					btnSingUp.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signuplisto.png"), Configuration.getWidth(507), Configuration.getHeight(80),true));
				}
				if(chkLogin.Checked==false){
					btnSingUp.SetImageBitmap(Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/signupnolisto.png"), Configuration.getWidth(507), Configuration.getHeight(80),true));
				}

			};
		}
		private TextView CreateDefaultTabView(Android.Content.Context context)
		{
			TextView textView = new TextView(context);
			textView.LayoutParameters = new LinearLayout.LayoutParams (0, ViewGroup.LayoutParams.WrapContent, 1f);
			textView.Gravity = GravityFlags.Center;
			textView.SetTextSize(ComplexUnitType.Sp, TAB_VIEW_TEXT_SIZE_SP);
			textView.Typeface = Android.Graphics.Typeface.DefaultBold;

			if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Honeycomb)
			{
				TypedValue outValue = new TypedValue();
				Context.Theme.ResolveAttribute(Android.Resource.Attribute.SelectableItemBackground, outValue, false);
				textView.SetBackgroundResource(outValue.ResourceId);
			}

			if (Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.IceCreamSandwich)
			{
				textView.SetAllCaps(true);
			}

			int padding = (int)(TAB_VIEW_PADDING_DIPS * Resources.DisplayMetrics.Density);
			textView.SetPadding(padding, padding, padding, padding);

			return textView;
		}
		void Initialize ()
		{

			var metrics = Resources.DisplayMetrics;
			widthInDp = ((int)metrics.WidthPixels);
			heightInDp = ((int)metrics.HeightPixels);
			Configuration.setWidthPixel (widthInDp);
			Configuration.setHeigthPixel (heightInDp);

			this.SetBackgroundColor (Color.ParseColor ("#000000"));


			linearContainerFisrst = new LinearLayout (context);
			//linearContainer = new LinearLayout (context);
			linearImageLO = new LinearLayout (context);
			linearTextLO = new LinearLayout (context);
			//linearLike = new LinearLayout (context);

			txtDescription = new TextView (context);
		
			txtTitle = new TextView (context);
			//txtLike = new TextView (context);
			//imgBack = new ImageButton(context);



			txtDescription= new TextView (context);

			this.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(637));


			linearContainerFisrst.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
			linearImageLO.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(637));
			linearTextLO.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(250));
		//	linearLike.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(120), Configuration.getHeight(80));



			linearTextLO.Orientation = Orientation.Vertical;
			linearTextLO.SetGravity(GravityFlags.Right);

		//	linearLike.Orientation = Orientation.Vertical;
		//	linearLike.SetGravity (GravityFlags.Center);
			//initButtonColor(imgBack);


			linearContainerFisrst.Orientation = Orientation.Vertical;



			//Drawable d = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/fondounidad.png"), 240, 320, true));
			//linearImageLO.SetBackgroundDrawable (d);

			//imgBack.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/atras.png"), Configuration.getWidth(43), Configuration.getWidth(43), true));



			txtTitle.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (50));

			txtDescription.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (30));
			txtTitle.Typeface = Typeface.DefaultBold;


			txtDescription.SetTextColor (Color.ParseColor("#ffffff"));

			txtTitle.SetTextColor (Color.ParseColor("#ffffff"));
			//txtLike.SetTextColor (Color.ParseColor("#ffffff"));
		
			txtDescription.Gravity = GravityFlags.Right;

			txtTitle.Gravity = GravityFlags.Right;
			//txtLike.Gravity = GravityFlags.Center;

			linearTextLO.AddView (txtTitle);
		
			linearTextLO.AddView (txtDescription);

			//linearLike.AddView (imgBack);
			//linearLike.AddView (txtLike);

			linearTextLO.SetX (0); linearTextLO.SetY (Configuration.getHeight(398));

			//imgBack.SetX (Configuration.getWidth (20)); imgBack.SetY (Configuration.getHeight (20));
			//linearLike.SetX (0); linearLike.SetY (Configuration.getHeight(438));
			linearContainerFisrst.SetX (0); linearContainerFisrst.SetY (0);

			linearImageLO.SetX (0); linearImageLO.SetY (0);


			this.AddView (linearImageLO);
			this.AddView (linearTextLO);
			//this.AddView (imgBack);
			this.AddView (linearContainerFisrst);

		}
        private void CreateUI()
        {
            if (MessageConversations.clearView) {
                RunOnUiThread (() => listWrapper.RemoveAllViewsInLayout ());
                MessageConversations.clearView = false;
            }
            int c = 0;
            List<int> unreadMessages = new List<int> ();
            int numberInConversation = 0;
            foreach (LOLMessageConversation conversation in MessageConversations.conversationsList) {
                unreadMessages.Add (conversation.MessageIDs.Count - conversation.ReadMessageIDs.Count);
                int t = 0;
            }
            if (unknownUsers == null)
                unknownUsers = new List<Guid> ();
            else
                unknownUsers.Clear ();

            List<Guid> unknownMessages = new List<Guid> ();
            foreach (MessageDB latestMessage in MessageConversations.initialMessages) {
                UserDB whoFrom = new UserDB ();
                whoFrom = dbm.GetUserWithAccountID (MessageConversations.conversationsList [c].Recipients [0].ToString ());
                if (latestMessage.MessageRecipientDBList.Count != 0) {
                    if (whoFrom == null && latestMessage.MessageRecipientDBList [0].AccountGuid == AndroidData.CurrentUser.AccountID.ToString ())
                        whoFrom = UserDB.ConvertFromUser (AndroidData.CurrentUser);
                    if (whoFrom != null) {
                        #if DEBUG
                        System.Diagnostics.Debug.WriteLine ("c = {0}, Recipient[0] Guid = {1}, whoFrom name = {2} {3}", c, MessageConversations.conversationsList [c].Recipients [0],
                                      whoFrom.FirstName, whoFrom.LastName);
                        #endif
                        List<UserDB> users = new List<UserDB> ();
                        numberInConversation = latestMessage.MessageRecipientDBList.Count;
                        for (int i = 0; i < (numberInConversation > 3 ? 3 : numberInConversation); ++i) {
                            if (latestMessage.MessageRecipientDBList [i] != null) {
                                UserDB current = dbm.GetUserWithAccountID (latestMessage.MessageRecipientDBList [i].AccountGuid.ToString ());
                                if (current == null && latestMessage.MessageRecipientDBList [i].AccountGuid != AndroidData.CurrentUser.AccountID.ToString ())
                                    unknownUsers.Add (new Guid (latestMessage.MessageRecipientDBList [i].AccountGuid));
                                else
                                    users.Add (current);
                            }
                        }

                        int leftOver = (int)wowZapp.LaffOutOut.Singleton.ScreenXWidth - (int)ImageHelper.convertDpToPixel (imageSize [0] + 30f, context);
                        LinearLayout shell = new LinearLayout (context);

                        shell.Orientation = Orientation.Horizontal;
                        shell.SetGravity (GravityFlags.CenterVertical);
                        shell.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (imageSize [1] + 40f, context));
                        shell.SetPadding (0, 0, 0, (int)ImageHelper.convertDpToPixel (5f, context));

                        ImageView imageLayout = new ImageView (context);
                        using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent)) {
                            layParams.SetMargins (3, 3, 3, 3);
                            imageLayout.LayoutParameters = layParams;
                        }
                        imageLayout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context),
                                            (int)ImageHelper.convertDpToPixel (10f, context));

                        imageLayout = generateUserImage (users);
                        RunOnUiThread (() => shell.AddView (imageLayout));

                        LinearLayout information = new LinearLayout (context);
                        information.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
                        information.Orientation = Orientation.Vertical;

                        LinearLayout topLayout = new LinearLayout (context);
                        topLayout.Orientation = Orientation.Vertical;
                        using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel(28f, context))) {
                            layParams.Weight = 10f;
                            layParams.SetMargins (0, 0, 0, (int)ImageHelper.convertDpToPixel (3f, context));
                            topLayout.LayoutParameters = layParams;
                        }

                        TextView whoAmI = new TextView (context);
                        using (LinearLayout.LayoutParams layParams= new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent)) {
                            layParams.SetMargins (10, 0, 10, 5);
                            whoAmI.LayoutParameters = layParams;
                        }
                        string myName = whoFrom.FirstName + " " + whoFrom.LastName;
                        if (numberInConversation != 1) {
                            myName += string.Format (" and {0} other{1}", numberInConversation == 2 ? "1" :
                                                     (numberInConversation - 1).ToString (), numberInConversation == 2 ? "." : "s.");
                        }
                        whoAmI.SetTextColor (Android.Graphics.Color.Black);
                        whoAmI.Text = myName;
                        whoAmI.SetTextSize (Android.Util.ComplexUnitType.Dip, 12f);
                        RunOnUiThread (() => topLayout.AddView (whoAmI));

                        LinearLayout messageLayout = new LinearLayout (context);
                        using (LinearLayout.LayoutParams linParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent)) {
                            linParams.Weight = 80f;
                            messageLayout.LayoutParameters = linParams;
                        }
                        messageLayout.Orientation = Orientation.Horizontal;

                        TextView txtMessage = new TextView (context);
                        using (LinearLayout.LayoutParams linParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel(70f, context))) {
                            linParams.SetMargins (0, 0, (int)ImageHelper.convertDpToPixel (8f, context), 0);
                            txtMessage.LayoutParameters = linParams;
                        }
                        txtMessage.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context),
                                      (int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (5f, context));

                        if (latestMessage.MessageStepDBList.Count == 1 && latestMessage.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) {
                            txtMessage = messageTextBox (latestMessage, 0, leftOver);

                        } else {

                            for (int n = 0; n < latestMessage.MessageStepDBList.Count; ++n) {
                                if (latestMessage.MessageStepDBList [n].StepType == MessageStep.StepTypes.Text) {
                                    txtMessage = messageTextBox (latestMessage, n, leftOver);
                                    break;
                                }
                            }
                        }

                        txtMessage.ContentDescription = latestMessage.MessageID.ToString ();
                        #if DEBUG
                        System.Diagnostics.Debug.WriteLine ("ContentDesctription = {0}, ID = {1}", txtMessage.ContentDescription, latestMessage.ID);
                        #endif
                        txtMessage.Click += textMessage_Click;
                        RunOnUiThread (() => messageLayout.AddView (txtMessage));

                        LinearLayout bottomLayout = new LinearLayout (context);
                        using (LinearLayout.LayoutParams linParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent)) {
                            linParams.SetMargins (0, (int)ImageHelper.convertDpToPixel (3f, context), 0, 0);
                            bottomLayout.LayoutParameters = linParams;
                        }
                        bottomLayout.SetGravity (GravityFlags.Right);

                        TextView txtMessageUnread = new TextView (context);
                        using (LinearLayout.LayoutParams layoutParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel(12f, context))) {
                            layoutParams.SetMargins (10, 0, 10, 0);
                            txtMessageUnread.LayoutParameters = layoutParams;
                        }
                        txtMessageUnread.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                        txtMessageUnread.SetTextColor (Color.Black);
                        txtMessageUnread.SetTextSize (Android.Util.ComplexUnitType.Dip, 10f);
                        if (unreadMessages [c] == 0)
                            txtMessageUnread.Text = "0 unread messages.";
                        else
                            txtMessageUnread.Text = string.Format ("({0}) unread message{1}", unreadMessages [c], unreadMessages [c] == 1 ? "." : "s.");
                        txtMessageUnread.Gravity = GravityFlags.Right;
                        RunOnUiThread (() => bottomLayout.AddView (txtMessageUnread));

                        LinearLayout messageItems = new LinearLayout (context);
                        if (latestMessage.MessageStepDBList.Count > 0) {

                            messageItems.Orientation = Orientation.Horizontal;
                            float messageBarSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((55f * imageSize [0]) / 100), context) : ImageHelper.convertDpToPixel (40f, context);
                            using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams (leftOver, (int)messageBarSize)) {
                                layParams.SetMargins ((int)ImageHelper.convertDpToPixel (14f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (12.7f, context), (int)ImageHelper.convertDpToPixel (4f, context));
                                messageItems.LayoutParameters = layParams;
                            }
                            messageItems.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (10f, context), 0);
                            messageItems.SetGravity (GravityFlags.Left);
                            messageItems.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                            messageItems = createMessageBar (messageItems, latestMessage, leftOver);
                            messageItems.ContentDescription = latestMessage.MessageGuid;
                            messageItems.Click += messageBar_Click;
                        } else {
                            messageItems.Orientation = Orientation.Horizontal;
                            float messageBarSize = wowZapp.LaffOutOut.Singleton.resizeFonts == true ? ImageHelper.convertPixelToDp (((55f * imageSize [0]) / 100), context) : ImageHelper.convertDpToPixel (40f, context);
                            using (LinearLayout.LayoutParams layParams = new LinearLayout.LayoutParams (leftOver, (int)messageBarSize)) {
                                layParams.SetMargins ((int)ImageHelper.convertDpToPixel (14f, context), (int)ImageHelper.convertDpToPixel (3.3f, context), (int)ImageHelper.convertDpToPixel (12.7f, context), (int)ImageHelper.convertDpToPixel (4f, context));
                                messageItems.LayoutParameters = layParams;
                                messageItems.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                            }
                        }
                        RunOnUiThread (delegate {
                            information.AddView (topLayout);
                            if (!string.IsNullOrEmpty (txtMessage.Text))
                                information.AddView (messageLayout);
                            if (latestMessage.MessageStepDBList.Count > 1)
                                information.AddView (messageItems);
                            information.AddView (bottomLayout);

                            shell.AddView (information);
                            listWrapper.AddView (shell);
                        });

                        #if DEBUG
                        System.Diagnostics.Debug.WriteLine ("done a loop");
                        #endif
                    }
                }
                if (c < MessageConversations.initialMessages.Count - 2)
                    c++;

            }
            //});

            if (unknownUsers.Count != 0) {
                Contacts.AddUnknownUser auu = new Contacts.AddUnknownUser (unknownUsers, context);
            }
            if (progress != null)
                RunOnUiThread (() => progress.Dismiss ());
        }
Пример #24
0
		void Initialize ()
		{

			var metrics = Resources.DisplayMetrics;
			widthInDp = ((int)metrics.WidthPixels);
			heightInDp = ((int)metrics.HeightPixels);
			Configuration.setWidthPixel (widthInDp);
			Configuration.setHeigthPixel (heightInDp);

			this.SetBackgroundColor (Color.ParseColor ("#000000"));


			linearContainerFisrst = new LinearLayout (context);
			//linearContainer = new LinearLayout (context);
			linearImageLO = new LinearLayout (context);
			linearTextLO = new LinearLayout (context);
			linearLike = new LinearLayout (context);

			txtAuthor = new TextView (context);
			txtChapter= new TextView (context);
			txtNameLO = new TextView (context);
			txtLike = new TextView (context);



			imgHeart= new ImageView (context);

			this.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(637));


			linearContainerFisrst.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);
			linearImageLO.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(637));
			linearTextLO.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(250));
			linearLike.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth(120), Configuration.getHeight(80));


			//Drawable drBack =new BitmapDrawable(Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/fondocondiagonalm.png"), 640, 1136, true));
			//linearContainerFisrst.SetBackgroundDrawable (drBack);
			//drBack = null;


			linearTextLO.Orientation = Orientation.Vertical;
			linearTextLO.SetGravity(GravityFlags.Right);

			linearLike.Orientation = Orientation.Vertical;
			linearLike.SetGravity (GravityFlags.Center);



			linearContainerFisrst.Orientation = Orientation.Vertical;



			//Drawable d = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/fondounidad.png"), 480, 640, true));
			//linearImageLO.SetBackgroundDrawable (d);

			//imgHeart.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("images/like.png"), Configuration.getWidth(43), Configuration.getHeight(43), true));



			txtNameLO.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (30));
			txtChapter.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (50));
			txtAuthor.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (30));
			txtNameLO.Typeface = Typeface.DefaultBold;


			txtAuthor.SetTextColor (Color.ParseColor("#ffffff"));
			txtChapter.SetTextColor (Color.ParseColor("#ffffff"));
			txtNameLO.SetTextColor (Color.ParseColor("#ffffff"));
			txtLike.SetTextColor (Color.ParseColor("#ffffff"));

			txtAuthor.Gravity = GravityFlags.Right;
			txtChapter.Gravity = GravityFlags.Right;
			txtNameLO.Gravity = GravityFlags.Right;
			txtLike.Gravity = GravityFlags.Center;

			linearTextLO.AddView (txtNameLO);
			linearTextLO.AddView (txtChapter);
			linearTextLO.AddView (txtAuthor);

			linearLike.AddView (imgHeart);
			linearLike.AddView (txtLike);

			linearTextLO.SetX (0); linearTextLO.SetY (Configuration.getHeight(398));

			linearLike.SetX (0); linearLike.SetY (Configuration.getHeight(438));
			linearContainerFisrst.SetX (0); linearContainerFisrst.SetY (0);

			linearImageLO.SetX (0); linearImageLO.SetY (0);

			linearTextLO.SetPadding (0, 0, Configuration.getWidth (35), 0);
			this.AddView (linearImageLO);
			this.AddView (linearTextLO);
			this.AddView (linearLike);
			this.AddView (linearContainerFisrst);

		}
        private LinearLayout createConfigPicker()
        {
            LinearLayout holder = new LinearLayout (context);
            holder.Orientation = Orientation.Horizontal;
            holder.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            holder.SetBackgroundResource (Resource.Drawable.footerback);

            LinearLayout level2 = new LinearLayout (context);
            level2.Orientation = Orientation.Vertical;
            level2.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (260f, context), LinearLayout.LayoutParams.FillParent);

            LinearLayout topSeekHolder = new LinearLayout (context);
            topSeekHolder.Orientation = Orientation.Horizontal;
            LinearLayout.LayoutParams viewParams;
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), (int)ImageHelper.convertDpToPixel (10f, context), 0, 0);
            topSeekHolder.LayoutParameters = viewParams;

            SeekBar topSeek = new SeekBar (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, (int)ImageHelper.convertDpToPixel (10f, context));
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (15f, context), 0, (int)ImageHelper.convertDpToPixel (15f, context), 0);
            topSeek.LayoutParameters = viewParams;
            topSeekHolder.AddView (topSeek);

            LinearLayout set1 = new LinearLayout (context);
            set1.Orientation = Orientation.Horizontal;
            set1.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
            TextView set1Text = new TextView (context);
            set1Text.SetTextColor (Color.Black);
            set1Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
            set1Text.Gravity = GravityFlags.CenterHorizontal;
            set1Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
            set1Text.Text = "1";
            HorizontalScrollView set1HSV = new HorizontalScrollView (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
            set1HSV.LayoutParameters = viewParams;
            set1.AddView (set1Text);
            set1.AddView (set1HSV);

            LinearLayout gap1 = new LinearLayout (context);
            gap1.Orientation = Orientation.Vertical;
            gap1.SetBackgroundColor (Color.Brown);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context));
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0);
            gap1.LayoutParameters = viewParams;
            set1.AddView (gap1);

            LinearLayout set2 = new LinearLayout (context);
            set2.Orientation = Orientation.Horizontal;
            set2.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
            TextView set2Text = new TextView (context);
            set2Text.SetTextColor (Color.Black);
            set2Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
            set2Text.Gravity = GravityFlags.CenterHorizontal;
            set2Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
            set2Text.Text = "2";
            HorizontalScrollView set2HSV = new HorizontalScrollView (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
            set2HSV.LayoutParameters = viewParams;
            set2.AddView (set2Text);
            set2.AddView (set2HSV);

            LinearLayout gap2 = new LinearLayout (context);
            gap2.Orientation = Orientation.Vertical;
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context));
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0);
            gap2.LayoutParameters = viewParams;
            gap2.SetBackgroundColor (Color.Brown);
            set2.AddView (gap2);

            LinearLayout set3 = new LinearLayout (context);
            set3.Orientation = Orientation.Horizontal;
            set3.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
            TextView set3Text = new TextView (context);
            set3Text.SetTextColor (Color.Black);
            set3Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
            set3Text.Gravity = GravityFlags.CenterHorizontal;
            set3Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
            set3Text.Text = "3";
            HorizontalScrollView set3HSV = new HorizontalScrollView (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
            set3HSV.LayoutParameters = viewParams;
            set3.AddView (set3Text);
            set3.AddView (set3HSV);

            LinearLayout gap3 = new LinearLayout (context);
            gap3.Orientation = Orientation.Vertical;
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (10f, context));
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (25f, context), 0, 0, 0);
            gap3.LayoutParameters = viewParams;
            gap3.SetBackgroundColor (Color.Brown);
            set3.AddView (gap3);

            LinearLayout set4 = new LinearLayout (context);
            set4.Orientation = Orientation.Horizontal;
            set4.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, (int)ImageHelper.convertDpToPixel (25f, context));
            TextView set4Text = new TextView (context);
            set4Text.SetTextColor (Color.Black);
            set4Text.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (20f, context), LinearLayout.LayoutParams.FillParent);
            set4Text.Gravity = GravityFlags.CenterHorizontal;
            set4Text.SetTextSize (Android.Util.ComplexUnitType.Dip, 20f);
            set4Text.Text = "4";
            HorizontalScrollView set4HSV = new HorizontalScrollView (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
            set4HSV.LayoutParameters = viewParams;
            set4.AddView (set4Text);
            set4.AddView (set4HSV);

            level2.AddView (topSeekHolder);
            level2.AddView (set1);
            level2.AddView (set2);
            level2.AddView (set3);
            level2.AddView (set4);

            LinearLayout level3 = new LinearLayout (context);
            level3.LayoutParameters = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (25f, context), LinearLayout.LayoutParams.FillParent);
            level3.SetBackgroundColor (Color.Brown);
            level3.Orientation = Orientation.Vertical;

            ImageView addThing = new ImageView (context);
            addThing.SetBackgroundResource (Resource.Drawable.add);
            viewParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (23f, context), (int)ImageHelper.convertDpToPixel (23f, context));
            viewParams.SetMargins (0, (int)ImageHelper.convertDpToPixel (15f, context), 0, 0);
            addThing.LayoutParameters = viewParams;
            ImageView wipeThing = new ImageView (context);
            wipeThing.SetBackgroundResource (Resource.Drawable.delete);
            viewParams = new LinearLayout.LayoutParams ((int)ImageHelper.convertDpToPixel (23f, context), (int)ImageHelper.convertDpToPixel (23f, context));
            viewParams.SetMargins (0, (int)ImageHelper.convertDpToPixel (10f, context), 0, 0);
            wipeThing.LayoutParameters = viewParams;

            level3.AddView (addThing);
            level3.AddView (wipeThing);

            LinearLayout level4 = new LinearLayout (context);
            level4.Orientation = Orientation.Vertical;
            level4.SetBackgroundColor (Color.Brown);
            level4.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.FillParent);

            SeekBar scroller = new SeekBar (context);
            viewParams = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.MatchParent);
            viewParams.SetMargins ((int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (15f, context), 0, (int)ImageHelper.convertDpToPixel (20.8f, context));
            scroller.LayoutParameters = viewParams;
            level4.AddView (scroller);

            holder.AddView (level2);
            holder.AddView (level3);
            holder.AddView (level4);

            return holder;
        }
        protected virtual View CreateDefaultView()
        {
            var mainLayoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent,
                ViewGroup.LayoutParams.MatchParent);
            var layout = new LinearLayout(this)
            {
                Orientation = Orientation.Vertical,
                LayoutParameters = mainLayoutParams
            };

            var layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent, 1)
            {
                Gravity = GravityFlags.Bottom | GravityFlags.CenterHorizontal
            };
            var textView = new TextView(this)
            {
                Gravity = layoutParams.Gravity,
                LayoutParameters = layoutParams,
                Text = GetApplicationName()
            };
            textView.SetTextSize(ComplexUnitType.Dip, 30);
            layout.AddView(textView);

            layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent)
            {
                Gravity = GravityFlags.Center
            };
            //NOTE using App context to set platform specific theme for progressbar
            var bar = new ProgressBar(Application)
            {
                LayoutParameters = layoutParams,
                Indeterminate = true
            };
            layout.AddView(bar);

            layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent, 1)
            {
                Gravity = GravityFlags.Bottom | GravityFlags.CenterHorizontal
            };
            textView = new TextView(this)
            {
                Gravity = layoutParams.Gravity,
                LayoutParameters = layoutParams,
                Text = GetVersion()
            };
            layout.AddView(textView);

            layoutParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.WrapContent,
                ViewGroup.LayoutParams.WrapContent)
            {
                Gravity = GravityFlags.Bottom | GravityFlags.CenterHorizontal
            };
            textView = new TextView(this)
            {
                Gravity = layoutParams.Gravity,
                LayoutParameters = layoutParams,
                Text = GetFooter()
            };
            layout.AddView(textView);
            return layout;
        }
Пример #27
0
		public void setItemLogin(){



			var txtFormat = Android.Util.ComplexUnitType.Px;

			linearButtonLogin = new LinearLayout (this);
			linearEditTextLogin = new LinearLayout (this);
			linearTextLogin = new LinearLayout (this);



			etxtUser = new EditText (this);
			etxtPassword = new EditText (this);
			btnLoginInto = new ImageButton (this);
			txtLogin_a = new TextView (this);
			txtLogin_b = new TextView (this);
			txtInicioSesion = new TextView (this);

			linearButtonLogin.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearEditTextLogin.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearTextLogin.LayoutParameters = new LinearLayout.LayoutParams (LinearLayout.LayoutParams.WrapContent, LinearLayout.LayoutParams.WrapContent);

			etxtUser.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));
			etxtPassword.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (507), Configuration.getHeight (78));


			linearButtonLogin.Orientation = Orientation.Horizontal;
			linearButtonLogin.SetGravity (GravityFlags.Center);
			linearEditTextLogin.Orientation = Orientation.Vertical;
			linearEditTextLogin.SetGravity (GravityFlags.Center);
			linearTextLogin.Orientation = Orientation.Vertical;
			linearTextLogin.SetGravity (GravityFlags.Center);



			etxtUser.Hint = "  Usuario"; 
			etxtUser.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			etxtPassword.Hint = "  Contraseña";
			etxtPassword.InputType = Android.Text.InputTypes.TextVariationPassword | Android.Text.InputTypes.ClassText;
			etxtPassword.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
			etxtPassword.InputType = InputTypes.TextVariationVisiblePassword;

			txtLogin_a.Text = "FORGOT PASSWORD?";
			txtLogin_a.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtLogin_b.Text = "            CHANGE";
			txtLogin_b.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtLogin_a.SetTextSize (txtFormat,Configuration.getHeight(30));
			txtLogin_b.SetTextSize (txtFormat, Configuration.getHeight (30));


			txtInicioSesion.Text = "Iniciar Sesión";
			txtInicioSesion.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
			txtInicioSesion.SetTextColor (Color.ParseColor("#ffffff"));
			txtInicioSesion.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (36));

			btnLoginInto.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/otherlogin.png"),Configuration.getWidth (242), Configuration.getHeight (78),true));
			etxtUser.SetTextColor (Color.ParseColor ("#ffffff"));
			etxtPassword.SetTextColor (Color.ParseColor ("#ffffff"));



			btnLoginInto.Click += delegate {
				_dialog.Show();
				var com = ((LoginViewModel)this.DataContext).LoginCommand;
				com.Execute(null);
				//AlertDialog.Builder popupBuilder = new AlertDialog.Builder(this);




			};

			initButtonColor (btnLoginInto);

			etxtPassword.InputType = InputTypes.TextVariationVisiblePassword;
			etxtPassword.TransformationMethod = Android.Text.Method.PasswordTransformationMethod.Instance;

			txtLogin_a.SetTextColor (Color.ParseColor ("#ffffff"));
			txtLogin_b.SetTextColor (Color.ParseColor ("#00c6ff"));


			Drawable drawableEditText = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/cajatexto.png"), Configuration.getWidth(507), Configuration.getHeight(80), true));
			etxtUser.SetBackgroundDrawable (drawableEditText);
			etxtPassword.SetBackgroundDrawable (drawableEditText);

			etxtUser.SetSingleLine (true);
			etxtPassword.SetSingleLine (true);

			LinearLayout space = new LinearLayout (this);
			space.LayoutParameters = new LinearLayout.LayoutParams (-1, 20);


			linearTextLogin.AddView (txtLogin_a);

			linearTextLogin.AddView (txtLogin_b);

			//linearButtonLogin.AddView (btnLoginInto);
			//linearButtonLogin.AddView (linearTextLogin);

			linearEditTextLogin.AddView (etxtUser);
			linearEditTextLogin.AddView (space);
			linearEditTextLogin.AddView (etxtPassword);


			txtInicioSesion.SetX (Configuration.getWidth(75)); txtInicioSesion.SetY (Configuration.getHeight(680));
			linearEditTextLogin.SetX (0); linearEditTextLogin.SetY (Configuration.getHeight(741));
			//linearButtonLogin.SetX (0); linearButtonLogin.SetY (Configuration.getHeight(978));


			btnLoginInto.SetX (Configuration.getWidth (45));btnLoginInto.SetY (Configuration.getHeight (980));
			linearTextLogin.SetX (Configuration.getWidth (345));linearTextLogin.SetY (Configuration.getHeight(995));

			relLogin.AddView (txtInicioSesion);
			relLogin.AddView (linearEditTextLogin);
			//relLogin.AddView (linearButtonLogin);
			relLogin.AddView(btnLoginInto);
			relLogin.AddView (linearTextLogin);

			((LoginViewModel)this.ViewModel).PropertyChanged += Login_propertyChanged;;



			var set = this.CreateBindingSet<LoginView, LoginViewModel>();
			set.Bind(etxtUser).To(vm => vm.Username);
			set.Bind(etxtPassword).To(vm => vm.Password);
			set.Apply(); 

			mainLayout.AddView (relLogin);
		}
        private void createUI(List<MessageDB> message, List<UserDB> contact, string nameTitle, bool clear = false)
        {
            message.Reverse ();
            contact.Reverse ();
            int m = 0;
            string messager = "";
            bool dd = false;
            if (message != null && contact != null) {

                if (clear == false)
                    RunOnUiThread (() => listWrapper.RemoveAllViewsInLayout ());
                string othername = string.Empty;
                for (int i = 0; i < contact.Count; ++i) {
                    if (string.IsNullOrEmpty (nameTitle))
                        othername = contact [i].FirstName + " " + contact [i].LastName;
                    else
                        othername = nameTitle;
                    if (isMe != othername) {
                        RunOnUiThread (delegate {
                            Header.headertext = othername;
                            Header.fontsize = 36f;
                            ImageHelper.fontSizeInfo (header.Context);
                            header.SetTextSize (Android.Util.ComplexUnitType.Dip, Header.fontsize);
                            header.Text = Header.headertext;
                        });
                        break;
                    }
                }

                if (contact.Count > 1) {
                    string toReturn = "";
                    List<UserDB> sortedList = new List<UserDB> ();
                    sortedList = contact.OrderBy (s => s.LastName).OrderBy (s => s.FirstName).ToList ();
                    foreach (UserDB eachItem in sortedList)
                        toReturn += string.Format ("{0} {1}, ", eachItem.FirstName, eachItem.LastName);
                    int last = toReturn.LastIndexOf (", ");
                    toReturn = toReturn.Remove (last);
                    RunOnUiThread (delegate {
                        using (LinearLayout btnlayout = new LinearLayout (context)) {
                            btnlayout.Orientation = Android.Widget.Orientation.Vertical;
                            btnlayout.SetGravity (GravityFlags.Center);
                            btnlayout.LayoutParameters = new ViewGroup.LayoutParams (LinearLayout.LayoutParams.FillParent, LinearLayout.LayoutParams.WrapContent);
                            btnlayout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context));

                            using (TextView name = new TextView(context)) {
                                name.Text = toReturn;
                                name.SetTextSize (Android.Util.ComplexUnitType.Dip, 18f);
                                name.SetTextColor (Color.Black);
                                btnlayout.AddView (name);
                            }

                            using (Button showAll = new Button (context)) {
                                showAll.Gravity = GravityFlags.CenterVertical;
                                showAll.Text = Application.Context.Resources.GetString (Resource.String.messageShowAllInConversation);
                                showAll.Click += (object sender, EventArgs e) => {
                                    showParticipants (sender, e, contact); };
                                showAll.SetWidth ((int)ImageHelper.convertDpToPixel (180f, context));
                                showAll.SetHeight ((int)ImageHelper.convertDpToPixel (30f, context));
                                showAll.SetBackgroundResource (Resource.Drawable.button);
                                btnlayout.AddView (showAll);
                            }
                            listWrapper.AddView (btnlayout);
                        }
                    });
                }

                if (getGuid != null)
                    getGuid.Clear ();

                RunOnUiThread (delegate {
                    foreach (MessageDB messages in message) {
                        string name = contact [m].FirstName + " " + contact [m].LastName;

                        ImageView random = null;
                        LinearLayout layout = new LinearLayout (context);
                        layout.Orientation = Android.Widget.Orientation.Horizontal;
                        layout.SetGravity (GravityFlags.CenterVertical);
                        layout.SetPadding ((int)ImageHelper.convertDpToPixel (5f, context), 0, (int)ImageHelper.convertDpToPixel (5f, context), (int)ImageHelper.convertDpToPixel (10f, context));
                        LinearLayout layout2 = new LinearLayout (context);
                        layout2.Orientation = Orientation.Vertical;
                        layout2.SetGravity (GravityFlags.Center);
                        if (name == isMe)
                            layout.AddView (contactUserInterface (messages, contact [m], true));
                        else
                            layout.AddView (contactUserInterface (messages, contact [m], false));

                        /*ImageView profilepic = new ImageView (context);
                        profilepic.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (55f, context), (int)ImageHelper.convertDpToPixel (100f, context));

                        if (contact == null)
                            profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                        else {
                            profilepic.Tag = new Java.Lang.String ("profilepic_" + contact [m].AccountID);
                            profilepic.SetImageResource (Resource.Drawable.defaultuserimage);
                            layout.AddView (profilepic);
                            if (contact [m].Picture.Length == 0 && contact [m].HasProfileImage)
                                getGuid.Add (contact [m].AccountID);
                            else {
                                if (contact [m].Picture.Length > 0)
                                    LoadUserImage (contact [m], profilepic);
                                else
                                    profilepic.SetImageDrawable (Application.Context.Resources.GetDrawable (Resource.Drawable.defaultuserimage));
                            }

                            TextView name = new TextView (context);
                            name.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (230f, context), (int)ImageHelper.convertDpToPixel (40f, context));
                            name.Gravity = GravityFlags.Center;
                            name.SetTextColor (Color.White);
                            name.TextSize = 16f;

                            layout2.AddView (name);

                            if (messages.MessageStepDBList.Count == 1 && messages.MessageStepDBList [0].StepType == MessageStep.StepTypes.Text) {
                                TextView text = new TextView (context);
                                text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context));
                                text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                                text.Gravity = GravityFlags.CenterVertical;
                                if (name == isMe)
                                    text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                                else
                                    text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                                text.TextSize = 16f;

                                for (int e = 0; e < messages.MessageStepDBList.Count; ++e) {
                                    if (!string.IsNullOrEmpty (messages.MessageStepDBList [e].MessageText)) {
                                        messager = messages.MessageStepDBList [e].MessageText;
                                        break;
                                    }
                                }

                                if (string.IsNullOrEmpty (messager))
                                    messager = "No text message found";

                                int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                                text.SetHeight (nolines);

                                text.SetTextColor (Android.Graphics.Color.Black);
                                text.Text = messager;
                                layout2.Clickable = true;
                                layout2.AddView (text);
                            } else {*/
                        LinearLayout layout3 = new LinearLayout (context);
                        layout3.Orientation = Orientation.Horizontal;
                        if (name == isMe)
                            layout3.SetGravity (GravityFlags.Right);
                        else
                            layout3.SetGravity (GravityFlags.Left);
                        layout3.SetBackgroundResource (Resource.Drawable.attachmentspreviewbkgr);
                        layout3.SetVerticalGravity (GravityFlags.CenterVertical);
                        layout3.SetMinimumHeight (30);
                        layout3.SetPadding ((int)ImageHelper.convertDpToPixel (10f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);

                        if (name != isMe) {
                            using (random = new ImageView (context)) {
                                random.Tag = m;
                                random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                random.SetBackgroundResource (Resource.Drawable.playblack);
                                random.ContentDescription = messages.MessageGuid;
                                random.Click += PlayButton_Clicked;

                                layout3.AddView (random);
                            }
                        }

                        int textt = 0;
                        for (int tt = 0; tt < messages.MessageStepDBList.Count; ++tt) {
                            if (messages.MessageStepDBList [tt].StepType == MessageStep.StepTypes.Text)
                                textt++;
                        }

                        for (int i = 0; i < messages.MessageStepDBList.Count; ++i) {
                            switch (messages.MessageStepDBList [i].StepType) {
                            case LOLMessageDelivery.MessageStep.StepTypes.Text:
                                if (textt == 1) {
                                    TextView text = new TextView (context);
                                    text.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (220f, context), (int)ImageHelper.convertDpToPixel (60f, context));
                                    text.SetPadding ((int)ImageHelper.convertDpToPixel (20f, context), 0, (int)ImageHelper.convertDpToPixel (10f, context), 0);
                                    text.Gravity = GravityFlags.CenterVertical;
                                    if (name == isMe)
                                        text.SetBackgroundResource (Resource.Drawable.bubblesolidright);
                                    else
                                        text.SetBackgroundResource (Resource.Drawable.bubblesolidleft);

                                    text.TextSize = 16f;

                                    for (int e = 0; e < messages.MessageStepDBList.Count; ++e) {
                                        if (!string.IsNullOrEmpty (messages.MessageStepDBList [e].MessageText)) {
                                            messager = messages.MessageStepDBList [e].MessageText;
                                            break;
                                        }
                                    }

                                    if (string.IsNullOrEmpty (messager))
                                        messager = "No text message found";

                                    int nolines = (int)(ImageHelper.convertDpToPixel ((messager.Length / 27f) * 12f, context));
                                    text.SetHeight (nolines);

                                    text.SetTextColor (Android.Graphics.Color.Black);
                                    text.Text = messager;
                                    layout2.Clickable = true;
                                    layout2.AddView (text);
                                } else {
                                    if (textt > 1) {
                                        using (random = new ImageView (context)) {
                                            random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                            random.SetBackgroundResource (Resource.Drawable.textmsg);
                                            layout3.AddView (random);
                                        }
                                    }
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Animation:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.drawicon);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Comicon:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.comicon);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Comix:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.comicmsgs);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Emoticon:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.emoticonmsg);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Polling:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.pollmsg);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.SoundFX:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.soundfxmsg);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Video:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.videomsg);
                                    layout3.AddView (random);
                                }
                                break;
                            case LOLMessageDelivery.MessageStep.StepTypes.Voice:
                                using (random = new ImageView (context)) {
                                    random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                    random.SetBackgroundResource (Resource.Drawable.voicemsg);
                                    layout3.AddView (random);
                                }
                                break;
                            }
                        }
                        if (name == isMe) {
                            using (random = new ImageView (context)) {
                                random.LayoutParameters = new ViewGroup.LayoutParams ((int)ImageHelper.convertDpToPixel (30f, context), (int)ImageHelper.convertDpToPixel (30f, context));
                                random.SetBackgroundResource (Resource.Drawable.playblack);
                                random.Click += (object ss, EventArgs ee) => {
                                    random_Click (ss, ee, message); };
                                layout3.AddView (random);
                            }
                        }

                        layout2.AddView (layout3);

                        layout.AddView (layout2);

                        listWrapper.AddView (layout);
                        if (m + 1 < contact.Count)
                            m++;
                    }
                    //}

                });
                if (getGuid.Count > 0) {
                    cpUI = 0;
                    LOLConnectClient service = new LOLConnectClient (LOLConstants.DefaultHttpBinding, LOLConstants.LOLConnectEndpoint);
                    service.UserGetImageDataCompleted += Service_UserGetImageDataCompleted;
                    service.UserGetImageDataAsync (AndroidData.CurrentUser.AccountID, getGuid [0], new Guid (AndroidData.ServiceAuthToken));
                }
            }
        }
Пример #29
0
		public void initText(TextView txt, String texto, String colores){

			var txtf = Android.Util.ComplexUnitType.Px;

			txt.Text = texto;
			txt.SetTextColor(Color.ParseColor(colores));
			txt.SetTextSize(txtf,Configuration.getHeight(30));	
		}
Пример #30
0
		private void iniMenu(){
			mainLayout = new RelativeLayout (this);
	



			_foro = new LOContainerView (this);

			_dialogDownload = new ProgressDialog (this);
			_dialogDownload.SetCancelable (false);
			_dialogDownload.SetMessage ("Downloading...");

			txtUserName = new TextView (this);
			txtCurse = new TextView (this);
			txtSchoolName = new TextView (this);
			txtUserRol = new TextView (this);
			txtPorcentaje = new TextView (this);
			txtCurseTitle = new TextView (this);
			txtTaskTitle = new TextView (this);
			txtPendiente = new TextView (this);
			txtValorBarra = new TextView (this);

			imgChat = new ImageView (this);
			imgUser = new ImageView (this);
			imgSchool = new ImageView (this);
			imgNotificacion = new ImageView (this);
			imgCurse = new ImageView (this);
			imgTask = new ImageView (this);

			linearBarraCurso = new LinearLayout (this);
			linearCurse= new LinearLayout (this);
			linearSchool= new LinearLayout (this);
			linearTask= new LinearLayout (this);
			linearUserData= new LinearLayout (this);
			linearUser = new LinearLayout (this);
			linearListCurso = new LinearLayout (this);
			linearListTask = new LinearLayout (this);
			linearList = new LinearLayout (this);
			linearPendiente = new LinearLayout (this);

			linearTxtValorBarra = new LinearLayout (this);

			listCursos = new ListView (this);
			listTasks = new ListView (this);	
			mItemsChat = new List<ChatDataRow> ();

			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);
			Drawable d = new BitmapDrawable (getBitmapFromAsset ("icons/fondo.png"));
			mainLayout.SetBackgroundDrawable (d);
			d = null;

			linearBarraCurso.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent);
			linearCurse.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(50));
			linearTask.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(50));
			linearSchool.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent);
			linearUserData.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent);
			linearUser.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearListCurso.LayoutParameters = new LinearLayout.LayoutParams (-1,Configuration.getHeight(250));
			linearListTask.LayoutParameters = new LinearLayout.LayoutParams (-1,LinearLayout.LayoutParams.WrapContent);
			linearList.LayoutParameters = new LinearLayout.LayoutParams (-1, LinearLayout.LayoutParams.WrapContent);
			linearPendiente.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (30), Configuration.getWidth (30));
			linearTxtValorBarra.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);

			linearBarraCurso.Orientation = Orientation.Vertical;
			linearBarraCurso.SetGravity (GravityFlags.Center);

			linearTxtValorBarra.Orientation = Orientation.Vertical;
			linearTxtValorBarra.SetGravity (GravityFlags.Center);
			txtValorBarra.Gravity = GravityFlags.Center;

			linearCurse.Orientation = Orientation.Horizontal;
			linearCurse.SetGravity (GravityFlags.CenterVertical);

			linearTask.Orientation = Orientation.Horizontal;
			linearTask.SetGravity (GravityFlags.CenterVertical);

			linearSchool.Orientation = Orientation.Horizontal;
			//linearSchool.SetGravity (GravityFlags.CenterVer);

			linearUserData.Orientation = Orientation.Vertical;
			linearUserData.SetGravity (GravityFlags.Center);

			linearUser.Orientation = Orientation.Vertical;
			linearUser.SetGravity (GravityFlags.CenterHorizontal);

			linearListCurso.Orientation = Orientation.Vertical;
			linearListTask.Orientation = Orientation.Vertical;

			linearList.Orientation = Orientation.Vertical;

			linearPendiente.Orientation = Orientation.Horizontal;
			linearPendiente.SetGravity (GravityFlags.Center);
			//linearList.SetGravity (GravityFlags.CenterVertical);

			progressBar = new ProgressBar (this,null,Android.Resource.Attribute.ProgressBarStyleHorizontal);
			progressBar.LayoutParameters = new ViewGroup.LayoutParams (Configuration.getWidth (274), Configuration.getHeight (32));
			progressBar.ProgressDrawable = Resources.GetDrawable (Resource.Drawable.progressBackground);
			progressBar.Progress = 60;
			txtValorBarra.Text = "60%";
			//progressBar.text
			txtValorBarra.SetY(13);

			txtCurse.Text = "Cursos del 2015";
			txtCurse.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");


		//	txtUserName.Text ="David Spencer";
			txtUserName.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtUserRol.Text ="Alumno";
			txtUserRol.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtSchoolName.Text ="Colegio Sagrados Corazones";
			txtSchoolName.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtPorcentaje.Text = "60%";
			txtPorcentaje.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtCurseTitle.Text = "CURSOS";
			txtCurseTitle.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtTaskTitle.Text = "TAREAS";	
			txtTaskTitle.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");

			txtPendiente.Text = "1";
			txtPendiente.Typeface =  Typeface.CreateFromAsset(this.Assets, "fonts/HelveticaNeue.ttf");
			txtPendiente.SetY (-10);


			txtPendiente.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (30));
			txtUserName.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (35));
			txtUserRol.SetTextSize (Android.Util.ComplexUnitType.Px, Configuration.getHeight (30));


			txtCurseTitle.SetPadding (Configuration.getWidth (48), 0, 0, 0);
			txtTaskTitle.SetPadding (Configuration.getWidth (48), 0, 0, 0);

			txtCurse.SetTextColor (Color.ParseColor ("#ffffff"));
			txtUserName.SetTextColor (Color.ParseColor ("#ffffff"));
			txtUserRol.SetTextColor (Color.ParseColor ("#999999"));
			txtSchoolName.SetTextColor (Color.ParseColor ("#ffffff"));
			txtPorcentaje.SetTextColor (Color.ParseColor ("#ffffff"));
			txtPendiente.SetTextColor (Color.ParseColor ("#ffffff"));
			txtTaskTitle.SetTextColor (Color.ParseColor ("#ffffff"));
			txtCurseTitle.SetTextColor (Color.ParseColor ("#ffffff"));
			txtValorBarra.SetTextColor (Color.ParseColor ("#ffffff"));

			txtUserName.Gravity = GravityFlags.CenterHorizontal;
			txtUserRol.Gravity = GravityFlags.CenterHorizontal;
			txtCurse.Gravity = GravityFlags.CenterHorizontal;


			imgChat.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/chat.png"),Configuration.getWidth (45), Configuration.getWidth (40),true));
			imgUser.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/user.png"),Configuration.getWidth (154), Configuration.getHeight (154),true));
			imgSchool.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/colegio.png"),Configuration.getWidth (29), Configuration.getHeight (29),true));
			imgNotificacion.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/notif.png"),Configuration.getWidth (35), Configuration.getWidth (40),true));
			imgCurse.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/curso.png"),Configuration.getWidth (23), Configuration.getHeight (28),true));
			imgTask.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/vertareas.png"),Configuration.getWidth (23), Configuration.getHeight (28),true));

			Drawable drPendiente = new BitmapDrawable (Bitmap.CreateScaledBitmap (getBitmapFromAsset ("icons/pendiente.png"), Configuration.getWidth(30), Configuration.getWidth(30), true));
			linearPendiente.SetBackgroundDrawable (drPendiente);
			drPendiente = null;

			imgCurse.SetPadding (Configuration.getWidth (68), 0, 0, 0);
			imgTask.SetPadding(Configuration.getWidth(68),0,0,0);


			linearCurse.SetBackgroundColor(Color.ParseColor("#0d1216"));
			linearTask.SetBackgroundColor (Color.ParseColor ("#0d1216"));

			linearBarraCurso.AddView (txtCurse);
			linearBarraCurso.AddView (progressBar);

			linearTxtValorBarra.AddView (txtValorBarra);

			linearCurse.AddView (imgCurse);
			linearCurse.AddView (txtCurseTitle);
			linearTask.AddView (imgTask);
			linearTask.AddView (txtTaskTitle);
			linearPendiente.AddView (txtPendiente);



			imgSchool.SetPadding (Configuration.getWidth(68),0,0,0);
			txtSchoolName.SetPadding (Configuration.getWidth(40),0,0,0);
			linearSchool.AddView (imgSchool);
			linearSchool.AddView (txtSchoolName);

			linearUser.AddView (txtUserName);
			linearUser.AddView (txtUserRol);

			linearUserData.AddView (imgUser);
			linearUserData.AddView (linearUser);

			linearListCurso.AddView (listCursos);
			linearListTask.AddView (listTasks);

			linearList.AddView (linearCurse);
			linearList.AddView (linearListCurso);
			linearList.AddView (linearTask);
			linearList.AddView (linearListTask);


			imgChat.SetX (Configuration.getWidth(59)); imgChat.SetY (Configuration.getHeight(145));
			imgChat.Click += delegate {
				mDrawerLayout.CloseDrawer (mLeftDrawer);
				mDrawerLayout.OpenDrawer (mRightDrawer);
			};
				
			imgNotificacion.SetX (Configuration.getWidth(59));  imgNotificacion.SetY (Configuration.getHeight(233)); 
			imgNotificacion.Click += delegate {
				mDrawerLayout.CloseDrawer (mLeftDrawer);
				main_ContentView.RemoveAllViews ();
				main_ContentView.AddView(new NotificationView(this));
			};


			linearPendiente.SetX (Configuration.getWidth(94));  linearPendiente.SetY (Configuration.getHeight(217)); 

			linearUserData.SetX (0); linearUserData.SetY (Configuration.getHeight(130));
			linearBarraCurso.SetX (0); linearBarraCurso.SetY (Configuration.getHeight(412));
			linearTxtValorBarra.SetX (0); linearTxtValorBarra.SetY (Configuration.getHeight(443));
			linearSchool.SetX (0); linearSchool.SetY (Configuration.getHeight(532));
			linearList.SetX (0); linearList.SetY (Configuration.getHeight(583));

			Bitmap bm;
			txtUserName.Text = vm.UserFirstName + " "+ vm.UserLastName;

			if (vm.UserImage != null) {
				bm = BitmapFactory.DecodeByteArray (vm.UserImage, 0, vm.UserImage.Length);

				Bitmap newbm = Configuration.GetRoundedCornerBitmap (Bitmap.CreateScaledBitmap (bm,Configuration.getWidth (154), Configuration.getHeight (154),true));
				imgUser.SetImageBitmap (newbm);
			
				newbm = null;
			}
			bm = null;



			mainLayout.AddView (imgChat);
			mainLayout.AddView (imgNotificacion);
			mainLayout.AddView (linearPendiente);
			mainLayout.AddView (linearUserData);
			mainLayout.AddView (linearBarraCurso);
			mainLayout.AddView (linearTxtValorBarra);
			mainLayout.AddView (linearSchool);
			mainLayout.AddView (linearList);

			imgChat = null;
			imgNotificacion = null;
			imgCurse = null;
			imgTask = null;
			imgSchool = null;
			imgUser = null;
		}
Пример #31
0
		public void ini(){


			var textFormat = Android.Util.ComplexUnitType.Px;

			var textFormatdip = Android.Util.ComplexUnitType.Dip;

			mainLayout = new RelativeLayout (context);
			mainLayout.LayoutParameters = new RelativeLayout.LayoutParams (-1,-1);

			mainLinearLayout = new LinearLayout (context);
			headerLinearLayout = new LinearLayout (context);
			contentLinearLayout = new LinearLayout (context);
			mainHeaderLinearLayout = new LinearLayout (context);


			imHeader = new ImageView (context);
			titleHeader = new TextView (context);
			AutorHeader = new TextView (context);
			content = new TextView (context);

			titleHeader.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
			AutorHeader.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
			content.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");


			mainLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			mainHeaderLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(125));
			contentLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
			headerLinearLayout.LayoutParameters = new LinearLayout.LayoutParams (-1, -1);

			mainLinearLayout.Orientation = Orientation.Vertical;
			mainHeaderLinearLayout.Orientation = Orientation.Horizontal;
			headerLinearLayout.Orientation = Orientation.Vertical;
			contentLinearLayout.Orientation = Orientation.Vertical;


			mainLinearLayout.AddView (mainHeaderLinearLayout);
			mainLinearLayout.AddView (contentLinearLayout);

			mainHeaderLinearLayout.AddView (imHeader);
			mainHeaderLinearLayout.AddView (headerLinearLayout);


			headerLinearLayout.AddView (titleHeader);
			headerLinearLayout.AddView (AutorHeader);
			headerLinearLayout.SetPadding (15, 0, 0, 10);
			AutorHeader.SetPadding (0, 15, 0, 0);

			contentLinearLayout.AddView (content);
			contentLinearLayout.SetPadding (0, 15, 0, 0);


			mainLinearLayout.SetBackgroundResource (Resource.Drawable.border);
			//			mainLinearLayout.SetX (Configuration.getHeight (45));
			//mainLinearLayout.SetY (Configuration.getWidth (500));



			//titleHeader.Text = "Diferentes tipos de aves en Perú";
			titleHeader.SetTextColor (Color.ParseColor ("#FF0080"));
			//titleHeader.SetTextSize (textFormat, Configuration.getHeight (38));
			titleHeader.SetTextSize (textFormatdip, 16.0f);

			titleHeader.SetMaxWidth (Configuration.getWidth (274));
			titleHeader.SetMaxHeight (Configuration.getHeight (80));
			//titleHeader.SetX (Configuration.getHeight (218));titleHeader.SetY (Configuration.getWidth (794-desviacion));
			titleHeader.Ellipsize = TextUtils.TruncateAt.End;
			titleHeader.SetMaxLines(2);


			//AutorHeader.Text = "Autor del Articulo";
			AutorHeader.SetTextColor(Color.ParseColor ("#424242"));
			AutorHeader.SetTextSize (textFormat, Configuration.getHeight (23));
			AutorHeader.SetMaxWidth (Configuration.getWidth (274));
			//AutorHeader.SetMaxHeight (Configuration.getHeight (25));
			//AutorHeader.SetX (Configuration.getHeight (218));AutorHeader.SetY (Configuration.getWidth (895-desviacion));
			AutorHeader.Ellipsize = TextUtils.TruncateAt.End;
			AutorHeader.SetMaxLines(1);

			//content.Text = "Los factores geográficos, climáticos y evolutivos  convierten al Perú en el mejor lugar para realizar la observacion de aves(birthwaching) Tiene 1830 especies de";
			//content.SetTextSize (textFormat, Configuration.getHeight (24));
			content.SetTextSize (textFormatdip, 12.0f);
			content.SetMaxWidth (Configuration.getWidth(501));
			//content.SetX (Configuration.getHeight (68));content.SetY (Configuration.getWidth (951-desviacion));
			//content.Ellipsize = TextUtils.TruncateAt.End;
			//content.SetMaxLines(4);

			//imHeader.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset("icons/user.png"),Configuration.getWidth (124), Configuration.getHeight (124),true));
			//imHeader.SetX (Configuration.getHeight (68));imHeader.SetY (Configuration.getWidth (792-desviacion));
			imHeader.SetMaxWidth (Configuration.getWidth (124));
			imHeader.SetMaxHeight (Configuration.getWidth (124));




			int padW = Configuration.getWidth(45);
			int padH = Configuration.getHeight (15);

			mainLayout.SetPadding (padW,padH,padW,padH);

			mainLayout.AddView (mainLinearLayout);

			/*
			mainLayout.AddView (titleHeader);
			mainLayout.AddView (AutorHeader);
			mainLayout.AddView (content);
			mainLayout.AddView (imHeader);
			*/
		}
Пример #32
0
        void ShowDateTimeDialog(string caption, DateTime current, bool date, bool time
                                , DialogButton <DateTime> positive, DialogButton <DateTime> negative)
        {
            using (var builder = new AlertDialog.Builder(_activity))
            {
                builder.SetTitle(caption);
                using (var ll = new LinearLayout(_activity))
                {
                    ll.Orientation = Orientation.Vertical;
                    if (date)
                    {
                        using (var dtv = new Android.Widget.TextView(_activity))
                            using (var dp = new DatePicker(_activity))
                            {
                                dtv.Text = D.DATE;
                                dtv.SetTextSize(Android.Util.ComplexUnitType.Sp, 30);
                                dtv.Gravity = GravityFlags.Center;
                                ll.AddView(dtv);

                                dp.Id = DatePicker;
                                var minDate = new DateTime(1900, 1, 1);
                                dp.DateTime = current > minDate ? current : minDate;
                                ll.AddView(dp);
                            }
                    }
                    if (time)
                    {
                        using (var ttv = new Android.Widget.TextView(_activity))
                            using (var tp = new TimePicker(_activity))
                            {
                                ttv.Text = D.TIME;
                                ttv.SetTextSize(Android.Util.ComplexUnitType.Sp, 30);
                                ttv.Gravity = GravityFlags.Center;
                                ll.AddView(ttv);

                                tp.Id = TimePicker;
                                tp.SetIs24HourView(new Java.Lang.Boolean(true));
                                tp.CurrentHour   = new Java.Lang.Integer(current.Hour);
                                tp.CurrentMinute = new Java.Lang.Integer(current.Minute);
                                ll.AddView(tp);
                            }
                    }
                    builder.SetView(ll);
                }

                builder.SetPositiveButton(positive.Caption, (sender, e) =>
                {
                    var alertDialog = (AlertDialog)sender;
                    DateTime result = DateTimeFromDialog(alertDialog);
                    positive.Execute(result);
                });

                builder.SetNegativeButton(negative.Caption, (sender, e) =>
                {
                    var alertDialog = (AlertDialog)sender;
                    DateTime result = DateTimeFromDialog(alertDialog);
                    negative.Execute(result);
                });

                builder.SetCancelable(false);
                AlertDialog dialog = builder.Show();
                dialog.DismissEvent += DisposeDialog;
                Dialogs.Push(dialog);
            }
        }