Ejemplo n.º 1
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            var ignored = base.OnCreateView(inflater, container, savedInstanceState);

            var view = this.BindingInflate(Resource.Layout.fragment_map_view, null);

            var mapOptions = new GoogleMapOptions()
                             .InvokeTiltGesturesEnabled(false)
                             .InvokeCompassEnabled(true)
                             .InvokeRotateGesturesEnabled(true)
                             .InvokeUseViewLifecycleInFragment(false)
                             .InvokeZoomControlsEnabled(true)
                             .InvokeZoomGesturesEnabled(true)
                             .InvokeZOrderOnTop(true)
                             .InvokeCamera(new CameraPosition(new LatLng(54.180109f, 45.177947f), 14.0f, 0, 0));

            _mapFragment = MapFragment.NewInstance(mapOptions);
            var transaction = this.FragmentManager.BeginTransaction();

            transaction.Add(Resource.Id.content_frame, _mapFragment);
            transaction.Commit();

            _mapFragment.GetMapAsync(this);

            return(view);
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Initiates a map fragment
        /// </summary>
        private void InitMapFragment()
        {
            _locationManager = (LocationManager)GetSystemService(LocationService);

            Criteria criteriaForLocationService = new Criteria
            {
                Accuracy = Accuracy.Fine
            };
            IList <string> acceptableLocationProviders = _locationManager.GetProviders(criteriaForLocationService, true);

            if (acceptableLocationProviders.Any())
            {
                _locationProvider = acceptableLocationProviders.First();
            }
            else
            {
                _locationProvider = string.Empty;
            }

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeCompassEnabled(true);

                Android.App.FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.MapFragment, _mapFragment, "map");
                fragTx.Commit();
            }
        }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Map);

            var NavService = (NavigationService)SimpleIoc.Default.GetInstance <INavigationService>();
            var data       = NavService.GetAndRemoveParameter <List <double> >(Intent);

            if (data != null)
            {
                _mapFragment = FragmentManager.FindFragmentByTag("mapView") as MapFragment;
                if (_mapFragment == null)
                {
                    GoogleMapOptions mapOptions = new GoogleMapOptions()
                                                  .InvokeMapType(GoogleMap.MapTypeSatellite)
                                                  .InvokeZoomControlsEnabled(false)
                                                  .InvokeCompassEnabled(true);

                    FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                    _mapFragment = MapFragment.NewInstance(mapOptions);
                    fragTx.Add(Resource.Id.mapView, _mapFragment, "mapView");
                    fragTx.Commit();
                }
                _mapFragment.GetMapAsync(this);


                ViewModel.Latitude  = data[0];
                ViewModel.Longitude = data[1];
            }

            CreateButtonBinding();
        }
Ejemplo n.º 4
0
        public void OnMapReady(GoogleMap map)
        {
            var mapOptions = new GoogleMapOptions()
                             .InvokeMapType(GoogleMap.MapTypeNormal)
                             .InvokeZoomControlsEnabled(false)
                             .InvokeCompassEnabled(true);

            var fragTx = FragmentManager.BeginTransaction();

            _mapFragment = MapFragment.NewInstance(mapOptions);
            fragTx.Add(Resource.Id.map_fragment_container, _mapFragment, "map");
            fragTx.Commit();

            var recordCoordinates = ViewModel?.Record?.geometry?.coordinates;
            var latitude          = recordCoordinates?[1];
            var longitude         = recordCoordinates?[0];

            var location = new LatLng(latitude ?? 0, longitude ?? 0);
            var builder  = CameraPosition.InvokeBuilder();

            builder.Target(location);
            builder.Zoom(18);

            var cameraPosition = builder.Build();
            var cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            map.MoveCamera(cameraUpdate);

            var markerOpt1 = new MarkerOptions();

            markerOpt1.SetPosition(location);
            markerOpt1.SetTitle(ViewModel?.Record?.fields?.nom_du_cafe ?? string.Empty);
            map.AddMarker(markerOpt1);
        }
Ejemplo n.º 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            SetContentView(Resource.Layout.item1);
            Button reg = FindViewById <Button>(Resource.Id.button3);

            reg.Click += (sender, e) =>
            {
                var intent = new Intent(this, typeof(Register));
                StartActivity(intent);
            };

            /*GoogleMapOptions mapOptions = new GoogleMapOptions()
             *   .InvokeMapType(GoogleMap.MapTypeNormal)
             *   .InvokeZoomControlsEnabled(false)
             *   .InvokeCompassEnabled(true);*/

            var mapFrag = MapFragment.NewInstance(); // MapOptions

            FragmentManager.BeginTransaction()
            .Add(Resource.Id.mapFragContainer, mapFrag, "map_fragment")
            .Commit();

            //var mapFragement = (MapFragment)FragemenrManager.FindFragementById(Resource.Id.mapfrag);
            mapFrag.GetMapAsync(this);
        }
        public override Android.Views.View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            var view = inflater.Inflate(Resource.Layout.DirectionMapLayout, container, false);

            Xamarin.Essentials.Platform.Init(this.Activity, savedInstanceState);

            //Initializing UI component
            GetDirection  = view.FindViewById <Button>(Resource.Id.getdirection);
            startLocation = view.FindViewById <TextView>(Resource.Id.materialTextView1);
            endLocation   = view.FindViewById <TextView>(Resource.Id.materialTextView2);
            radioStart    = view.FindViewById <RadioButton>(Resource.Id.radioButton1);
            radioEnd      = view.FindViewById <RadioButton>(Resource.Id.radioButton2);
            pin           = view.FindViewById <Button>(Resource.Id.pinid);

            //Initializing Click events
            startLocation.Click += StartLocation_Click;
            endLocation.Click   += EndLocation_Click;
            radioStart.Click    += RadioStart_Click;
            radioEnd.Click      += RadioEnd_Click;
            GetDirection.Click  += GetDirection_Click;

            //Setting up Map
            mapFragment = MapFragment.NewInstance();
            var ft = this.Activity.FragmentManager.BeginTransaction();

            ft.Add(Resource.Id.map_placeholder, mapFragment).CommitAllowingStateLoss();
            mapFragment.GetMapAsync(this);



            return(view);
        }
Ejemplo n.º 7
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Map);
            var mapFrag = MapFragment.NewInstance();

            FragmentManager.BeginTransaction()
            .Add(Resource.Id.map, mapFrag, "map_fragment")
            .Commit();

            // Create your application here
            // MapFragment mapFragment = (MapFragment)FragmentManager.FindFragmentById(Resource.Id.map);
            mapFrag.GetMapAsync(this);

            database = new DataBaseClass();
            mDepozit = new JavaList <Depozit>();

            foreach (Depozit d in database.getAllDepozite())
            {
                mDepozit.Add(d);
            }

            btnNormal    = FindViewById <Button>(Resource.Id.btnNormal);
            btnHybrid    = FindViewById <Button>(Resource.Id.btnHybrid);
            btnSatellite = FindViewById <Button>(Resource.Id.btnSatellite);
            btnTerrain   = FindViewById <Button>(Resource.Id.btnTerrain);

            btnNormal.Click    += BtnNormal_Click;
            btnHybrid.Click    += BtnHybrid_Click;
            btnSatellite.Click += BtnSatellite_Click;
            btnTerrain.Click   += BtnTerrain_Click;
        }
Ejemplo n.º 8
0
        public void OnMapReady(GoogleMap map)
        {
            var mapOptions = new GoogleMapOptions()
                             .InvokeMapType(GoogleMap.MapTypeNormal)
                             .InvokeZoomControlsEnabled(false)
                             .InvokeCompassEnabled(true);

            var fragTx = FragmentManager.BeginTransaction();

            _mapFragment = MapFragment.NewInstance(mapOptions);
            fragTx.Add(Resource.Id.map_fragment_container, _mapFragment, "map");
            fragTx.Commit();

            var location = new LatLng(ViewModel.Latitude ?? 0, ViewModel.Longitude ?? 0);
            var builder  = CameraPosition.InvokeBuilder();

            builder.Target(location);
            builder.Zoom(18);

            var cameraPosition = builder.Build();
            var cameraUpdate   = CameraUpdateFactory.NewCameraPosition(cameraPosition);

            map.MoveCamera(cameraUpdate);

            var markerOpt1 = new MarkerOptions();

            markerOpt1.SetPosition(location);
            markerOpt1.SetTitle(ViewModel.Title);
            map.AddMarker(markerOpt1);
        }
Ejemplo n.º 9
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            //this.OverridePendingTransition(Resource.Animation.SlideInRight, Resource.Animation.SlideOutLeft);
            this.Window.AddFlags(WindowManagerFlags.Fullscreen);

            /*ActionBar.SetDisplayHomeAsUpEnabled(false);
            *  ActionBar.SetDisplayShowHomeEnabled(false);*/

            var par = (RelativeLayout.LayoutParams)_btnClose.LayoutParameters;

            par.AddRule(LayoutRules.AlignParentRight, 0);
            par.AddRule(LayoutRules.AlignParentLeft);

            _btnClose.LayoutParameters = par;

            _Mappa = JsonConvert.DeserializeObject <Mappa>(Intent.GetStringExtra("mappa"));           //(Mappa)ActivitiesBringe.GetObject();

            _MapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_MapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _MapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(_contentView.Id, _MapFragment, "map");
                fragTx.Commit();
            }

            SetupMapIfNeeded();
        }
        private void InitMapFragment()
        {
            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeSatellite)
                                              .InvokeCompassEnabled(true)
                                              //.InvokeRotateGesturesEnabled(true)
                                              //.InvokeTiltGesturesEnabled(true)
                                              //.InvokeMapToolbarEnabled(true)
                                              //.InvokeZOrderOnTop(true)
                                              //.InvokeZoomGesturesEnabled(true)
                                              //.InvokeLiteMode(true)
                                              //.InvokeAmbientEnabled(true)
                                              .InvokeMapToolbarEnabled(true)
                                              .InvokeZoomControlsEnabled(false);


                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }
            _mapFragment.GetMapAsync(this);
        }
Ejemplo n.º 11
0
        private void SetUpMap()
        {
            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeHybrid)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();

                var mapReadyCallback = new MyOnMapReady();
                mapReadyCallback.MapReady += (sender, args) =>
                {
                    _gettingMap = false;
                    _map        = ((MyOnMapReady)sender).Map;

                    MoveCamera();
                };

                _gettingMap = true;

                _mapFragment.GetMapAsync(mapReadyCallback);
            }
        }
Ejemplo n.º 12
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            SetContentView(Resource.Layout.update_layout);
            base.OnCreate(savedInstanceState);

            fname  = FindViewById <EditText>(Resource.Id.txt_first_name_up);
            lname  = FindViewById <EditText>(Resource.Id.txt_last_name_up);
            Phnum  = FindViewById <EditText>(Resource.Id.txt_phone_number_up);
            Adress = FindViewById <EditText>(Resource.Id.txt_address_up);
            Ctr    = FindViewById <EditText>(Resource.Id.txt_country_up);
            Mail   = FindViewById <EditText>(Resource.Id.txt_email_address_up);

            //Get Api
            string url            = "https://10.0.2.2:5001/api/Users/1";
            string result         = "";
            var    httpWebRequest = new HttpWebRequest(new Uri(url));

            httpWebRequest.ServerCertificateValidationCallback = delegate { return(true); };
            httpWebRequest.ContentType = "application/json";
            httpWebRequest.Method      = "Get";

            HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();

            using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
            {
                result = reader.ReadToEnd();
            }

            User user = new User();

            user = Newtonsoft.Json.JsonConvert.DeserializeObject <User>(result);

            fname.Text  = user.FirstName;
            lname.Text  = user.LastName;
            Phnum.Text  = user.PhoneNumber;
            Adress.Text = user.Address;
            Ctr.Text    = user.Country;
            Mail.Text   = user.EmailAddress;

            Button btn_Share = FindViewById <Button>(Resource.Id.btn_share);

            btn_Share.Click += Btn_Share_Click;

            Button btn_Send = FindViewById <Button>(Resource.Id.btn_send);

            btn_Send.Click += Btn_Send_Click;

            Button btn_connect = FindViewById <Button>(Resource.Id.btn_connection);

            btn_connect.Click += Btn_connect_Click;

            //Map
            var mapFrag = MapFragment.NewInstance();// mapOptions);

            FragmentManager.BeginTransaction()
            .Add(Resource.Id.map_Fragtag, mapFrag, "map_fragment")
            .Commit();

            mapFrag.GetMapAsync(this);
        }
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            View v = inflater.Inflate(Resource.Layout.fragment_agencydetail, container, false);

            TextView Name        = v.FindViewById <TextView>(Resource.Id.Aname);
            TextView Phonenumber = v.FindViewById <TextView>(Resource.Id.APhonenumber);
            TextView AEmail      = v.FindViewById <TextView>(Resource.Id.Aemail);
            TextView Alocation   = v.FindViewById <TextView>(Resource.Id.Alocation);

            Name.Text        = agencies[0].agencyname;
            Phonenumber.Text = agencies[0].agencyphonenumber;
            AEmail.Text      = agencies[0].agencyemail;
            Alocation.Text   = agencies[0].agencylocation;


            var mapFrag = MapFragment.NewInstance();

            ChildFragmentManager.BeginTransaction()
            .Add(Resource.Id.mapAFrgContainer, mapFrag, "map")
            .Commit();

            mapFrag.GetMapAsync(this);


            Button btnShare = v.FindViewById <Button>(Resource.Id.btnAShare);
            Button btnSMS   = v.FindViewById <Button>(Resource.Id.btnASMS);
            Button btnShow  = v.FindViewById <Button>(Resource.Id.btnAShow);

            btnShare.Click += BtnShare_Click;
            btnSMS.Click   += BtnSMS_Click;
            btnShow.Click  += BtnShow_Click;

            return(v);
        }
Ejemplo n.º 14
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.LocationSelector);

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;

            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions().InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeCompassEnabled(true);

                var fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.AddToBackStack("LocationSelectorMap");
                fragTx.Commit();
            }

            _mapFragment.GetMapAsync(this);

            _locationManager = GetSystemService(LocationService) as LocationManager;

            _saveButton = (Button)FindViewById(Resource.Id.saveButton);
            _saveButton.BringToFront();

            _saveButton.Click += delegate(object sender, EventArgs e) {
                this.ChargingLocation = _marker.Position;
                this.Finish();
            };
        }
Ejemplo n.º 15
0
        //Marker _firstMarker;
        //Marker _secondMarker;
        //Marker _thirdMarker;

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

            _pDialog = new ProgressDialog(this);
            _pDialog.Indeterminate = true;
            _pDialog.SetProgressStyle(ProgressDialogStyle.Spinner);
            _pDialog.SetMessage("Chargement...");
            _pDialog.SetCancelable(true);
            _pDialog.Show();

            _locationManager = GetSystemService(Context.LocationService) as LocationManager;

            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeSatellite)
                                              .InvokeZoomControlsEnabled(false)
                                              .InvokeCompassEnabled(true);

                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }
            _mapFragment.GetMapAsync(this);
        }
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            // Create your application here

            SetContentView(Resource.Layout.Locations);
            //initializing components
            set_location = FindViewById <Button>(Resource.Id.btn_set_1);
            //srch_button = FindViewById<Button>(Resource.Id.btn_srch_1);
            //srch_text = FindViewById<EditText>(Resource.Id.search_text);
            loader = FindViewById <LoadingView>(Resource.Id.loading_view);


            Xamarin.Essentials.Platform.Init(this, savedInstanceState);
            map1 = MapFragment.NewInstance();
            var ft = FragmentManager.BeginTransaction();

            ft.Add(Resource.Id.map_placeholder, map1).Commit();
            map1.GetMapAsync(this);

            imgsearchicon = (Button)FindViewById(Resource.Id.btnsearchimg);



            //setting on click events
            set_location.Click  += Set_location_Click;
            imgsearchicon.Click += Imgsearchicon_Click;
        }
Ejemplo n.º 17
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            Toolbar toolbar = FindViewById <Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(toolbar);

            _backButton    = FindViewById(Resource.Id.button_back);
            _confirmButton = toolbar.FindViewById(Resource.Id.button_confirm);
            _loader        = FindViewById(Resource.Id.loader);
            _location      = FindViewById <AppCompatAutoCompleteTextView>(Resource.Id.edit_search);

            GoogleMapOptions mapOptions = new GoogleMapOptions()
                                          .InvokeMapType(GoogleMap.MapTypeSatellite)
                                          .InvokeZoomControlsEnabled(false)
                                          .InvokeCompassEnabled(true);

            FragmentTransaction fragTx = FragmentManager.BeginTransaction();

            _mapFragment = MapFragment.NewInstance(mapOptions);
            fragTx.Add(Resource.Id.fragment_map, _mapFragment, "map");
            fragTx.Commit();
            _mapFragment.GetMapAsync(this);

            toolbar.FindViewById <TextView>(Resource.Id.title).Text = AppResources.Location;
            (_confirmButton as TextView).Text = AppResources.Ok;
        }
Ejemplo n.º 18
0
        public static MapFragment AddMapFragmentToLayout(this AppCompatActivity activity, int resourceId, string tag = "map_frag",
                                                         IOnMapReadyCallback onMapReadyCallback = null)
        {
            var options = new GoogleMapOptions();

            options.InvokeMapType(GoogleMap.MapTypeHybrid)
            .InvokeCompassEnabled(true);

            var mapFrag = MapFragment.NewInstance(options);

            activity.FragmentManager.BeginTransaction()
            .Add(resourceId, mapFrag, tag)
            .Commit();

            if (onMapReadyCallback == null)
            {
                if (activity is IOnMapReadyCallback callback)
                {
                    mapFrag.GetMapAsync(callback);
                }
                else
                {
                    throw new
                          ArgumentException("If the onMapReadyCallback is null, then the activity must implement the interface IOnMapReadyCallback.",
                                            nameof(activity));
                }
            }
            else
            {
                mapFrag.GetMapAsync(onMapReadyCallback);
            }

            return(mapFrag);
        }
Ejemplo n.º 19
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            try
            {
                base.OnCreate(savedInstanceState);
                SetContentView(Resource.Layout.Passenger);
                Platform.Init(this, savedInstanceState);

                SetContentView(Resource.Layout.Map_layout);
                mapFragment = FragmentManager.FindFragmentByTag("passengermap") as MapFragment;
                if (mapFragment == null)
                {
                    GoogleMapOptions Options = new GoogleMapOptions()
                                               .InvokeRotateGesturesEnabled(true);
                    mapFragment = MapFragment.NewInstance(Options);
                    FragmentManager.BeginTransaction().Add(Resource.Id.map, mapFragment).Commit();
                }

                mapFragment.GetMapAsync(this);


                // Create your application here

                //AddMarker(await GetLocation());
            }
            catch (Exception)
            {
                Toast.MakeText(this, "Error occured", ToastLength.Long).Show();
                var intent = new Intent(this, typeof(MainPage));
                StartActivity(intent);
            }
        }
Ejemplo n.º 20
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Agent_Layout);
            var mapFrag = MapFragment.NewInstance();// mapOptions);


            FragmentManager.BeginTransaction()
            .Add(Resource.Id.mapContainer1, mapFrag, "map_fragment")
            .Commit();

            mapFrag.GetMapAsync(this);

            Button btn1 = FindViewById <Button>(Resource.Id.button1);

            btn1.Click += Btn1_Click;;
            Button btn2 = FindViewById <Button>(Resource.Id.button2);

            btn2.Click += Btn2_Click;;
            Button btnUser = FindViewById <Button>(Resource.Id.btnUser);

            btnUser.Click += BtnUser_Click;
            Button btnLog = FindViewById <Button>(Resource.Id.btnLogout);

            btnLog.Click += BtnLog_Click;
            //api connection

            try
            {
                TextView name        = FindViewById <TextView>(Resource.Id.agent_name);
                TextView phoneNumber = FindViewById <TextView>(Resource.Id.agent_phoneNo);
                TextView email       = FindViewById <TextView>(Resource.Id.agent_email);

                string url            = "https://10.0.2.2:5001/api/Agents1/1";
                string result         = "";
                var    httpWebRequest = new HttpWebRequest(new Uri(url));
                httpWebRequest.ServerCertificateValidationCallback = delegate { return(true); };
                httpWebRequest.ContentType = "application/json";
                httpWebRequest.Method      = "Get";
                HttpWebResponse response = (HttpWebResponse)httpWebRequest.GetResponse();
                using (StreamReader reader = new StreamReader(response.GetResponseStream(), Encoding.UTF8))
                {
                    result = reader.ReadToEnd();
                }
                Agent agent = new Agent();
                agent            = Newtonsoft.Json.JsonConvert.DeserializeObject <Agent>(result);
                name.Text        = agent.name;
                email.Text       = agent.email;
                phoneNumber.Text = agent.phoneNumber;
            }

            catch (Exception e)
            {
            }

            //BottomNavigationView
            // BottomNavigationView navigation = FindViewById<BottomNavigationView>(Resource.Id.bottomNavigationView1);
            //navigation.SetOnNavigationItemSelectedListener(this);
        }
Ejemplo n.º 21
0
        protected override async void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.CustomMap);

            _toolbar = FindViewById <Toolbar>(Resource.Id.tv_cm_toolbar);
            SetSupportActionBar(_toolbar);
            SupportActionBar.SetDisplayHomeAsUpEnabled(true);
            SupportActionBar.SetHomeButtonEnabled(true);

            _setPlaceButton = FindViewById <Button>(Resource.Id.btn_cm_setCoordinates);
            PlaceAutocompleteFragment autocompleteFragment =
                (PlaceAutocompleteFragment)FragmentManager.FindFragmentById(Resource.Id.place_autocomplete_fragment);

            var content = Intent.GetStringExtra("place");

            _isEditable = Intent.GetBooleanExtra("isEditable", false);
            if (!_isEditable)
            {
                autocompleteFragment.View.Visibility = ViewStates.Gone;
                _setPlaceButton.Visibility           = ViewStates.Gone;
            }
            else
            {
                autocompleteFragment.SetOnPlaceSelectedListener(this);
                autocompleteFragment.SetBoundsBias(new LatLngBounds(
                                                       new LatLng(4.5931, -74.1552),
                                                       new LatLng(4.6559, -74.0837)));
                _setPlaceButton.Click += SetPlaceButton_Click;
            }

            if (!string.IsNullOrWhiteSpace(content))
            {
                _markerPosition = JsonConvert.DeserializeObject <Coordinates>(content);
            }

            _fusedLocationProviderClient = LocationServices.GetFusedLocationProviderClient(this);
            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;
            if (_mapFragment == null)
            {
                Location location = await _fusedLocationProviderClient.GetLastLocationAsync();

                var myPosition = new LatLng(location.Latitude, location.Longitude);// (20.5, 20.5);
                GoogleMapOptions mapOptions = new GoogleMapOptions()
                                              .InvokeMapType(GoogleMap.MapTypeNormal)
                                              .InvokeZoomControlsEnabled(true)
                                              .InvokeMapToolbarEnabled(true)
                                              .InvokeCamera(new CameraPosition(myPosition, 10, 0, 0))
                                              .InvokeCompassEnabled(true);
                FragmentTransaction fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }

            _mapFragment.GetMapAsync(this);
        }
Ejemplo n.º 22
0
        public void InitMap()
        {
            // Maps
            var mapFragment = MapFragment.NewInstance();
            FragmentTransaction fragmentTransaction = FragmentManager.BeginTransaction();

            fragmentTransaction.Add(Resource.Id.mapContainer, mapFragment);
            fragmentTransaction.Commit();
        }
Ejemplo n.º 23
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.Main);
            Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);

            // Toolbar settings
            var mToolbar = FindViewById <Android.Support.V7.Widget.Toolbar>(Resource.Id.toolbar);

            SetSupportActionBar(mToolbar);
            SupportActionBar.Title = "Running Tracker";

            // Find view
            _speedTextView    = FindViewById <TextView>(Resource.Id.speed);
            _distanceTextView = FindViewById <TextView>(Resource.Id.distance);
            _mainButton       = FindViewById <Button>(Resource.Id.mainButton);
            _txtTime          = FindViewById <TextView>(Resource.Id.txtTimer);

            // Initialization
            _mainButtonState = MainButtonStates.Calibrating;
            _sumDistance     = 0;
            _previousStateOfCurrentPolyline = null;
            _polylineOptions      = null;
            _lastUserPosition     = null;
            _userPosition         = null;
            _lastRunningSpeedType = RunningSpeed.StartPoint;

            // Current position timer
            _currentPositionTimer          = new UserPositionTimer(Fps, Model.GpsMinTime);
            _currentPositionTimer.Elapsed += CurrentPositionTimerOnElapsed;

            // Eventhandler
            _mainButton.Click += MainButton_Clicked;

            // Map fragment
            _mapFragment = FragmentManager.FindFragmentByTag("map") as MapFragment;

            if (_mapFragment == null)
            {
                var mapOptions = new GoogleMapOptions()
                                 .InvokeMapType(GoogleMap.MapTypeNormal)
                                 .InvokeZoomControlsEnabled(false)
                                 .InvokeZoomGesturesEnabled(true)
                                 .InvokeScrollGesturesEnabled(false)
                                 .InvokeCompassEnabled(true)
                                 .InvokeZOrderOnTop(false);

                var fragTx = FragmentManager.BeginTransaction();
                _mapFragment = MapFragment.NewInstance(mapOptions);
                fragTx.Add(Resource.Id.map, _mapFragment, "map");
                fragTx.Commit();
            }

            _mapFragment.GetMapAsync(this);
        }
Ejemplo n.º 24
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.DisplayMap);

            _myMapFragment = MapFragment.NewInstance();
            FragmentTransaction tx = FragmentManager.BeginTransaction();

            tx.Add(Resource.Id.map, _myMapFragment);
            tx.Commit();
        }
Ejemplo n.º 25
0
 public override void OnActivityCreated(Bundle savedInstanceState)
 {
     base.OnActivityCreated(savedInstanceState);
     kpMapFragment = FragmentManager.FindFragmentById(Resource.Id.mapscard);
     if (kpMapFragment == null)
     {
         kpMapFragment = MapFragment.NewInstance();
         ChildFragmentManager.BeginTransaction().Replace(Resource.Id.mapscard, kpMapFragment).Commit();
     }
     setUpGoogleMap();
 }
Ejemplo n.º 26
0
        private void Worker_DoWork(object sender, DoWorkEventArgs e)
        {
            map1 = MapFragment.NewInstance();
            var ft = FragmentManager.BeginTransaction();

            ft.Add(Resource.Id.map_placeholder, map1).Commit();
            MainThread.BeginInvokeOnMainThread(() =>
            {
                map1.GetMapAsync(this);
            });
        }
Ejemplo n.º 27
0
 public override void OnResume()
 {
     base.OnResume();
     kpMapFragment = null;
     kpMapFragment = FragmentManager.FindFragmentById(Resource.Id.mapscard);
     if (kpMapFragment == null)
     {
         kpMapFragment = MapFragment.NewInstance();
         ChildFragmentManager.BeginTransaction().Replace(Resource.Id.mapscard, kpMapFragment).Commit();
     }
     setUpGoogleMap();
 }
        void SetupUserInterface()
        {
            activity      = this.Context as Activity;
            view          = activity.LayoutInflater.Inflate(Resource.Layout.MapFrameLayout, this, false);
            myMapFragment = MapFragment.NewInstance();
            FragmentTransaction tx = activity.FragmentManager.BeginTransaction();

            tx.Add(Resource.Id.map_frame, myMapFragment);
            tx.Commit();

            myMapFragment.GetMapAsync(this);
        }
Ejemplo n.º 29
0
        /// <summary>
        ///   All we do here is add a SupportMapFragment to the Activity.
        /// </summary>
        private void InitMap()
        {
            var mapOptions = new GoogleMapOptions()
                             .InvokeMapType(GoogleMap.MapTypeSatellite)
                             .InvokeZoomControlsEnabled(false)
                             .InvokeCompassEnabled(true);

            var fragTx      = FragmentManager.BeginTransaction();
            var mapFragment = MapFragment.NewInstance(mapOptions);

            fragTx.Add(Resource.Id.mapWithOverlay, mapFragment, "map");
            fragTx.Commit();
        }
        public static void LocationUpdated(List <Excursionist> Excursionisti)
        {
            if (AfisareTipGrid != null)
            {
                context.RunOnUiThread(() => {
                    AfisareTipGrid.Adapter = new Organizator_Trip_VizualizatreExcursionisti_Adapter(context, Excursionisti.ToArray());

                    LocationManager lm = (LocationManager)context.GetSystemService(LocationService);
                    Location l         = lm.GetLastKnownLocation(LocationManager.NetworkProvider);

                    LatLng location = new LatLng(double.Parse(l.Latitude.ToString()), double.Parse(l.Longitude.ToString()));
                    CameraPosition.Builder builder = CameraPosition.InvokeBuilder();
                    builder.Target(location);
                    builder.Zoom(18);

                    CameraPosition cameraPosition = builder.Build();
                    CameraUpdate cameraUpdate     = CameraUpdateFactory.NewCameraPosition(cameraPosition);

                    MapFragment mapFrag = MapFragment.NewInstance();
                    mapFrag             = (MapFragment)((FragmentActivity)context).FragmentManager.FindFragmentById(Resource.Id.map);
                    if (mapFrag != null)
                    {
                        GoogleMap map = mapFrag.Map;
                        map.Clear();

                        List <MarkerOptions> Markers = new List <MarkerOptions>();

                        foreach (Excursionist e in Excursionisti.ToList())
                        {
                            Bitmap UserPhoto = ((BitmapDrawable)e.Photo).Bitmap;

                            MarkerOptions UserMarker = new MarkerOptions();
                            try
                            {
                                string Latitude  = e.Pozitie.Split(',')[0];
                                string Longitude = e.Pozitie.Split(',')[1];

                                UserMarker.SetPosition(new LatLng(double.Parse(Latitude.Replace('.', ',')), double.Parse(Longitude.Replace('.', ','))));
                                UserMarker.SetIcon(BitmapDescriptorFactory.FromBitmap(UserPhoto));
                                UserMarker.SetTitle(e.Nume + " " + e.Prenume);
                                map.AddMarker(UserMarker);
                            }
                            catch { }
                        }

                        map.MapType = GoogleMap.MapTypeNormal;
                        map.MoveCamera(cameraUpdate);
                    }
                });
            }
        }