Пример #1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            settingsFab = FindViewById <FloatingActionButton>(Resource.Id.settingsFab);
            cardCore    = FindViewById <CardView>(Resource.Id.cardCore);
            cardUI      = FindViewById <CardView>(Resource.Id.cardUI);

            // Check for location permission
            permissionsManager = new PermissionsManager(this);
            if (!PermissionsManager.AreLocationPermissionsGranted(this))
            {
                permissionsManager.RequestLocationPermissions(this);
            }
            else
            {
                RequestPermissionsIfNotGranted(Android.Manifest.Permission.WriteExternalStorage);
            }

            settingsFab.Click += (s, e) =>
            {
                StartActivityForResult(new Intent(this,
                                                  typeof(NavigationSettingsActivity)),
                                       CHANGE_SETTING_REQUEST_CODE);
            };
            //cardCore.Click += (s, e) => StartActivity(new Intent(this, typeof(CoreActivity)));
            //cardUI.Click += (s, e) => StartActivity(new Intent(this, typeof(UIActivity)));
        }
 private void MostrarUbicacionTiempoReal()
 {
     if (PermissionsManager.AreLocationPermissionsGranted(this))
     {
         LocationComponent locationComponent = mapboxMap.LocationComponent;
         locationComponent.ActivateLocationComponent(LocationComponentActivationOptions.InvokeBuilder(this, this.style).Build());
         locationComponent.LocationComponentEnabled = true;
         locationComponent.SetCameraMode(CameraMode.TRACKING, this);
         locationComponent.RenderMode = RenderMode.COMPASS;
     }
 }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            string mapboxAccessToken = Utils.GetMapboxAccessToken(ApplicationContext);

            if (string.IsNullOrWhiteSpace(mapboxAccessToken) || string.Equals(mapboxAccessToken, "YOUR_MAPBOX_ACCESS_TOKEN"))
            {
                throw new InvalidOperationException("Please configure your Mapbox access token");
            }

            Mapbox.GetInstance(ApplicationContext, mapboxAccessToken);

            var samples = new[]
            {
                new SampleItem {
                    Name         = GetString(Resource.String.title_navigation_view_ui),
                    Description  = GetString(Resource.String.description_navigation_view_ui),
                    ActivityType = typeof(NavigationViewActivity)
                },
                new SampleItem
                {
                    Name         = GetString(Resource.String.title_mock_navigation),
                    Description  = GetString(Resource.String.description_mock_navigation),
                    ActivityType = typeof(MockNavigationActivity)
                },
                new SampleItem {
                    Name         = GetString(Resource.String.title_reroute),
                    Description  = GetString(Resource.String.description_reroute),
                    ActivityType = typeof(RerouteActivity)
                },
                new SampleItem {
                    Name         = GetString(Resource.String.title_navigation_route_ui),
                    Description  = GetString(Resource.String.description_navigation_route_ui),
                    ActivityType = typeof(NavigationMapRouteActivity)
                },
                new SampleItem {
                    Name         = GetString(Resource.String.title_waypoint_navigation),
                    Description  = GetString(Resource.String.description_waypoint_navigation),
                    ActivityType = typeof(WaypointNavigationActivity)
                },
                new SampleItem {
                    Name         = "MockNavigation - OptimizedTrips API",
                    Description  = "MockNavigation - OptimizedTrips API",
                    ActivityType = typeof(OptimizedTripsNavigationActivity)
                }
            };

            // RecyclerView
            recyclerView = FindViewById <RecyclerView>(Resource.Id.recycler_view);
            recyclerView.HasFixedSize = true;

            // Use a linear layout manager
            RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
            recyclerView.SetLayoutManager(layoutManager);

            // Specify an adapter
            RecyclerView.Adapter adapter = new MainAdapter(samples, recyclerView);
            recyclerView.SetAdapter(adapter);

            // Check for location permission
            permissionsManager = new PermissionsManager(this);
            if (!PermissionsManager.AreLocationPermissionsGranted(this))
            {
                recyclerView.Enabled = (false);
                permissionsManager.RequestLocationPermissions(this);
            }
        }
Пример #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            List <SampleItem> sampleItems = new List <SampleItem>
            {
                new SampleItem(
                    GetString(Resource.String.title_navigation_launcher),
                    GetString(Resource.String.description_navigation_launcher),
                    typeof(NavigationLauncherActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_end_navigation),
                    GetString(Resource.String.description_end_navigation),
                    typeof(EndNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_dual_navigation_map),
                    GetString(Resource.String.description_dual_navigation_map),
                    typeof(DualNavigationMapActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_mock_navigation),
                    GetString(Resource.String.description_mock_navigation),
                    typeof(MockNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_reroute),
                    GetString(Resource.String.description_reroute),
                    typeof(RerouteActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_navigation_route_ui),
                    GetString(Resource.String.description_navigation_route_ui),
                    typeof(NavigationMapRouteActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_waypoint_navigation),
                    GetString(Resource.String.description_waypoint_navigation),
                    typeof(WaypointNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_embedded_navigation),
                    GetString(Resource.String.description_embedded_navigation),
                    typeof(EmbeddedNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_fragment_navigation),
                    GetString(Resource.String.description_fragment_navigation),
                    typeof(FragmentNavigationActivity)
                    ),
                new SampleItem(
                    GetString(Resource.String.title_component_navigation),
                    GetString(Resource.String.description_component_navigation),
                    typeof(ComponentNavigationActivity)
                    ),
            };

            // RecyclerView
            recyclerView = FindViewById <RecyclerView>(Resource.Id.recycler_view);
            recyclerView.HasFixedSize = true;

            // Use a linear layout manager
            RecyclerView.LayoutManager layoutManager = new LinearLayoutManager(this);
            recyclerView.SetLayoutManager(layoutManager);

            // Specify an adapter
            RecyclerView.Adapter adapter = new MainAdapter(recyclerView, sampleItems);
            recyclerView.SetAdapter(adapter);

            // Check for location permission
            permissionsManager = new PermissionsManager(this);
            if (!PermissionsManager.AreLocationPermissionsGranted(this))
            {
                recyclerView.Visibility = ViewStates.Invisible;
                permissionsManager.RequestLocationPermissions(this);
            }
            else
            {
                RequestPermissionsIfNotGranted(Android.Manifest.Permission.WriteExternalStorage);
            }
        }