コード例 #1
0
        private void TryChangeViewPresentation(ChangePresentationHint hint)
        {
            var homeView = Activity as IChangePresentation;

            if (homeView != null)
            {
                homeView.ChangePresentation(hint);
            }
            else
            {
                MvxTrace.Warning("Can't change home view state, keeping last presentation hint");
            }
        }
コード例 #2
0
        private void TryChangeViewPresentation(ChangePresentationHint hint)
        {
            var view = CurrentTopViewController as IChangePresentation;

            if (view != null)
            {
                view.ChangePresentation(hint);
                foreach (var subview in CurrentTopViewController.View.FindSubviewsOfType <IChangePresentation>())
                {
                    subview.ChangePresentation(hint);
                }
            }
            else
            {
                Mvx.Warning("Can't change presentation, view controller doesn't support IChangePresentation");
            }
        }
コード例 #3
0
        public void ChangePresentation(ChangePresentationHint hint)
        {
            var streetLevelZoomHint = hint as ZoomToStreetLevelPresentationHint;

            if (streetLevelZoomHint != null)
            {
                // When doing this presentation change, we don't want to reverse geocode the position since we already know the address and it's already set
                // It occurs on Android only, because of a Camera Change event
                _bypassCameraChangeEvent = true;
                var zoomLevel = streetLevelZoomHint.InitialZoom
                    ? _settings.InitialZoomLevel
                    : MapViewModel.ZoomStreetLevel;

                if (_settings.DisableAutomaticZoomOnLocation && !streetLevelZoomHint.InitialZoom)
                {
                    MoveCameraTo(streetLevelZoomHint.Latitude, streetLevelZoomHint.Longitude);
                }
                else
                {
                    MoveCameraTo(streetLevelZoomHint.Latitude, streetLevelZoomHint.Longitude, zoomLevel + 1);
                }
            }

            var zoomHint = hint as ChangeZoomPresentationHint;

            if (zoomHint != null)
            {
                var newBounds     = zoomHint.Bounds;
                var currentBounds = GetMapBoundsFromProjection();

                if (Math.Abs(currentBounds.LongitudeDelta) <= Math.Abs(newBounds.LongitudeDelta))
                {
                    // add a negative padding to counterbalance the map padding done for the "Google" legal logo on the map
                    Map.AnimateCamera(CameraUpdateFactory.NewLatLngBounds(GetRegionFromMapBounds(newBounds), -MapPadding.ToPixels()));
                }
            }

            var centerHint = hint as CenterMapPresentationHint;

            if (centerHint != null)
            {
                MoveCameraTo(centerHint.Latitude, centerHint.Longitude);
            }
        }
コード例 #4
0
        public void ChangePresentation(ChangePresentationHint hint)
        {
            var streetLevelZoomHint = hint as ZoomToStreetLevelPresentationHint;

            if (streetLevelZoomHint != null)
            {
                // When doing this presentation change, we don't want to reverse geocode the position since we already know the address and it's already set
                // It occurs on Android only, because of a Camera Change event
                _bypassCameraChangeEvent = true;
                var zoomLevel = streetLevelZoomHint.InitialZoom
                    ? _settings.InitialZoomLevel
                    : MapViewModel.ZoomStreetLevel;

                if (_settings.DisableAutomaticZoomOnLocation && !streetLevelZoomHint.InitialZoom)
                {
                    MoveCameraTo(streetLevelZoomHint.Latitude, streetLevelZoomHint.Longitude);
                }
                else
                {
                    MoveCameraTo(streetLevelZoomHint.Latitude, streetLevelZoomHint.Longitude, zoomLevel + 1);
                }
            }

            var zoomHint = hint as ChangeZoomPresentationHint;

            if (zoomHint != null)
            {
                var newBounds     = zoomHint.Bounds;
                var currentBounds = GetMapBoundsFromProjection();

                if (Math.Abs(currentBounds.LongitudeDelta) <= Math.Abs(newBounds.LongitudeDelta))
                {
                    Map.SetCenterCoordinate(GetRegionFromMapBounds(newBounds).Center, true);
                }
            }

            var centerHint = hint as CenterMapPresentationHint;

            if (centerHint != null)
            {
                MoveCameraTo(centerHint.Latitude, centerHint.Longitude);
            }
        }
コード例 #5
0
        public void ChangePresentation(ChangePresentationHint hint)
        {
            var streetLevelZoomHint = hint as ZoomToStreetLevelPresentationHint;

            if (streetLevelZoomHint != null)
            {
                var zoomLevel = streetLevelZoomHint.InitialZoom
                    ? this.Services().Settings.InitialZoomLevel
                    : MapViewModel.ZoomStreetLevel;

                if (this.Services().Settings.DisableAutomaticZoomOnLocation&& !streetLevelZoomHint.InitialZoom)
                {
                    SetCenterCoordinate(new CLLocationCoordinate2D(streetLevelZoomHint.Latitude, streetLevelZoomHint.Longitude), true);
                }
                else
                {
                    this.SetCenterCoordinate(new CLLocationCoordinate2D(streetLevelZoomHint.Latitude, streetLevelZoomHint.Longitude), zoomLevel, true);
                }
            }

            var zoomHint = hint as ChangeZoomPresentationHint;

            if (zoomHint != null)
            {
                var newBounds     = zoomHint.Bounds;
                var currentBounds = GetMapBoundsFromProjection();

                if (Math.Abs(currentBounds.LongitudeDelta) <= Math.Abs(newBounds.LongitudeDelta))
                {
                    SetRegion(GetRegionFromMapBounds(newBounds), true);
                }
            }

            var centerHint = hint as CenterMapPresentationHint;

            if (centerHint != null)
            {
                // Set the new region center, but keep current span
                SetRegion(new MKCoordinateRegion(new CLLocationCoordinate2D(centerHint.Latitude, centerHint.Longitude), Region.Span), true);
            }
        }
コード例 #6
0
 public void ChangePresentation(ChangePresentationHint hint)
 {
     MapFragment.ChangePresentation(hint);
 }
コード例 #7
0
 public void ChangePresentation(ChangePresentationHint hint)
 {
     mapView.ChangePresentation(hint);
 }