Ejemplo n.º 1
0
		public HubwayMapFragment (Context context)
		{
			MapsInitializer.Initialize (context);
			this.pinFactory = new PinFactory (context);
			this.favManager = FavoriteManager.Obtain (context);
			HasOptionsMenu = true;
		}
Ejemplo n.º 2
0
 public HubwayMapFragment(Context context)
 {
     MapsInitializer.Initialize(context);
     this.pinFactory = new PinFactory(context);
     this.favManager = FavoriteManager.Obtain(context);
     HasOptionsMenu  = true;
 }
Ejemplo n.º 3
0
        public override void OnActivityCreated(Bundle savedInstanceState)
        {
            base.OnActivityCreated(savedInstanceState);

            var context = Activity;

            this.pinFactory = new PinFactory();
            this.favManager = FavoriteManager.Obtain(context);
        }
Ejemplo n.º 4
0
        public void OpenStationWithMarker(Marker marker)
        {
            if (string.IsNullOrEmpty(marker.Title) || marker.Title == SearchPinId)
            {
                return;
            }

            var    splitTitle = marker.Title.Split('|');
            string displayNameSecond;
            var    displayName = StationUtils.CutStationName(splitTitle [1], out displayNameSecond);

            ipName.Text  = displayName;
            ipName2.Text = displayNameSecond;

            currentShownID     = int.Parse(splitTitle [0]);
            currentShownMarker = marker;

            var isLocked = string.IsNullOrEmpty(marker.Snippet);

            if (ipStationLock == null)
            {
                ipStationLock = pane.FindViewById(Resource.Id.stationLock);
            }
            ipStationLock.Visibility = isLocked ? ViewStates.Visible : ViewStates.Gone;

            if (!isLocked)
            {
                var splitNumbers = marker.Snippet.Split('|');
                ipBikes.Text = splitNumbers [0];
                ipSlots.Text = splitNumbers [1];

                var baseGreen = Color.Rgb(0x66, 0x99, 0x00);
                var baseRed   = Color.Rgb(0xcc, 0x00, 0x00);
                var bikesNum  = int.Parse(splitNumbers [0]);
                var slotsNum  = int.Parse(splitNumbers [1]);
                var total     = bikesNum + slotsNum;
                var distance  = GeoUtils.Distance(
                    new GeoPoint {
                    Lat = marker.Position.Latitude, Lon = marker.Position.Longitude
                },
                    new GeoPoint {
                    Lat = map.MyLocation.Latitude, Lon = map.MyLocation.Longitude
                }
                    ) * 1000;
                var bikesColor = PinFactory.InterpolateColor(baseRed, baseGreen,
                                                             ((float)bikesNum) / total);
                var slotsColor = PinFactory.InterpolateColor(baseRed, baseGreen,
                                                             ((float)slotsNum) / total);
                ipBikes.SetTextColor(bikesColor);
                ipSlots.SetTextColor(slotsColor);

                DrawableCompat.SetTint(bikeDrawable,
                                       bikesColor.ToArgb());
                DrawableCompat.SetTint(rackDrawable,
                                       slotsColor.ToArgb());
                ipDistance.Text = GeoUtils.GetDisplayDistance(distance)
                                  + " " + GeoUtils.GetUnitForDistance(distance);

                ipDistance.Visibility = ViewStates.Visible;
                ipBikes.Visibility    = ViewStates.Visible;
                ipSlots.Visibility    = ViewStates.Visible;
                ipBikesImg.Visibility = ViewStates.Visible;
                ipSlotsImg.Visibility = ViewStates.Visible;
            }
            else
            {
                ipDistance.Visibility = ViewStates.Gone;
                ipBikes.Visibility    = ViewStates.Invisible;
                ipSlots.Visibility    = ViewStates.Invisible;
                ipBikesImg.Visibility = ViewStates.Invisible;
                ipSlotsImg.Visibility = ViewStates.Invisible;
            }

            var  favs      = favManager.LastFavorites ?? favManager.GetFavoriteStationIds();
            bool activated = favs.Contains(currentShownID);

            fab.Checked = activated;
            fab.JumpDrawablesToCurrentState();

            if (streetPanorama != null)
            {
                streetPanorama.SetPosition(marker.Position);
            }

            LoadStationHistory(currentShownID);

            pane.SetState(InfoPane.State.Opened);
        }
Ejemplo n.º 5
0
		public override void OnActivityCreated (Bundle savedInstanceState)
		{
			base.OnActivityCreated (savedInstanceState);

			var context = Activity;
			this.pinFactory = new PinFactory (context);
			this.favManager = FavoriteManager.Obtain (context);
		}