Example #1
0
        public void iniPlancesList()
        {
            //_currentPlaces.Clear ();
            _listLinearPlaces.Clear();
            placeSpace.RemoveAllViews();
            placesContainer.RemoveAllViews();

            VerticalScrollView listScrollPlaces = new VerticalScrollView(context);

            listScrollPlaces.LayoutParameters         = new VerticalScrollView.LayoutParams(-1, Configuration.getHeight(345));
            listScrollPlaces.VerticalScrollBarEnabled = false;

            LinearLayout listSpaceLayout = new LinearLayout(context);

            listSpaceLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
            listSpaceLayout.Orientation      = Orientation.Vertical;

            for (int i = 0; i < _currentPlaces.Count; i++)
            {
                var item = _currentPlaces [i];

                LinearLayoutLO linearItem = new LinearLayoutLO(context);
                linearItem.index = i;
                TextView  txtName = new TextView(context);
                ImageView imgIcon = new ImageView(context);

                txtName.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(420), -1);
                txtName.Gravity          = GravityFlags.CenterVertical;

                txtName.Text = item.titulo;
                //txtName.SetTextColor (Color.ParseColor ("#ffffff"));
                txtName.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
                txtName.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32));
                //imgIcon.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset (item.Asset), Configuration.getWidth (30), Configuration.getWidth (30), true));

                int H = 80;
                int W = 120;

                linearItem.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(H));
                //linearItem.SetBackgroundDrawable (background_row);
                linearItem.Orientation = Orientation.Horizontal;
                linearItem.SetGravity(Android.Views.GravityFlags.CenterVertical);
                //linearItem.AddView (imgIcon);


                RelativeLayout imageLayout = new RelativeLayout(context);
                imageLayout.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(W), Configuration.getHeight(H));
                ImageView iconImage = new ImageView(context);
                Picasso.With(context).Load(item.pathIcon).Resize(Configuration.getWidth(W), Configuration.getHeight(H)).CenterCrop().Into(iconImage);
                imageLayout.AddView(iconImage);

                LinearLayout gradiente = new LinearLayout(context);
                gradiente.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(W), Configuration.getHeight(H));

                imageLayout.AddView(gradiente);

                ImageIconMap icon = new ImageIconMap(context);
                icon.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(60), Configuration.getWidth(60));

                icon.index = 0;
                icon.SetImageBitmap(_leyendaIcon[item.tipoIndex]);
                //icon.SetPadding (Configuration.getWidth (20), ,0,0);
                icon.SetX(Configuration.getWidth(30));
                icon.SetY(Configuration.getHeight(10));

                RelativeLayout iconLayout = new RelativeLayout(context);
                iconLayout.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(W), Configuration.getHeight(H));
                iconLayout.SetGravity(GravityFlags.Center);

                LinearLayout gradiente2 = new LinearLayout(context);
                gradiente2.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(W), Configuration.getHeight(H));

                iconLayout.AddView(icon);
                iconLayout.AddView(gradiente2);

                linearItem.AddView(imageLayout);
                linearItem.AddView(txtName);
                linearItem.AddView(iconLayout);
                int space = Configuration.getWidth(30);
                //linearItem.SetPadding (space,0,space,0);
                //imgIcon.SetPadding (Configuration.getWidth(68), 0, 0, 0);
                txtName.SetPadding(Configuration.getWidth(10), 0, 0, 0);

                if (i % 2 == 0)
                {
                    gradiente.SetBackgroundResource(Resource.Drawable.gradiente2);
                    gradiente2.SetBackgroundResource(Resource.Drawable.gradiente22);
                    linearItem.SetBackgroundColor(Color.ParseColor("#F0AE11"));
                    txtName.SetTextColor(Color.White);
                }
                else
                {
                    gradiente.SetBackgroundResource(Resource.Drawable.gradiente1);
                    gradiente2.SetBackgroundResource(Resource.Drawable.gradiente11);
                    txtName.SetTextColor(Color.ParseColor("#F0AE11"));
                }

                _listLinearPlaces.Add(linearItem);
                _listLinearPositonPlaces.Add(icon);
                listSpaceLayout.AddView(linearItem);
            }

            /*
             * listPlaces = new ListView (context);
             * listPlaces.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(345));
             *
             * listPlaces.Adapter = new PlaceAdapter (context, _currentPlaces);
             * listPlaces.DividerHeight = 0;
             *
             * placesContainer.AddView (listPlaces);
             */
            placesContainer.AddView(listSpaceLayout);
            placeSpace.AddView(placesContainer);

            titulo_header.Text = titulo_map_header;
            header.AddView(titulo_header);
            header.AddView(_leyendaMap);
        }
Example #2
0
        public void initUnidades(int indexCurso, int indexUnidad)
        {
            var textFormat = Android.Util.ComplexUnitType.Px;

            _spaceUnidades.RemoveAllViews();
            _listLinearUnidades.Clear();
            _listIconMap.Clear();
            _listIconVerMap.Clear();
            int numUnidades = _listUnidades.Count;

            for (int i = 0; i < numUnidades; i++)
            {
                LinearLayoutLO linearUnidad = new LinearLayoutLO(context);
                linearUnidad.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                linearUnidad.Orientation      = Orientation.Vertical;
                linearUnidad.SetGravity(Android.Views.GravityFlags.CenterVertical);
                linearUnidad.index = i;
                linearUnidad.SetPadding(Configuration.getWidth(100), Configuration.getWidth(25), 0, Configuration.getWidth(25));
                //linearUnidad.SetX (100);

                if (indexCurso == 0)                  //Para que solo afecte a las Rutas
                {
                    linearUnidad.SetPadding(Configuration.getWidth(100), Configuration.getWidth(25), 0, Configuration.getWidth(-25));
                }

                TextView titleUnidad = new TextView(context);
                titleUnidad.SetTextSize(textFormat, Configuration.getHeight(42));
                titleUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2);


                if (indexCurso == 2)
                {
                    if (indexUnidad == 3)
                    {
                        linearUnidad.Orientation = Orientation.Horizontal;
                        ImageIconMap icon = new ImageIconMap(context);
                        icon.index = i;
                        icon.SetImageBitmap(iconPlay);
                        icon.SetX(Configuration.getWidth(60));
                        linearUnidad.AddView(icon);
                        _listIconMap.Add(icon);
                    }
                }

                if (indexCurso == 3)
                {
                    titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55));
                }

                RelativeLayout linearContenido = new RelativeLayout(context);
                linearContenido.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                linearContenido.SetGravity(Android.Views.GravityFlags.Center);



                //TextView titleUnidad = new TextView(context);
                //titleUnidad.Text = _listUnidades [i].Title;
                titleUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Title);
                titleUnidad.SetTextColor(Color.ParseColor(Configuration.ListaColores [i % 6]));
                titleUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");


                TextView descriptionUnidad = new TextView(context);
                descriptionUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2);
                //descriptionUnidad.Text = _listUnidades [i].Description;

                descriptionUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Description);
                //descriptionUnidad.Text = _listUnidades [i].Description;
                descriptionUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
                descriptionUnidad.SetTextSize(textFormat, Configuration.getHeight(28));
                //Linkify.AddLinks (descriptionUnidad, MatchOptions.All);
                //Huillca
                if (indexCurso == 1 && indexUnidad != 6)                  //Para que no afecte a las Rutas ni a los precios
                //Linkify.AddLinks(descriptionUnidad,Patterns.Phone,"tel:");
                //(084) 21-1122  --------modelo de telefono
                //984-820715 ----modelo celular
                {
                    Linkify.AddLinks(descriptionUnidad, Java.Util.Regex.Pattern.Compile("\\W\\d+\\W\\s\\d+\\W\\d+"), "tel:");
                    Linkify.AddLinks(descriptionUnidad, Java.Util.Regex.Pattern.Compile("\\d+\\W\\d+"), "tel:");
                    Linkify.AddLinks(descriptionUnidad, Patterns.EmailAddress, "email:");
                    Linkify.AddLinks(descriptionUnidad, Patterns.WebUrl, "http://");
                }


                //descriptionUnidad.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance;
                //descriptionUnidad.LinksClickable = true;

                //descriptionUnidad.SetTextIsSelectable (true);

                LinearLayout linearContenidoIn = new LinearLayout(context);
                linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                linearContenidoIn.Orientation      = Orientation.Vertical;
                //linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);



                linearContenidoIn.AddView(titleUnidad);
                linearContenidoIn.AddView(descriptionUnidad);

                linearContenido.AddView(linearContenidoIn);

                if (indexCurso == 2)
                {
                    linearContenidoIn.RemoveView(descriptionUnidad);
                    ImageView imgUnidad = new ImageView(context);
                    Picasso.With(context).Load(_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(440), Configuration.getHeight(440)).Placeholder(context.Resources.GetDrawable(Resource.Drawable.progress_animation)).CenterInside().Into(imgUnidad);
                    linearContenidoIn.AddView(imgUnidad);
                    linearContenidoIn.SetGravity(Android.Views.GravityFlags.Center);
                    linearUnidad.SetPadding(0, Configuration.getWidth(25), 0, Configuration.getWidth(25));
                }

                linearUnidad.AddView(linearContenido);

                if (indexCurso == 0)
                {
                    if (indexUnidad != 3)
                    {
                        ImageView info = new ImageView(context);
                        info.Tag = i;
                        info.SetImageBitmap(iconInfo);
                        info.SetX(Configuration.getWidth(450));
                        info.SetY(Configuration.getHeight(10));


                        linearContenido.AddView(info);


                        if (indexUnidad == 2 && i > 1)
                        {
                        }
                        else
                        {
                            LinearLayout test = new LinearLayout(context);
                            //test.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
                            test.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(100));
                            test.SetGravity(Android.Views.GravityFlags.Center);
                            test.Tag = i;
                            test.SetX(Configuration.getWidth(0));
                            test.SetY(Configuration.getWidth(-40));
                            //test.SetPadding (Configuration.getWidth(30), Configuration.getWidth (25), Configuration.getWidth(30), Configuration.getWidth (25));

                            test.SetGravity(GravityFlags.Left | GravityFlags.Center);

                            TextView verMapa = new TextView(context);
                            verMapa.Text     = Resources.GetText(Resource.String.See_maps_and_photos);
                            verMapa.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
                            verMapa.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(35));
                            verMapa.SetTextColor(Color.ParseColor(Configuration.ListaColores [i % 6]));

                            test.AddView(verMapa);
                            linearUnidad.AddView(test);
                            _listIconVerMap.Add(test);
                        }
                    }
                    else
                    {
                        titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55));
                    }
                }

                if (indexCurso == 1 && indexUnidad == 7)
                {
                    linearContenidoIn.RemoveView(titleUnidad);
                    linearContenidoIn.RemoveView(descriptionUnidad);
                    //linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
                    linearContenidoIn.SetX(Configuration.getWidth(0));
                    ImageView imgUnidad = new ImageView(context);
                    Picasso.With(context).Load(_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(640), Configuration.getHeight(2362)).Placeholder(context.Resources.GetDrawable(Resource.Drawable.progress_animation)).CenterInside().Into(imgUnidad);
                    linearContenidoIn.AddView(imgUnidad);
                    linearUnidad.SetPadding(0, 0, 0, 0);
                    linearUnidad.SetX(Configuration.getWidth(0));
                }



                _listLinearUnidades.Add(linearUnidad);
                LinearLayout separationLinear = new LinearLayout(context);
                separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5);
                separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8"));
                separationLinear.Orientation = Orientation.Horizontal;


                //linearUnidad.AddView (separationLinear);
                _spaceUnidades.AddView(linearUnidad);
                _spaceUnidades.AddView(separationLinear);
            }
        }
Example #3
0
		public void iniPlancesList()
		{
			//_currentPlaces.Clear ();
			_listLinearPlaces.Clear();
			placeSpace.RemoveAllViews ();
			placesContainer.RemoveAllViews ();

			VerticalScrollView listScrollPlaces = new VerticalScrollView (context);
			listScrollPlaces.LayoutParameters = new VerticalScrollView.LayoutParams (-1, Configuration.getHeight (345));
			listScrollPlaces.VerticalScrollBarEnabled = false;

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

			for (int i = 0; i < _currentPlaces.Count; i++) {

				var item = _currentPlaces [i];

				LinearLayoutLO linearItem = new LinearLayoutLO (context);
				linearItem.index = i;
				TextView txtName = new TextView (context);
				ImageView imgIcon = new ImageView (context);

				txtName.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (420), -1);
				txtName.Gravity = GravityFlags.CenterVertical;

				txtName.Text = item.titulo;
				//txtName.SetTextColor (Color.ParseColor ("#ffffff"));
				txtName.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/HelveticaNeue.ttf");
				txtName.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight(32));
				//imgIcon.SetImageBitmap (Bitmap.CreateScaledBitmap (getBitmapFromAsset (item.Asset), Configuration.getWidth (30), Configuration.getWidth (30), true));

				int H = 80;
				int W = 120;

				linearItem.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight (H));
				//linearItem.SetBackgroundDrawable (background_row);
				linearItem.Orientation = Orientation.Horizontal;
				linearItem.SetGravity (Android.Views.GravityFlags.CenterVertical);
				//linearItem.AddView (imgIcon);


				RelativeLayout imageLayout = new RelativeLayout (context);
				imageLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H));
				ImageView iconImage = new ImageView (context);
				Picasso.With (context).Load (item.pathIcon).Resize(Configuration.getWidth(W),Configuration.getHeight(H)).CenterCrop().Into (iconImage);
				imageLayout.AddView (iconImage);

				LinearLayout gradiente = new LinearLayout (context);
				gradiente.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H));

				imageLayout.AddView (gradiente);

				ImageIconMap icon = new ImageIconMap (context);
				icon.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (60), Configuration.getWidth (60));

				icon.index = 0;
				icon.SetImageBitmap(_leyendaIcon[item.tipoIndex]);
				//icon.SetPadding (Configuration.getWidth (20), ,0,0);
				icon.SetX(Configuration.getWidth (30));
				icon.SetY(Configuration.getHeight (10));

				RelativeLayout iconLayout = new RelativeLayout (context);
				iconLayout.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H));
				iconLayout.SetGravity (GravityFlags.Center);

				LinearLayout gradiente2 = new LinearLayout (context);
				gradiente2.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (W), Configuration.getHeight (H));

				iconLayout.AddView (icon);
				iconLayout.AddView (gradiente2);

				linearItem.AddView (imageLayout);
				linearItem.AddView (txtName);
				linearItem.AddView (iconLayout);
				int space = Configuration.getWidth (30);
				//linearItem.SetPadding (space,0,space,0);
				//imgIcon.SetPadding (Configuration.getWidth(68), 0, 0, 0);
				txtName.SetPadding (Configuration.getWidth(10), 0, 0, 0);

				if (i % 2 == 0) {
				gradiente.SetBackgroundResource (Resource.Drawable.gradiente2);
				gradiente2.SetBackgroundResource (Resource.Drawable.gradiente22);
				linearItem.SetBackgroundColor (Color.ParseColor ("#F0AE11"));
				txtName.SetTextColor (Color.White);
				} else {
				gradiente.SetBackgroundResource (Resource.Drawable.gradiente1);
				gradiente2.SetBackgroundResource (Resource.Drawable.gradiente11);
				txtName.SetTextColor (Color.ParseColor("#F0AE11"));
				}

				_listLinearPlaces.Add (linearItem);
				_listLinearPositonPlaces.Add (icon);
				listSpaceLayout.AddView (linearItem);

			}

			/*
			listPlaces = new ListView (context);
			listPlaces.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(345));

			listPlaces.Adapter = new PlaceAdapter (context, _currentPlaces);
			listPlaces.DividerHeight = 0;

			placesContainer.AddView (listPlaces);
*/
			placesContainer.AddView (listSpaceLayout);
			placeSpace.AddView(placesContainer);

			titulo_header.Text = titulo_map_header;
			header.AddView (titulo_header);
			header.AddView (_leyendaMap);


		}
Example #4
0
		public void initUnidades(int indexCurso, int indexUnidad)
		{
			var textFormat = Android.Util.ComplexUnitType.Px;
			_spaceUnidades.RemoveAllViews ();
			_listLinearUnidades.Clear ();
			_listIconMap.Clear ();
			_listIconVerMap.Clear ();
			int numUnidades = _listUnidades.Count;
			for (int i = 0; i < numUnidades; i++) 
			{
				LinearLayoutLO linearUnidad = new LinearLayoutLO (context);
				linearUnidad.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearUnidad.Orientation = Orientation.Vertical;
				linearUnidad.SetGravity (Android.Views.GravityFlags.CenterVertical);
				linearUnidad.index = i;
				linearUnidad.SetPadding (Configuration.getWidth(100), Configuration.getWidth (25),0, Configuration.getWidth (25));
				//linearUnidad.SetX (100);

				if (indexCurso == 0) {//Para que solo afecte a las Rutas
					linearUnidad.SetPadding (Configuration.getWidth(100), Configuration.getWidth (25),0, Configuration.getWidth (-25));
				}

				TextView titleUnidad = new TextView(context);
				titleUnidad.SetTextSize (textFormat,Configuration.getHeight(42));
				titleUnidad.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (440), -2);


				if (indexCurso == 2) {
					if (indexUnidad == 3) {
						linearUnidad.Orientation = Orientation.Horizontal;
						ImageIconMap icon = new ImageIconMap (context);
						icon.index = i;
						icon.SetImageBitmap(iconPlay);
						icon.SetX (Configuration.getWidth (60));
						linearUnidad.AddView (icon);
						_listIconMap.Add (icon);
					}
				}

				if (indexCurso == 3) {
					titleUnidad.SetTextSize (textFormat,Configuration.getHeight(55));
				}

				RelativeLayout linearContenido = new RelativeLayout (context);
				linearContenido.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearContenido.SetGravity (Android.Views.GravityFlags.Center);



				//TextView titleUnidad = new TextView(context);
				//titleUnidad.Text = _listUnidades [i].Title;
				titleUnidad.TextFormatted = Html.FromHtml (_listUnidades [i].Title);
				titleUnidad.SetTextColor(Color.ParseColor (Configuration.ListaColores [i % 6]));
				titleUnidad.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");


				TextView descriptionUnidad = new TextView(context);
				descriptionUnidad.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (440), -2);
				//descriptionUnidad.Text = _listUnidades [i].Description;

				descriptionUnidad.TextFormatted = Html.FromHtml (_listUnidades [i].Description);
				//descriptionUnidad.Text = _listUnidades [i].Description;
				descriptionUnidad.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
				descriptionUnidad.SetTextSize (textFormat,Configuration.getHeight(28));
				//Linkify.AddLinks (descriptionUnidad, MatchOptions.All);
				//Huillca
				if (indexCurso == 1   && indexUnidad!=6) {//Para que no afecte a las Rutas ni a los precios
					//Linkify.AddLinks(descriptionUnidad,Patterns.Phone,"tel:");
					//(084) 21-1122  --------modelo de telefono
					//984-820715 ----modelo celular
					Linkify.AddLinks(descriptionUnidad,Java.Util.Regex.Pattern.Compile("\\W\\d+\\W\\s\\d+\\W\\d+"),"tel:");
					Linkify.AddLinks(descriptionUnidad,Java.Util.Regex.Pattern.Compile("\\d+\\W\\d+"),"tel:");
					Linkify.AddLinks(descriptionUnidad,Patterns.EmailAddress,"email:");
					Linkify.AddLinks(descriptionUnidad,Patterns.WebUrl,"http://");
				}


				//descriptionUnidad.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance;
				//descriptionUnidad.LinksClickable = true;

				//descriptionUnidad.SetTextIsSelectable (true);

				LinearLayout linearContenidoIn = new LinearLayout (context);
				linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearContenidoIn.Orientation = Orientation.Vertical;
				//linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);



				linearContenidoIn.AddView (titleUnidad);
				linearContenidoIn.AddView (descriptionUnidad);

				linearContenido.AddView (linearContenidoIn);

				if (indexCurso == 2) {
					linearContenidoIn.RemoveView (descriptionUnidad);
					ImageView imgUnidad = new ImageView (context);
					Picasso.With (context).Load (_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(440),Configuration.getHeight(440)).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).CenterInside().Into (imgUnidad);
					linearContenidoIn.AddView (imgUnidad);
					linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);
					linearUnidad.SetPadding (0, Configuration.getWidth (25),0, Configuration.getWidth (25));

				}

				linearUnidad.AddView (linearContenido);

				if (indexCurso == 0) {
					if (indexUnidad != 3) {

						ImageView info = new ImageView (context);
						info.Tag = i;
						info.SetImageBitmap (iconInfo);
						info.SetX (Configuration.getWidth(450));
						info.SetY (Configuration.getHeight (10));


						linearContenido.AddView (info);

						
						if (indexUnidad == 2 && i > 1 ) {
							
						} else {
							
							LinearLayout test = new LinearLayout (context);
							//test.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
							test.LayoutParameters = new LinearLayout.LayoutParams (-1, Configuration.getHeight(100));
							test.SetGravity (Android.Views.GravityFlags.Center);
							test.Tag = i;
							test.SetX( Configuration.getWidth (0));
							test.SetY( Configuration.getWidth (-40));
							//test.SetPadding (Configuration.getWidth(30), Configuration.getWidth (25), Configuration.getWidth(30), Configuration.getWidth (25));

							test.SetGravity (GravityFlags.Left | GravityFlags.Center);

							TextView verMapa = new TextView (context);
							verMapa.Text = Resources.GetText(Resource.String.See_maps_and_photos);
							verMapa.Typeface = Typeface.CreateFromAsset (context.Assets, "fonts/ArcherMediumPro.otf");
							verMapa.SetTextSize (ComplexUnitType.Fraction, Configuration.getHeight (35));
							verMapa.SetTextColor (Color.ParseColor (Configuration.ListaColores [i % 6]));

							test.AddView (verMapa);
							linearUnidad.AddView (test);
							_listIconVerMap.Add (test);
						}

					} else {
						titleUnidad.SetTextSize (textFormat,Configuration.getHeight(55));
					}



				}

				if (indexCurso == 1 && indexUnidad==7) {
					linearContenidoIn.RemoveView (titleUnidad);
					linearContenidoIn.RemoveView (descriptionUnidad);
					//linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
					linearContenidoIn.SetX(Configuration.getWidth (0));
					ImageView imgUnidad = new ImageView (context);
					Picasso.With (context).Load (_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(640),Configuration.getHeight(2362)).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).CenterInside().Into (imgUnidad);
					linearContenidoIn.AddView (imgUnidad);
					linearUnidad.SetPadding (0, 0, 0, 0);
					linearUnidad.SetX(Configuration.getWidth (0));
				}



				_listLinearUnidades.Add (linearUnidad);
				LinearLayout separationLinear = new LinearLayout (context);
				separationLinear.LayoutParameters = new LinearLayout.LayoutParams (-1, 5);
				separationLinear.SetBackgroundColor (Color.ParseColor ("#D8D8D8"));
				separationLinear.Orientation = Orientation.Horizontal;


				//linearUnidad.AddView (separationLinear);
				_spaceUnidades.AddView (linearUnidad);
				_spaceUnidades.AddView (separationLinear);
			}
		}
Example #5
0
		public void initUnidades(int indexCurso, int indexUnidad)
		{
			//this.isFavoritos = false;
			var textFormat = Android.Util.ComplexUnitType.Px;
			_spaceUnidades.RemoveAllViews();
			_listLinearUnidades.Clear();
			_listIconMap.Clear();
			_listIconVerMap.Clear();
			int numUnidades = _listUnidades.Count;
			_mainSpace.SetY(Configuration.getHeight(0));
			try
			{
				_mainSpace.RemoveAllViews();
				_mainSpace.AddView(_fondo2);
				_mainSpace.AddView(_contentScrollView_S2);
				_mainSpace.AddView(mensajeFavoritos);
				_mainSpace.AddView(_spaceUnidades);
			}
			catch (Exception e)
			{
				//ya existe esos hijos
			}
			_mainSpace.SetPadding(0, 0, 0, 0);

			//Color para los LoView
			if (indice_navigator == 0) { Configuration.colorGlobal = Configuration.colorPartida; }//La Partida
			if (indice_navigator == 1) {Configuration.colorGlobal = Configuration.ListaColores50Campamentos[indexUnidad]; }//50 campamentos
			if (indice_navigator == 2) { Configuration.colorGlobal = Configuration.azul; }//Mejores campamentos
			if (indice_navigator == 3) { Configuration.colorGlobal = Configuration.colorExpertos;}//Expertos

			mensajeFavoritos.RemoveAllViews();
			if(indexUnidad==3 || isFavoritos){
				

				//Sacar la lista de Favoritos
				listFavorites = FavoritosItemManager.GetTasks();
				int tam = listFavorites.Count;
				_listUnidades.Clear ();

				////// 
				//MLearning.Core.ViewModels.MainViewModel.lo_by_circle_wrapper currentLearningObject = vm.LearningOjectsList[currentcurso];
				//int circleID = currentLearningObject.lo.Circle_id;
				var tasks = FavoritosItemManager.GetTasks();

				List<int> items = new List<int>();
				foreach (var task in tasks)
				{
					items.Add(task.Id_unidad);
				}
				for (int i = 0; i < tam; i++)
				{
					UnidadItem unItem = new UnidadItem();
					unItem.Description = listFavorites[i].Descripcion;
					unItem.Title = listFavorites[i].Titulo;
					unItem.CurrentSection = listFavorites[i].SectionID;
					unItem.Id = listFavorites[i].Id_unidad;
					unItem.LO_ID = listFavorites[i].LOID; 
					 

					_listUnidades.Add(unItem);
				}
				//this.isFavoritos = true;
					

				vm.bookmarks = items;

				//vm.OpenFavs.Execute(null);

				//_mainSpace.RemoveAllViews();
				//initUnidades(currentcurso, currentunidad);

				//-----------------------------
				numUnidades = _listUnidades.Count;


				//if (numUnidades == 0)
				//{
				//_mainSpace.RemoveAllViews();
				//_mainSpace.SetPadding(Configuration.getWidth(10), 0, Configuration.getWidth(10), 0);
				//


				if (numUnidades == 0) { Toast.MakeText(context, Resources.GetText(Resource.String.listaVaciamismejoresCampamentos), ToastLength.Short).Show(); }
				else { /*Toast.MakeText(context, Resources.GetText(Resource.String.mismejoresCampamentos), ToastLength.Short).Show();*/ }

					TextView txtTmp = new TextView(context);
					//txtTmp.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
				txtTmp.Text = Resources.GetText(Resource.String.agregaCampamentos);
					txtTmp.SetTextSize(ComplexUnitType.Fraction, Configuration.getWidth(34));
				txtTmp.SetTextColor(Color.ParseColor("#616161"));
					mensajeFavoritos.AddView(txtTmp);

					TextView txtTmp2 = new TextView(context);
				txtTmp2.Text = Resources.GetText(Resource.String.completalosCampamentos);
					//txtTmp2.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
					txtTmp2.SetTextColor(Color.ParseColor(Configuration.ListaColores[0 % 6]));
					txtTmp2.SetTextSize(ComplexUnitType.Fraction, Configuration.getWidth(38));
					mensajeFavoritos.AddView(txtTmp2);


				//}

				//return;
			}

            if (isNotas)
			{
				_mainSpace.RemoveAllViews();
				taskListView = new ListView(context);
				taskListView.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(850));

				addTaskButton = new Button(context);
				addTaskButton.Text = Resources.GetText(Resource.String.aniadirNota);
				addTaskButton.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);

				_mainSpace.SetY (Configuration.getHeight (20));

				//addTaskButton.SetY (Configuration.getHeight (130));
				//_mainLayout.AddView(addTaskButton);
				_mainSpace.AddView(addTaskButton);
				_mainSpace.AddView(taskListView);

				if (addTaskButton != null)
				{
					addTaskButton.Click += (sender, e) =>
					{
						//layoutSave.Visibility = Android.Views.ViewStates.Visible;
						context.StartActivity(typeof(NotasItemScreen));
					};
				}

				// wire up task click handler
				if (taskListView != null)
				{
					taskListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
					{
						var taskDetails = new Intent(context, typeof(NotasItemScreen));
						taskDetails.PutExtra("TaskID", tasks[e.Position].ID);
						context.StartActivity(taskDetails);
					};
				}
				return;
			}

			/*if (isFavoritos && numUnidades == 0)
			{
				Toast.MakeText(context, "Mis mejores Campamentos VACIOO", ToastLength.Short).Show();
			}*/

			for (int i = 0; i < numUnidades; i++) 
			{
				LinearLayoutLO linearUnidad = new LinearLayoutLO (context);
				linearUnidad.content = _listUnidades[i];
				linearUnidad.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearUnidad.Orientation = Orientation.Vertical;
				linearUnidad.SetGravity (Android.Views.GravityFlags.CenterVertical);
				//linearUnidad.SetBackgroundColor (Color.Blue);
				linearUnidad.index = i;
				linearUnidad.SetPadding (Configuration.getWidth(100), Configuration.getWidth (25),0, Configuration.getWidth (25));
				//linearUnidad.SetX (100);



				TextView titleUnidad = new TextView(context);
				titleUnidad.SetTextSize (textFormat,Configuration.getHeight(42));
				titleUnidad.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (440), -2);


				/*if (indexCurso == 2) {
					if (indexUnidad == 3) {
						linearUnidad.Orientation = Orientation.Horizontal;
						ImageIconMap icon = new ImageIconMap (context);
						icon.index = i;
						icon.SetImageBitmap(iconPlay);
						icon.SetX (Configuration.getWidth (60));
						linearUnidad.AddView (icon);
						_listIconMap.Add (icon);
					}
				} */

				if (indexCurso == 3) {
					
					titleUnidad.SetTextSize (textFormat,Configuration.getHeight(55));

				}

				RelativeLayout linearContenido = new RelativeLayout (context);
				linearContenido.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearContenido.SetGravity (Android.Views.GravityFlags.Center);



				//TextView titleUnidad = new TextView(context);
				//titleUnidad.Text = _listUnidades [i].Title;
				titleUnidad.TextFormatted = Html.FromHtml (_listUnidades [i].Title);
				titleUnidad.SetTextColor(Color.ParseColor(Configuration.colorGlobal));
				if (indice_navigator == 0)
				{
					if (titleUnidad.Text.Equals("Calzado") || titleUnidad.Text.Equals("Footwear"))
					{
						titleUnidad.SetTextColor(Color.ParseColor(Configuration.colorCalzado));
					}
				}

				//titleUnidad.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");


				TextView descriptionUnidad = new TextView(context);
				descriptionUnidad.LayoutParameters = new LinearLayout.LayoutParams (Configuration.getWidth (440), -2);
				//descriptionUnidad.Text = _listUnidades [i].Description;

				descriptionUnidad.TextFormatted = Html.FromHtml (_listUnidades [i].Description);
				//descriptionUnidad.Text = _listUnidades [i].Description;
				//descriptionUnidad.Typeface =  Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
				descriptionUnidad.SetTextSize (textFormat,Configuration.getHeight(28));
				descriptionUnidad.SetTextColor(Color.ParseColor("#616161"));
				Linkify.AddLinks (descriptionUnidad, MatchOptions.All);
				//descriptionUnidad.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance;
				//descriptionUnidad.LinksClickable = true;

				//descriptionUnidad.SetTextIsSelectable (true);

				LinearLayout linearContenidoIn = new LinearLayout (context);
				linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-1, -2);
				linearContenidoIn.Orientation = Orientation.Vertical;
				//linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);



				linearContenidoIn.AddView (titleUnidad);
				linearContenidoIn.AddView (descriptionUnidad);

				linearContenido.AddView (linearContenidoIn);

				/*if (indexCurso == 2) {
					linearContenidoIn.RemoveView (descriptionUnidad);
					ImageView imgUnidad = new ImageView (context);
					Picasso.With (context).Load (_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(440),Configuration.getHeight(440)).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).CenterInside().Into (imgUnidad);
					linearContenidoIn.AddView (imgUnidad);
					linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);
					linearUnidad.SetPadding (0, Configuration.getWidth (25),0, Configuration.getWidth (25));

				} */

				linearUnidad.AddView (linearContenido);

				if (indexCurso == 3) {
					

					if (indexUnidad != 4) {//Antes era 3, ahora no es necesario eso

						/*ImageView info = new ImageView (context);
						info.Tag = i;
						info.SetImageBitmap (iconInfo);
						info.SetX (Configuration.getWidth(450));
						info.SetY (Configuration.getHeight (10));*/

						ImageView favorit_ = new ImageView(context);
						favorit_.Tag = i;
						favorit_.SetX(Configuration.getWidth(450));
						favorit_.SetY(Configuration.getHeight(50));
						favorit_.Click += delegate {
							funcFavoritos(favorit_,indexCurso,indexUnidad);
						};
						//Colocando icono de Favoritos
						if(!isFavoritos){
							
							int id_auto = 0;
							if (isListFavorites(_listUnidades[i].Id)!=-1)
							{
								favorit_.SetImageBitmap(iconFavorito);
							}
							else
							{
								favorit_.SetImageBitmap(iconFavorito_BN);
							}


							linearContenido.AddView (favorit_);
						}
						bool removido = true;
						if(isFavoritos){
                            /*_mainSpace.RemoveView(_contentScrollView_S2);
							_mainSpace.RemoveView (_fondo2);*/
                            
							_mainSpace.RemoveAllViews ();
                            favorit_.SetImageBitmap(iconFavorito);
							linearContenido.AddView (favorit_);
							_mainSpace.AddView(mensajeFavoritos);
							_mainSpace.AddView (_spaceUnidades);
							removido = false;
						}
						if(removido){
							try{
								_mainSpace.RemoveAllViews ();
								_mainSpace.AddView (_fondo2);
								_mainSpace.AddView (_contentScrollView_S2);
								_mainSpace.AddView (mensajeFavoritos);
								_mainSpace.AddView (_spaceUnidades);

							}catch(Exception e){
								//ya existe esos hijos
							}
						}


						//linearContenido.AddView (info);

					} else {
						titleUnidad.SetTextSize (textFormat,Configuration.getHeight(55));
					}

				}

				if (indexCurso == 1 && indexUnidad==7) {
					linearContenidoIn.RemoveView (titleUnidad);
					linearContenidoIn.RemoveView (descriptionUnidad);
					//linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
					linearContenidoIn.SetX(Configuration.getWidth (0));
					ImageView imgUnidad = new ImageView (context);
					Picasso.With (context).Load (_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(640),Configuration.getHeight(2362)).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).CenterInside().Into (imgUnidad);
					linearContenidoIn.AddView (imgUnidad);
					linearUnidad.SetPadding (0, 0, 0, 0);
					linearUnidad.SetX(Configuration.getWidth (0));
				}



				_listLinearUnidades.Add (linearUnidad);
				LinearLayout separationLinear = new LinearLayout (context);
				separationLinear.LayoutParameters = new LinearLayout.LayoutParams (-1, 5);
				separationLinear.SetBackgroundColor (Color.ParseColor ("#D8D8D8"));
				separationLinear.Orientation = Orientation.Horizontal;


				//linearUnidad.AddView (separationLinear);
				_spaceUnidades.AddView (linearUnidad);
				_spaceUnidades.AddView (separationLinear);
			}
		}
Example #6
0
        public void initUnidades(int indexCurso, int indexUnidad)
        {
            var textFormat = Android.Util.ComplexUnitType.Px;

            _spaceUnidades.RemoveAllViews();
            _listLinearUnidades.Clear();
            _listIconMap.Clear();
            _listIconVerMap.Clear();
            int numUnidades = _listUnidades.Count;

            _mainSpace.SetY(Configuration.getHeight(0));

            if (isNotas)
            {
                _mainSpace.RemoveAllViews();
                taskListView = new ListView(context);
                taskListView.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(850));

                addTaskButton                  = new Button(context);
                addTaskButton.Text             = "AƱadir Nota";
                addTaskButton.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);

                _mainSpace.SetY(Configuration.getHeight(20));

                //addTaskButton.SetY (Configuration.getHeight (130));
                //_mainLayout.AddView(addTaskButton);
                _mainSpace.AddView(addTaskButton);
                _mainSpace.AddView(taskListView);

                if (addTaskButton != null)
                {
                    addTaskButton.Click += (sender, e) =>
                    {
                        //layoutSave.Visibility = Android.Views.ViewStates.Visible;
                        context.StartActivity(typeof(NotasItemScreen));
                    };
                }

                // wire up task click handler
                if (taskListView != null)
                {
                    taskListView.ItemClick += (object sender, AdapterView.ItemClickEventArgs e) =>
                    {
                        var taskDetails = new Intent(context, typeof(NotasItemScreen));
                        taskDetails.PutExtra("TaskID", tasks[e.Position].ID);
                        context.StartActivity(taskDetails);
                    };
                }
                return;
            }

            for (int i = 0; i < numUnidades; i++)
            {
                LinearLayoutLO linearUnidad = new LinearLayoutLO(context);
                linearUnidad.content          = _listUnidades[i];
                linearUnidad.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                linearUnidad.Orientation      = Orientation.Vertical;
                linearUnidad.SetGravity(Android.Views.GravityFlags.CenterVertical);
                //linearUnidad.SetBackgroundColor (Color.Blue);
                linearUnidad.index = i;
                linearUnidad.SetPadding(Configuration.getWidth(100), Configuration.getWidth(25), 0, Configuration.getWidth(25));
                //linearUnidad.SetX (100);



                TextView titleUnidad = new TextView(context);
                titleUnidad.SetTextSize(textFormat, Configuration.getHeight(42));
                titleUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2);


                /*if (indexCurso == 2) {
                 *      if (indexUnidad == 3) {
                 *              linearUnidad.Orientation = Orientation.Horizontal;
                 *              ImageIconMap icon = new ImageIconMap (context);
                 *              icon.index = i;
                 *              icon.SetImageBitmap(iconPlay);
                 *              icon.SetX (Configuration.getWidth (60));
                 *              linearUnidad.AddView (icon);
                 *              _listIconMap.Add (icon);
                 *      }
                 * } */

                if (indexCurso == 3)
                {
                    titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55));
                }

                RelativeLayout linearContenido = new RelativeLayout(context);
                linearContenido.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                linearContenido.SetGravity(Android.Views.GravityFlags.Center);



                //TextView titleUnidad = new TextView(context);
                //titleUnidad.Text = _listUnidades [i].Title;
                titleUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Title);
                titleUnidad.SetTextColor(Color.ParseColor(Configuration.ListaColores [i % 6]));
                titleUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");


                TextView descriptionUnidad = new TextView(context);
                descriptionUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2);
                //descriptionUnidad.Text = _listUnidades [i].Description;

                descriptionUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Description);
                //descriptionUnidad.Text = _listUnidades [i].Description;
                descriptionUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
                descriptionUnidad.SetTextSize(textFormat, Configuration.getHeight(28));
                Linkify.AddLinks(descriptionUnidad, MatchOptions.All);
                //descriptionUnidad.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance;
                //descriptionUnidad.LinksClickable = true;

                //descriptionUnidad.SetTextIsSelectable (true);

                LinearLayout linearContenidoIn = new LinearLayout(context);
                linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                linearContenidoIn.Orientation      = Orientation.Vertical;
                //linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);



                linearContenidoIn.AddView(titleUnidad);
                linearContenidoIn.AddView(descriptionUnidad);

                linearContenido.AddView(linearContenidoIn);

                /*if (indexCurso == 2) {
                 *      linearContenidoIn.RemoveView (descriptionUnidad);
                 *      ImageView imgUnidad = new ImageView (context);
                 *      Picasso.With (context).Load (_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(440),Configuration.getHeight(440)).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).CenterInside().Into (imgUnidad);
                 *      linearContenidoIn.AddView (imgUnidad);
                 *      linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);
                 *      linearUnidad.SetPadding (0, Configuration.getWidth (25),0, Configuration.getWidth (25));
                 *
                 * } */

                linearUnidad.AddView(linearContenido);

                if (indexCurso == 3)
                {
                    if (indexUnidad != 3)
                    {
                        ImageView info = new ImageView(context);
                        info.Tag = i;
                        info.SetImageBitmap(iconInfo);
                        info.SetX(Configuration.getWidth(450));
                        info.SetY(Configuration.getHeight(10));

                        ImageView favorit_ = new ImageView(context);
                        favorit_.Tag = i;
                        favorit_.SetX(Configuration.getWidth(450));
                        favorit_.SetY(Configuration.getHeight(150));
                        favorit_.Click += delegate {
                            funcFavoritos(favorit_);
                        };
                        //Colocando icono de Favoritos
                        if (!isFavoritos)
                        {
                            int id_auto = 0;
                            if (isListFavorites(_listUnidades[i].Id) != -1)
                            {
                                favorit_.SetImageBitmap(iconFavorito);
                            }
                            else
                            {
                                favorit_.SetImageBitmap(iconFavorito_BN);
                            }


                            linearContenido.AddView(favorit_);
                        }
                        bool removido = true;
                        if (isFavoritos)
                        {
                            /*_mainSpace.RemoveView(_contentScrollView_S2);
                             * _mainSpace.RemoveView (_fondo2);*/
                            _mainSpace.RemoveAllViews();
                            favorit_.SetImageBitmap(iconFavorito);
                            linearContenido.AddView(favorit_);
                            _mainSpace.AddView(_spaceUnidades);
                            removido = false;
                        }
                        if (removido)
                        {
                            try{
                                _mainSpace.RemoveAllViews();
                                _mainSpace.AddView(_fondo2);
                                _mainSpace.AddView(_contentScrollView_S2);
                                _mainSpace.AddView(_spaceUnidades);
                            }catch (Exception e) {
                                //ya existe esos hijos
                            }
                        }


                        linearContenido.AddView(info);
                    }
                    else
                    {
                        titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55));
                    }
                }

                if (indexCurso == 1 && indexUnidad == 7)
                {
                    linearContenidoIn.RemoveView(titleUnidad);
                    linearContenidoIn.RemoveView(descriptionUnidad);
                    //linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
                    linearContenidoIn.SetX(Configuration.getWidth(0));
                    ImageView imgUnidad = new ImageView(context);
                    Picasso.With(context).Load(_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(640), Configuration.getHeight(2362)).Placeholder(context.Resources.GetDrawable(Resource.Drawable.progress_animation)).CenterInside().Into(imgUnidad);
                    linearContenidoIn.AddView(imgUnidad);
                    linearUnidad.SetPadding(0, 0, 0, 0);
                    linearUnidad.SetX(Configuration.getWidth(0));
                }



                _listLinearUnidades.Add(linearUnidad);
                LinearLayout separationLinear = new LinearLayout(context);
                separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5);
                separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8"));
                separationLinear.Orientation = Orientation.Horizontal;


                //linearUnidad.AddView (separationLinear);
                _spaceUnidades.AddView(linearUnidad);
                _spaceUnidades.AddView(separationLinear);
            }
        }
Example #7
0
        public void initUnidades(int indexCurso, int indexUnidad)
        {
            var textFormat = Android.Util.ComplexUnitType.Px;

            _spaceUnidades.RemoveAllViews();
            _listLinearUnidades.Clear();
            _listIconMap.Clear();
            _listIconVerMap.Clear();
            int numUnidades = _listUnidades.Count;

            for (int i = 0; i < numUnidades; i++)
            {
                LinearLayoutLO linearUnidad = new LinearLayoutLO(context);
                linearUnidad.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                linearUnidad.Orientation      = Orientation.Vertical;
                linearUnidad.SetGravity(Android.Views.GravityFlags.CenterVertical);
                linearUnidad.index = i;
                linearUnidad.SetPadding(Configuration.getWidth(100), Configuration.getWidth(25), 0, Configuration.getWidth(25));
                //linearUnidad.SetX (100);



                TextView titleUnidad = new TextView(context);
                titleUnidad.SetTextSize(textFormat, Configuration.getHeight(42));
                titleUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2);


                /*if (indexCurso == 2) {
                 *      if (indexUnidad == 3) {
                 *              linearUnidad.Orientation = Orientation.Horizontal;
                 *              ImageIconMap icon = new ImageIconMap (context);
                 *              icon.index = i;
                 *              icon.SetImageBitmap(iconPlay);
                 *              icon.SetX (Configuration.getWidth (60));
                 *              linearUnidad.AddView (icon);
                 *              _listIconMap.Add (icon);
                 *      }
                 * } */

                if (indexCurso == 0)                  //3
                {
                    titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55));
                }

                RelativeLayout linearContenido = new RelativeLayout(context);
                linearContenido.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                linearContenido.SetGravity(Android.Views.GravityFlags.Center);



                //TextView titleUnidad = new TextView(context);
                //titleUnidad.Text = _listUnidades [i].Title;
                titleUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Title);
                titleUnidad.SetTextColor(Color.ParseColor(Configuration.ListaColores [i % 6]));
                titleUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");


                TextView descriptionUnidad = new TextView(context);
                descriptionUnidad.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(440), -2);
                //descriptionUnidad.Text = _listUnidades [i].Description;

                descriptionUnidad.TextFormatted = Html.FromHtml(_listUnidades [i].Description);
                //descriptionUnidad.Text = _listUnidades [i].Description;
                descriptionUnidad.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
                descriptionUnidad.SetTextSize(textFormat, Configuration.getHeight(28));
                Linkify.AddLinks(descriptionUnidad, MatchOptions.All);
                //descriptionUnidad.MovementMethod = Android.Text.Method.LinkMovementMethod.Instance;
                //descriptionUnidad.LinksClickable = true;

                //descriptionUnidad.SetTextIsSelectable (true);

                LinearLayout linearContenidoIn = new LinearLayout(context);
                linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
                linearContenidoIn.Orientation      = Orientation.Vertical;
                //linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);



                linearContenidoIn.AddView(titleUnidad);
                linearContenidoIn.AddView(descriptionUnidad);

                linearContenido.AddView(linearContenidoIn);

                /*if (indexCurso == 2) {
                 *      linearContenidoIn.RemoveView (descriptionUnidad);
                 *      ImageView imgUnidad = new ImageView (context);
                 *      Picasso.With (context).Load (_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(440),Configuration.getHeight(440)).Placeholder(context.Resources.GetDrawable (Resource.Drawable.progress_animation)).CenterInside().Into (imgUnidad);
                 *      linearContenidoIn.AddView (imgUnidad);
                 *      linearContenidoIn.SetGravity (Android.Views.GravityFlags.Center);
                 *      linearUnidad.SetPadding (0, Configuration.getWidth (25),0, Configuration.getWidth (25));
                 *
                 * } */

                linearUnidad.AddView(linearContenido);

                if (indexCurso == 3)
                {
                    if (indexUnidad != 3)
                    {
                        ImageView info = new ImageView(context);
                        info.Tag = i;
                        info.SetImageBitmap(iconInfo);
                        info.SetX(Configuration.getWidth(450));
                        info.SetY(Configuration.getHeight(10));


                        linearContenido.AddView(info);
                    }
                    else
                    {
                        titleUnidad.SetTextSize(textFormat, Configuration.getHeight(55));
                    }
                }

                if (indexCurso == 1 && indexUnidad == 7)
                {
                    linearContenidoIn.RemoveView(titleUnidad);
                    linearContenidoIn.RemoveView(descriptionUnidad);
                    //linearContenidoIn.LayoutParameters = new LinearLayout.LayoutParams (-2, -2);
                    linearContenidoIn.SetX(Configuration.getWidth(0));
                    ImageView imgUnidad = new ImageView(context);
                    Picasso.With(context).Load(_listUnidades[i].ImageUrl).Resize(Configuration.getWidth(640), Configuration.getHeight(2362)).Placeholder(context.Resources.GetDrawable(Resource.Drawable.progress_animation)).CenterInside().Into(imgUnidad);
                    linearContenidoIn.AddView(imgUnidad);
                    linearUnidad.SetPadding(0, 0, 0, 0);
                    linearUnidad.SetX(Configuration.getWidth(0));
                }



                _listLinearUnidades.Add(linearUnidad);
                LinearLayout separationLinear = new LinearLayout(context);
                separationLinear.LayoutParameters = new LinearLayout.LayoutParams(-1, 5);
                separationLinear.SetBackgroundColor(Color.ParseColor("#D8D8D8"));

                separationLinear.Orientation = Orientation.Horizontal;


                //linearUnidad.AddView (separationLinear);
                _spaceUnidades.AddView(linearUnidad);
                _spaceUnidades.AddView(separationLinear);
            }
        }