Exemplo n.º 1
0
 public static GoogleApis Obtain(Context context)
 {
     if (instance == null)
     {
         instance = new GoogleApis(context);
     }
     return(instance);
 }
Exemplo n.º 2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            var view    = EnsureView(convertView);
            var version = Interlocked.Increment(ref view.VersionNumber);

            var mapView           = view.FindViewById <ImageView> (Resource.Id.StationMap);
            var stationName       = view.FindViewById <TextView> (Resource.Id.MainStationName);
            var secondStationName = view.FindViewById <TextView> (Resource.Id.SecondStationName);
            var bikeNumber        = view.FindViewById <TextView> (Resource.Id.BikeNumber);
            var slotNumber        = view.FindViewById <TextView> (Resource.Id.SlotNumber);
            var bikeImage         = view.FindViewById <ImageView> (Resource.Id.bikeImageView);

            if (bikePicture == null)
            {
                bikePicture = XamSvg.SvgFactory.GetDrawable(context.Resources, Resource.Raw.bike);
            }
            bikeImage.SetImageDrawable(bikePicture);
            if (mapPlaceholder == null)
            {
                mapPlaceholder = XamSvg.SvgFactory.GetDrawable(context.Resources, Resource.Raw.map_placeholder);
            }
            mapView.SetImageDrawable(mapPlaceholder);

            var station = stations [position];

            view.Station = station;

            string secondPart;

            stationName.Text       = station.Street;
            secondStationName.Text = station.Name;
            bikeNumber.Text        = station.BikeCount.ToString();
            slotNumber.Text        = station.Capacity.ToString();

            var    api    = GoogleApis.Obtain(context);
            string mapUrl = GoogleApis.MakeMapUrl(station.Location);
            Bitmap mapBmp = null;

            if (api.MapCache.TryGet(mapUrl, out mapBmp))
            {
                mapView.SetImageDrawable(new RoundCornerDrawable(mapBmp));
            }
            else
            {
                api.LoadMap(station.Location, view, mapView, version);
            }

            return(view);
        }
Exemplo n.º 3
0
		public static GoogleApis Obtain (Context context)
		{
			if (instance == null)
				instance = new GoogleApis (context);
			return instance;
		}