Пример #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);
        }
Пример #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);
            }
        }
Пример #3
0
        public void ini()
        {
            Drawable dr = new BitmapDrawable(getBitmapFromAsset("images/1header.png"));

            header = new LinearLayout(context);
            header.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(125));
            header.Orientation      = Orientation.Horizontal;
            header.SetGravity(GravityFlags.Center);
            header.SetBackgroundDrawable(dr);


            titulo_header = new TextView(context);
            titulo_header.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(550), -1);
            titulo_header.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(38));
            titulo_header.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
            titulo_header.SetTextColor(Color.White);
            titulo_header.Gravity = GravityFlags.Center;
            //titulo_header.TextAlignment = TextAlignment.Center;

            placesInfoLayout = new LinearLayout(context);
            placesInfoLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, -2);
            int space = Configuration.getWidth(30);

            placesInfoLayout.SetPadding(space, space, space, space);
            placesInfoLayout.Orientation = Orientation.Vertical;

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

            _mainLayout.AddView(header);

            mapImage = new ScaleImageView(context, null);
            mapImage.LayoutParameters = new LinearLayout.LayoutParams(-1, -1);
            mapSpace = new LinearLayout(context);
            mapSpace.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(640), Configuration.getWidth(640));
            mapSpace.SetY(Configuration.getHeight(125));
            mapSpace.SetGravity(GravityFlags.Left);
            mapSpace.SetBackgroundColor(Color.ParseColor("#DFC6BB"));

            //HUILLCA-----------------------------------------
            mapSpaceMarker = new RelativeLayout(context);
            mapSpaceMarker.LayoutParameters = new RelativeLayout.LayoutParams(Configuration.getWidth(640), Configuration.getWidth(640));
            mapSpaceMarker.SetY(Configuration.getHeight(125));
            mapSpaceMarker.SetGravity(GravityFlags.Left);
            mapSpaceMarker.SetBackgroundColor(Color.Transparent);

            iconMarker = new ImageIconMap(context);
            iconMarker.LayoutParameters = new LinearLayout.LayoutParams(Configuration.getWidth(40), Configuration.getWidth(40));
            int w = Configuration.getWidth(40);
            int h = Configuration.getWidth(40);

            iconMarker.SetImageBitmap(Bitmap.CreateScaledBitmap(getBitmapFromAsset("icons/iconmap12.png"), w, h, true));
            iconMarker.SetX(-100);
            iconMarker.SetY(-100);
            iconMarker.SetAlpha(185);             //hace que la imagen sea mas transparente
            mapSpaceMarker.AddView(iconMarker);

            var fadeIn = new AlphaAnimation(0, 1);

            fadeIn.Interpolator = new AccelerateInterpolator();
            fadeIn.Duration     = 1000;

            fadeOut = new AlphaAnimation(1, 0);
            fadeOut.Interpolator  = new DecelerateInterpolator();
            fadeOut.Duration      = 3000;
            fadeOut.AnimationEnd += (s, e) =>
            {
                /*ThreadPool.QueueUserWorkItem(state =>
                 *     {
                 *             Thread.Sleep(2000); //wait 2 sec
                 *             //RunOnUiThread(() => iconMarker.StartAnimation(fadeOut));
                 *     });*/
                iconMarker.StartAnimation(fadeIn);
                iconMarker.Visibility = ViewStates.Invisible;
            };
            //-------------------------------------------------------
            mapSpace.AddView(mapImage);



            placeSpace = new VerticalScrollView(context);
            placeSpace.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(375 - 85));
            placeSpace.SetY(Configuration.getHeight(125) + Configuration.getWidth(640));
            placeSpace.SetBackgroundColor(Color.White);

            placesContainer = new LinearLayout(context);
            placesContainer.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(375 - 85));
            placesContainer.Orientation      = Orientation.Vertical;


            _mainLayout.AddView(mapSpace);
            _mainLayout.AddView(mapSpaceMarker);             //HUILLCA
            _mainLayout.AddView(placeSpace);

            _publicidadLayout = new LinearLayout(context);
            _publicidadLayout.LayoutParameters = new LinearLayout.LayoutParams(-1, Configuration.getHeight(85));
            Drawable drp = new BitmapDrawable(getBitmapFromAsset("images/footerad.jpg"));

            _publicidadLayout.SetBackgroundDrawable(drp);
            _publicidadLayout.SetY(Configuration.getHeight(1136 - 85));
            _mainLayout.AddView(_publicidadLayout);
            _publicidadLayout.Click += delegate {
                if (adOpen)
                {
                    hideAd();
                }
                else
                {
                    Random rnd = new Random();
                    showAd(rnd.Next(adsImagesPath.Count));
                }
            };



            _mainLayout.AddView(leyendaLayout);

            scrollPlaces = new VerticalScrollView(context);
            scrollPlaces.LayoutParameters = new VerticalScrollView.LayoutParams(-1, Configuration.getHeight(1136 - 125 - 85));
            scrollPlaces.AddView(placesInfoLayout);
            scrollPlaces.SetY(Configuration.getHeight(125));


            //mainLayout.AddView (placesInfoLayout);

            //iniPlancesList ();
        }