void HandlePaneStateChanged (InfoPane.State state)
		{
			var time = Resources.GetInteger (Android.Resource.Integer.ConfigShortAnimTime);
			var enabled = state != InfoPane.State.FullyOpened;
			mapFragment.Map.UiSettings.ScrollGesturesEnabled = enabled;
			mapFragment.Map.UiSettings.ZoomGesturesEnabled = enabled;
			if (state == InfoPane.State.FullyOpened && currentShownMarker != null) {
				oldPosition = mapFragment.Map.CameraPosition;
				var destX = mapFragment.Width / 2;
				var destY = (mapFragment.Height - pane.Height) / 2;
				var currentPoint = mapFragment.Map.Projection.ToScreenLocation (currentShownMarker.Position);
				var scroll = CameraUpdateFactory.ScrollBy (- destX + currentPoint.X, - destY + currentPoint.Y);
				mapFragment.Map.AnimateCamera (scroll, time, null);
			} else if (oldPosition != null) {
				mapFragment.Map.AnimateCamera (CameraUpdateFactory.NewCameraPosition (oldPosition), time, null);
				oldPosition = null;
			}
		}
 void SetupInfoPane(View view)
 {
     pane = view.FindViewById <InfoPane> (Resource.Id.infoPane);
     pane.StateChanged += HandlePaneStateChanged;
     view.ViewTreeObserver.AddOnGlobalLayoutListener(this);
 }
		void SetupInfoPane (View view)
		{
			pane = view.FindViewById<InfoPane> (Resource.Id.infoPane);
			pane.StateChanged += HandlePaneStateChanged;
			view.ViewTreeObserver.AddOnGlobalLayoutListener (this);
		}
Exemple #4
0
		public override View OnCreateView (LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
		{
			var view = inflater.Inflate (Resource.Layout.MapLayout, container, false);
			mapFragment = view.FindViewById<MapView> (Resource.Id.map);
			mapFragment.OnCreate (savedInstanceState);
			lastUpdateText = view.FindViewById<TextView> (Resource.Id.UpdateTimeText);
			pane = view.FindViewById<InfoPane> (Resource.Id.infoPane);
			pane.StateChanged += HandlePaneStateChanged;
			view.ViewTreeObserver.AddOnGlobalLayoutListener (this);
			flashBar = new FlashBarController (view);
			return view;
		}