Exemplo n.º 1
0
        public void showPLaceInfo(int position)
        {
            if (_leyendaShowed)
            {
                showLeyenda();
            }
            header.RemoveView(_leyendaMap);

            _mainLayout.AddView(scrollPlaces);

            titulo_header.Text = _currentPlaces [position].titulo;

            scrollPlaces.SetBackgroundColor(Color.White);
            placeInfoOpen = true;
            placesInfoLayout.RemoveAllViews();
            int space     = Configuration.getWidth(15);
            var extraInfo = _placesData [position].placeExtraInfo;

            for (int i = 0; i < extraInfo.Count; i++)
            {
                bool flagSpace = false;

                String url = extraInfo [i].url;

                if (extraInfo [i].detalle != null)
                {
                    TextView detalle = new TextView(context);
                    detalle.SetTextSize(ComplexUnitType.Fraction, Configuration.getHeight(32));
                    detalle.Typeface = Typeface.CreateFromAsset(context.Assets, "fonts/ArcherMediumPro.otf");
                    detalle.Text     = extraInfo [i].detalle;
                    Linkify.AddLinks(detalle, MatchOptions.All);                     //HUILLCA
                    placesInfoLayout.AddView(detalle);
                    flagSpace = true;
                }

                if (url != null)
                {
                    ImageView image = new ImageView(context);
                    Picasso.With(context).Load(url).Placeholder(context.Resources.GetDrawable(Resource.Drawable.progress_animation)).Resize(Configuration.getWidth(640), Configuration.getHeight(640)).CenterInside().Into(image);
                    placesInfoLayout.AddView(image);

                    if (flagSpace)
                    {
                        image.SetPadding(0, space, 0, space);
                    }
                }
            }
            placesInfoLayout.SetBackgroundColor(Color.White);
        }
Exemplo n.º 2
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 ();
        }