예제 #1
0
 public ScaleImageViewGestureDetector(ScaleImageView imageView)
 {
     m_ScaleImageView = imageView;
 }
예제 #2
0
파일: MapView.cs 프로젝트: aocsa/CInca2
        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 ();
        }