protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_route_details);

            if (Android.OS.Build.VERSION.SdkInt >= Android.OS.BuildVersionCodes.Lollipop)
            {
                Window.AddFlags(WindowManagerFlags.DrawsSystemBarBackgrounds);
            }

            var toolbar = (Toolbar)FindViewById(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);

            var    extras  = Intent.Extras;
            string routeId = extras.GetString(KEY_ROUTE_ID);

            route      = RouteManager.GetRoute(routeId);
            gpsTracker = ExtendedLocationListener.GetInstance();
            gpsTracker.EnableLocationUpdates();
            gpsTracker.EnableCheckForExhibits();
            gpsTracker.SetContext(this);

            if (route != null)
            {
                // getting location

                currentUserLocation = new GeoPoint(gpsTracker.Latitude, gpsTracker.Longitude);


                Title = route.Title;
                InitRouteInfo();
                InitMap();

                AddStartPointOnMap();
                AddViaPointsOnMap();
                AddFinalPointOnMap();

                DrawPathOnMap();

                map.OverlayManager.Add(mapMarkerItemizedOverlay);
            }
            else
            {
                Toast.MakeText(this, Resource.String.empty_route, ToastLength.Short).Show();
            }

            Button button = (Button)this.FindViewById(Resource.Id.routeDetailsStartNavigationButton);

            button.Click += (sender, args) => {
                Intent intent = new Intent(this, typeof(RouteNavigationActivity));
                intent.PutExtra(RouteNavigationActivity.IntentRoute, route.Id);
                StartActivity(intent);
            };

            View view = this.FindViewById(Resource.Id.routedetails_mapview);

            view.ViewTreeObserver.AddOnGlobalLayoutListener(new MapViewGlobalLayoutListener(this));
        }
Beispiel #2
0
 private void InitializeExtendedLocationListener()
 {
     extendedLocationListener = ExtendedLocationListener.GetInstance();
     extendedLocationListener.SetContext(this);
     extendedLocationListener.EnableCheckForExhibits();
     extendedLocationListener.EnableLocationUpdates();
     extendedLocationListener.SetExtendedLocationListenerAdapter(this);
 }
        protected override void OnResume()
        {
            base.OnResume();
            gpsTracker = ExtendedLocationListener.GetInstance();
            gpsTracker.SetContext(this);
            gpsTracker.EnableCheckForExhibits();
            gpsTracker.EnableLocationUpdates();

            if (gpsTracker.CanGetLocation)
            {
                currentUserLocation = new GeoPoint(
                    gpsTracker.Latitude, gpsTracker.Longitude);
            }
        }
Beispiel #4
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_splash_screen);

            textAction  = (TextView)FindViewById(Resource.Id.splashScreenActionText);
            textWaiting = (TextView)FindViewById(Resource.Id.splashScreenWaitingText);

            textAction.SetText(Resource.String.splash_screen_loading);
            textWaiting.SetText(Resource.String.splash_screen_waiting);

            ThreadPool.QueueUserWorkItem(state => {
                // setup IoCManager
                IoCManager.UnityContainer.RegisterType <IDataAccess, RealmDataAccess> ();
                IoCManager.UnityContainer.RegisterType <IDataLoader, EmbeddedResourceDataLoader> ();
                IoCManager.UnityContainer.RegisterType <IImageDimension, AndroidImageDimension> ();
                //IoCManager.UnityContainer.RegisterInstance (typeof(IDataLoader), new AndroidDataLoader (Assets));
                var calculator = RouteCalculator.Instance;
                // setup KeyManager
                KeyManager.Instance.RegisterProvider(new AndroidKeyProvider());

                DbManager.UpdateDatabase();

                action = StartMainActivity;

                //setup the ExtendedLocationListener by calling it once
                var extendedLocationListener = ExtendedLocationListener.GetInstance();
                extendedLocationListener.SetContext(this);
                extendedLocationListener.Initialize(GetSystemService(LocationService) as LocationManager);
                extendedLocationListener.Unregister();                                //the listener should just be created here, but not used

                RunOnUiThread(() => {
                    var handler = new Handler();
                    handler.PostDelayed(action, StartupDelay);
                });
            });
        }
Beispiel #5
0
        public override Dialog OnCreateDialog(Bundle savedInstanceState)
        {
            if (savedInstanceState != null)
            {
                e = ExhibitManager.GetExhibit(savedInstanceState.GetString(Data));
            }


            var alert = new AlertDialog.Builder(Activity);

            alert.SetTitle(Resources.GetString(Resource.String.exhibit_is__near_title));
            alert.SetMessage($"{Activity.Resources.GetString (Resource.String.exhibit_is_near1)} \"{e.Name}\" {Activity.Resources.GetString (Resource.String.exhibit_is_near2)}");
            alert.SetPositiveButton(Resource.String.exhibit_open_yes, (senderAlert, args) => {
                var intent   = new Intent(Activity, typeof(ExhibitDetailsActivity));
                var pageList = e.Pages;
                if ((pageList == null) || !pageList.Any())
                {
                    Toast.MakeText(Activity,
                                   Activity.GetString(Resource.String.currently_no_further_info),
                                   ToastLength.Short).Show();
                }
                else
                {
                    intent.PutExtra(ExhibitDetailsActivity.INTENT_EXTRA_EXHIBIT_ID, e.Id);
                    Activity.StartActivity(intent);
                }
            });

            alert.SetNegativeButton(Resource.String.exhibit_open_no, (senderAlert, args) => { ExtendedLocationListener.GetInstance().EnableCheckForExhibits(); });

            return(alert.Create());
        }