Ejemplo n.º 1
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);
            mapFragment.Map.MyLocationEnabled = true;
            mapFragment.Map.UiSettings.MyLocationButtonEnabled = false;
            mapFragment.Map.MarkerClick += HandleMarkerClick;
            mapFragment.Map.MapClick    += HandleMapClick;
            var oldPosition = PreviousCameraPosition;

            if (oldPosition != null)
            {
                mapFragment.Map.MoveCamera(CameraUpdateFactory.NewCameraPosition(oldPosition));
            }

            // Setup info pane
            var bikeDrawable        = SvgFactory.GetDrawable(Resources, Resource.Raw.bike);
            var lockDrawable        = SvgFactory.GetDrawable(Resources, Resource.Raw.ic_lock);
            var stationLockDrawable = SvgFactory.GetDrawable(Resources, Resource.Raw.station_lock);
            var bikeNumberDrawable  = SvgFactory.GetDrawable(Resources, Resource.Raw.bike_number);
            var clockDrawable       = SvgFactory.GetDrawable(Resources, Resource.Raw.clock);

            starOnDrawable  = SvgFactory.GetDrawable(Resources, Resource.Raw.star_on);
            starOffDrawable = SvgFactory.GetDrawable(Resources, Resource.Raw.star_off);
            pane.FindViewById <ImageView> (Resource.Id.bikeImageView).SetImageDrawable(bikeDrawable);
            pane.FindViewById <ImageView> (Resource.Id.lockImageView).SetImageDrawable(lockDrawable);
            pane.FindViewById <ImageView> (Resource.Id.stationLock).SetImageDrawable(stationLockDrawable);
            pane.FindViewById <ImageView> (Resource.Id.bikeNumberImg).SetImageDrawable(bikeNumberDrawable);
            pane.FindViewById <ImageView> (Resource.Id.clockImg).SetImageDrawable(clockDrawable);
            var starBtn = pane.FindViewById <ImageButton> (Resource.Id.StarButton);

            starBtn.Click += HandleStarButtonChecked;
            streetViewFragment.StreetViewPanorama.UserNavigationEnabled    = false;
            streetViewFragment.StreetViewPanorama.StreetNamesEnabled       = false;
            streetViewFragment.StreetViewPanorama.StreetViewPanoramaClick += HandleMapButtonClick;
        }
Ejemplo n.º 2
0
        void SetSvgImage(View baseView, int viewId, int resId)
        {
            var view = baseView.FindViewById <ImageView>(viewId);

            if (view == null)
            {
                return;
            }
            var img = SvgFactory.GetDrawable(Resources, resId);

            view.SetImageDrawable(img);
        }
Ejemplo n.º 3
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            // Default map initialization
            mapFragment.Map.MyLocationEnabled = true;
            mapFragment.Map.MapType           = GoogleMap.MapTypeNormal;
            mapFragment.Map.UiSettings.MyLocationButtonEnabled = false;
            mapFragment.Map.UiSettings.ZoomControlsEnabled     = false;
            mapFragment.Map.UiSettings.CompassEnabled          = false;
            mapFragment.Map.UiSettings.RotateGesturesEnabled   = false;
            mapFragment.Map.UiSettings.TiltGesturesEnabled     = false;
            mapFragment.Map.MoveCamera(CameraUpdateFactory.NewLatLngZoom(
                                           new LatLng(47.60621, -122.332071),
                                           13
                                           ));

            mapFragment.Map.MarkerClick += HandleMarkerClick;
            mapFragment.Map.MapClick    += HandleMapClick;
            var oldPosition = PreviousCameraPosition;

            if (oldPosition != null)
            {
                mapFragment.Map.MoveCamera(CameraUpdateFactory.NewCameraPosition(oldPosition));
            }

            // Setup info pane
            var bikeDrawable                = SvgFactory.GetDrawable(Resources, Resource.Raw.bike);
            var lockDrawable                = SvgFactory.GetDrawable(Resources, Resource.Raw.ic_lock);
            var stationLockDrawable         = SvgFactory.GetDrawable(Resources, Resource.Raw.station_lock);
            var bikeNumberDrawable          = SvgFactory.GetDrawable(Resources, Resource.Raw.bike_number);
            var stationNotInstalledDrawable = SvgFactory.GetDrawable(Resources, Resource.Raw.not_installed);
            var clockDrawable               = SvgFactory.GetDrawable(Resources, Resource.Raw.clock);

            starOnDrawable  = SvgFactory.GetDrawable(Resources, Resource.Raw.star_on);
            starOffDrawable = SvgFactory.GetDrawable(Resources, Resource.Raw.star_off);
            pane.FindViewById <ImageView> (Resource.Id.bikeImageView).SetImageDrawable(bikeDrawable);
            pane.FindViewById <ImageView> (Resource.Id.lockImageView).SetImageDrawable(lockDrawable);
            pane.FindViewById <ImageView> (Resource.Id.stationLock).SetImageDrawable(stationLockDrawable);
            pane.FindViewById <ImageView> (Resource.Id.stationNotInstalled).SetImageDrawable(stationNotInstalledDrawable);
            pane.FindViewById <ImageView> (Resource.Id.bikeNumberImg).SetImageDrawable(bikeNumberDrawable);
            pane.FindViewById <ImageView> (Resource.Id.clockImg).SetImageDrawable(clockDrawable);
            var starBtn = pane.FindViewById <ImageButton> (Resource.Id.StarButton);

            starBtn.Click += HandleStarButtonChecked;
            streetViewFragment.StreetViewPanorama.UserNavigationEnabled    = false;
            streetViewFragment.StreetViewPanorama.StreetNamesEnabled       = false;
            streetViewFragment.StreetViewPanorama.StreetViewPanoramaClick += HandleMapButtonClick;
        }
Ejemplo n.º 4
0
        void LoadImageTest(int rawID)
        {
            foreach (var drawableID in drawableViewIds)
            {
                var drawable = SvgFactory.GetDrawable(Resources, rawID);
                var v        = FindViewById <ImageView> (drawableID);
                v.SetImageDrawable(drawable);
            }

            var bitmap1 = SvgFactory.GetBitmap(Resources, rawID,
                                               width: 40,
                                               height: 69);
            var bitmap2 = SvgFactory.GetBitmap(Resources, rawID,
                                               width: 98,
                                               height: 98);
            var bitmap3 = SvgFactory.GetBitmap(Resources, rawID,
                                               width: 47,
                                               height: 32);

            FindViewById <ImageView> (Resource.Id.bitmap1).SetImageBitmap(bitmap1);
            FindViewById <ImageView> (Resource.Id.bitmap2).SetImageBitmap(bitmap2);
            FindViewById <ImageView> (Resource.Id.bitmap3).SetImageBitmap(bitmap3);
        }
Ejemplo n.º 5
0
        public override void OnViewCreated(View view, Bundle savedInstanceState)
        {
            base.OnViewCreated(view, savedInstanceState);

            view.SetBackgroundDrawable(AndroidExtensions.DefaultBackground);

            mapFragment?.GetMapAsync(this);



            // Setup info pane
            SetSvgImage(pane, Resource.Id.bikeImageView, Resource.Raw.bike);
            SetSvgImage(pane, Resource.Id.lockImageView, Resource.Raw.ic_lock);
            SetSvgImage(pane, Resource.Id.stationLock, Resource.Raw.station_lock);
            SetSvgImage(pane, Resource.Id.bikeNumberImg, Resource.Raw.bike_number);
            SetSvgImage(pane, Resource.Id.clockImg, Resource.Raw.clock);
            SetSvgImage(pane, Resource.Id.stationNotInstalled, Resource.Raw.not_installed);
            starOnDrawable  = SvgFactory.GetDrawable(Resources, Resource.Raw.star_on);
            starOffDrawable = SvgFactory.GetDrawable(Resources, Resource.Raw.star_off);
            var starBtn = pane.FindViewById <ImageButton>(Resource.Id.StarButton);

            starBtn.Click += HandleStarButtonChecked;
            streetViewFragment?.GetStreetViewPanoramaAsync(this);
        }
Ejemplo n.º 6
0
 public RentalsAdapter(Context context)
 {
     this.context          = context;
     bikeSeparatorDrawable = SvgFactory.GetDrawable(context.Resources,
                                                    Resource.Raw.bike_separator);
 }
Ejemplo n.º 7
0
        private static bool AddImages(Context context, SpannableString spannable)
        {
            string pattern = "\\Q[img src=\\E([a-zA-Z0-9_]+?)\\Q/]\\E";

            //MatchCollection m = Regex.Matches(spannable, pattern, System.Text.RegularExpressions.RegexOptions.IgnoreCase);
            //foreach (Match match in m)
            //    Console.WriteLine("{0} (duplicates '{1}') at position {2}", match.Value, match.Groups[1].Value, match.Index);


            Java.Util.Regex.Pattern refImg = Java.Util.Regex.Pattern.Compile(pattern);
            bool hasChanges = false;

            Matcher matcher = refImg.Matcher(spannable);

            while (matcher.Find())
            {
                bool set = true;
                foreach (ImageSpan span in spannable.GetSpans(matcher.Start(), matcher.End(), Java.Lang.Class.FromType(typeof(ImageSpan))))
                {
                    if (spannable.GetSpanStart(span) >= matcher.Start() && spannable.GetSpanEnd(span) <= matcher.End())
                    {
                        spannable.RemoveSpan(span);
                    }
                    else
                    {
                        set = false;
                        break;
                    }
                }

                string resname = spannable.SubSequence(matcher.Start(1), matcher.End(1)).ToString().Trim();
                //int id = context.Resources.GetIdentifier(resname, "drawable", context.PackageName);
                if (set)
                {
                    hasChanges = true;

                    int  identifier = context.Resources.GetIdentifier("modezoneedit", "drawable", context.PackageName);
                    bool isSvg = true; Bitmap bitmap2 = null;
                    if (isSvg)
                    {
                        SvgBitmapDrawable oo = SvgFactory.GetDrawable(context.Resources, identifier);
                        //oo.Mutate().SetColorFilter(0xffff0000, Android.Graphics.PorterDuff.Mode.Multiply);
                        Bitmap bitmap = Bitmap.CreateBitmap(oo.Picture.Width, oo.Picture.Height, Bitmap.Config.Argb8888);
                        Canvas canvas = new Canvas(bitmap);
                        canvas.DrawPicture(oo.Picture);
                        bitmap2 = Bitmap.CreateScaledBitmap(bitmap, (int)(bitmap.Width * 0.3), (int)(bitmap.Height * 0.3), false);
                    }
                    else
                    {
                        bitmap2 = BitmapFactory.DecodeResource(context.Resources, identifier);
                        bitmap2 = Bitmap.CreateScaledBitmap(bitmap2, (int)(bitmap2.Width * 0.3), (int)(bitmap2.Height * 0.3), false);
                    }

                    ImageSpan span = new ImageSpan(context, bitmap2);
                    spannable.SetSpan(span, matcher.Start(), matcher.End(), SpanTypes.ExclusiveExclusive);

                    /*spannable.SetSpan(new ImageSpan(context, id),
                     * matcher.Start(),
                     * matcher.End(),
                     * SpanTypes.ExclusiveExclusive
                     * );*/
                }
                //if (isLastPoint) canvas.DrawColor(Color.Green, PorterDuff.Mode.SrcAtop);

                //Bitmap b = BitmapFactory.DecodeResource(context.Resources, Resource.Drawable.ModeZoneEdit);
            }
            return(hasChanges);
        }