private void TxtLocation_OnFocusChange(object sender, View.FocusChangeEventArgs focusChangeEventArgs)
 {
     try
     {
         if (focusChangeEventArgs.HasFocus)
         {
             try
             {
                 var builder = new PlacePicker.IntentBuilder();
                 StartActivityForResult(builder.Build(this), 3);
             }
             catch (GooglePlayServicesRepairableException exception)
             {
                 Crashes.TrackError(exception);
                 Toast.MakeText(this, GetText(Resource.String.Lbl_Google_Not_Available), ToastLength.Short)
                 .Show();
             }
         }
         catch (GooglePlayServicesNotAvailableException exception)
         {
             Crashes.TrackError(exception);
             Toast.MakeText(this, GetText(Resource.String.Lbl_Google_Not_Available), ToastLength.Short)
             .Show();
         }
         catch (Exception exception)
         {
             Crashes.TrackError(exception);
             Toast.MakeText(this, GetText(Resource.String.Lbl_Google_Exception), ToastLength.Short).Show();
         }
     }
示例#2
0
        //Launch place picker
        void _pickAPlaceButton_Click(object sender, EventArgs e)
        {
            var          mapBuilder = new PlacePicker.IntentBuilder();
            LatLngBounds boundary   = new LatLngBounds(_southWestCorner, _northEastCorner);

            mapBuilder.SetLatLngBounds(boundary);
            StartActivityForResult(mapBuilder.Build(this), 1);
        }
示例#3
0
        public bool OnMarkerClick(Marker marker)
        {
            string sucursal = mMarkers.Get(marker).ToString();

            Toast.MakeText(Activity, "El marcardor tiene ID:" + sucursal, ToastLength.Short).Show();
            var builder = new PlacePicker.IntentBuilder();

            StartActivityForResult(builder.Build(Activity), 1);
            return(false);
        }
示例#4
0
        public void OnPickAPlaceButtonTapped()
        {
            //Android.App.Application.SynchronizationContext.Post(ignored =>
            //    {
            var builder = new PlacePicker.IntentBuilder();

            //builder.SetLatLngBounds(new Android.Gms.Maps.Model.LatLngBounds() {  }) //testing
            ((Activity)Forms.Context).StartActivityForResult(builder.Build((Activity)Forms.Context), 99); // ОБЯЗАТЕЛЬНО ТОЛЬКО в двух местах прописать "((Activity)Forms.Context", иначе ошибка!!!!!!!!!!!!!!!!!!!!!!!!!!!!

            //   }, null);
        }
示例#5
0
 private void PlacesPicker()
 {
     try
     {
         PlacePicker.IntentBuilder intentBuilder = new PlacePicker.IntentBuilder();
         Intent intent = intentBuilder.Build(this);
         StartActivityForResult(intent, REQUEST_PLACE_PICKER);
     }
     catch (GooglePlayServicesRepairableException e)
     {
     }
     catch (GooglePlayServicesNotAvailableException e)
     {
     }
 }
示例#6
0
        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);

            // Set our view from the "main" layout resource
            SetContentView(Resource.Layout.Main);
            checkPermissions();
            ShowDisclaimer();
            parser       = new JsonParser(this);
            mPreferences = PreferenceManager.GetDefaultSharedPreferences(this);
            address      = mPreferences.GetString("address", "1600 Pennsylvania AVE NW Washington DC");

            // Get our button from the layout resource,
            // and attach an event to it
            Button buttonSetAddress = FindViewById <Button>(Resource.Id.buttonChangeAddress);

            addressView            = FindViewById <TextView>(Resource.Id.textViewAddress);
            listViewReps           = FindViewById <ListView>(Resource.Id.listView1);
            adapterReps            = new RepresentativeAdapter(this, Representatives);
            listViewReps.Adapter   = adapterReps;
            adapterElecs           = new ArrayAdapter(this, Android.Resource.Layout.SimpleListItem1, Elections);
            listViewEmptyView      = FindViewById <TextView>(Resource.Id.listViewEmptyView);
            listViewReps.EmptyView = listViewEmptyView;
            addressView.Text       = address;

            listViewElecs          = FindViewById <ListView>(Resource.Id.listView2);
            listViewEmptyViewElecs = FindViewById <TextView>(Resource.Id.listViewEmptyViewElecs);


            listViewReps.ItemClick  += RepsListView_ItemClick;
            listViewElecs.ItemClick += ListViewElecs_ItemClick;
            buttonSetAddress.Click  += delegate
            {
                var builder = new PlacePicker.IntentBuilder();
                StartActivityForResult(builder.Build(this), PLACE_PICKER_ID);
            };
            showReps        = FindViewById <Button>(Resource.Id.buttonShowReps);
            showReps.Click += delegate
            {
                showRepData();
            };
            showElecs        = FindViewById <Button>(Resource.Id.buttonShowElecs);
            showElecs.Click += delegate
            {
                showElectionData();
            };
        }
 private void AddPlaceClicked(object sender, EventArgs args)
 {
     try
     {
         using (var builder = new PlacePicker.IntentBuilder())
         {
             using (Intent intent = builder.Build(this))
             {
                 StartActivityForResult(intent, placePickerReq);
             }
         }
     }
     catch (Exception e)
     {
         Toast.MakeText(this, "Place err: " + e.Message, ToastLength.Long).Show();
     }
 }
示例#8
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            var bundle = (savedInstanceState ?? Intent.Extras);

            this.id          = bundle.GetInt(ExtraId);
            this.SWLatitude  = bundle.GetDouble(ExtraSWLatitude, -9999);
            this.SWLongitude = bundle.GetDouble(ExtraSWLongitude, -9999);
            this.NELatitude  = bundle.GetDouble(ExtraNELatitude, -9999);
            this.NELongitude = bundle.GetDouble(ExtraNELongitude, -9999);
            try
            {
                if (SWLatitude != -9999 && SWLongitude != -9999 && NELatitude != -9999 && NELongitude != -9999)
                {
                    LatLng southwest     = new LatLng(SWLatitude.Value, SWLongitude.Value);
                    LatLng northeast     = new LatLng(NELatitude.Value, NELongitude.Value);
                    var    androidBounds = new LatLngBounds(southwest, northeast);
                    intentBuilder = new PlacePicker.IntentBuilder().SetLatLngBounds(androidBounds);
                }
                else
                {
                    intentBuilder = new PlacePicker.IntentBuilder();
                }
                intent = intentBuilder.Build(this);
                StartActivityForResult(intent, REQUEST_PLACE_PICKER);
            }
            catch (GooglePlayServicesRepairableException e)
            {
                OnPlaceSelected(new PlacePickedEventArgs(id, e));
                GoogleApiAvailability.Instance.GetErrorDialog(this, e.ConnectionStatusCode, 0).Show();
                Finish();
            }
            catch (GooglePlayServicesNotAvailableException e)
            {
                OnPlaceSelected(new PlacePickedEventArgs(id, e));
                Toast.MakeText(this, "Google Play Services is not available.", ToastLength.Long).Show();
                Finish();
            }
            catch (Exception e)
            {
                OnPlaceSelected(new PlacePickedEventArgs(id, e));
                Finish();
            }
        }
示例#9
0
        private void Button_Clicked_1(object sender, EventArgs e)
        {
            var builder = new PlacePicker.IntentBuilder();

            StartActivityForResult(builder.Build(this), 1);
        }
示例#10
0
        private void OnPickAPlaceButtonTapped(object sender, EventArgs eventArgs)
        {
            var builder = new PlacePicker.IntentBuilder();

            StartActivityForResult(builder.Build(this), PLACE_PICKER_REQUEST);
        }
示例#11
0
        private void BtnGetLoc_Click(object sender, EventArgs e)
        {
            var builder = new PlacePicker.IntentBuilder();

            StartActivityForResult(builder.Build(this), PLACE_PICKER_REQUEST);
        }
 //Add Location
 private void TxtLocation_OnFocusChange(object sender, View.FocusChangeEventArgs focusChangeEventArgs)
 {
     try
     {
         if (focusChangeEventArgs.HasFocus)
         {
             // Check if we're running on Android 5.0 or higher
             if ((int)Build.VERSION.SdkInt < 23)
             {
                 try
                 {
                     var builder = new PlacePicker.IntentBuilder();
                     StartActivityForResult(builder.Build(this), 4);
                 }
                 catch (GooglePlayServicesRepairableException exception)
                 {
                     Crashes.TrackError(exception);
                     Toast.MakeText(this, GetText(Resource.String.Lbl_Google_Not_Available), ToastLength.Short)
                     .Show();
                 }
                 catch (GooglePlayServicesNotAvailableException exception)
                 {
                     Crashes.TrackError(exception);
                     Toast.MakeText(this, GetText(Resource.String.Lbl_Google_Not_Available), ToastLength.Short)
                     .Show();
                 }
                 catch (Exception exception)
                 {
                     Crashes.TrackError(exception);
                     Toast.MakeText(this, GetText(Resource.String.Lbl_Google_Exception), ToastLength.Short)
                     .Show();
                 }
             }
             else
             {
                 if (CheckSelfPermission(Manifest.Permission.AccessFineLocation) == Permission.Granted &&
                     CheckSelfPermission(Manifest.Permission.AccessCoarseLocation) == Permission.Granted)
                 {
                     try
                     {
                         var builder = new PlacePicker.IntentBuilder();
                         StartActivityForResult(builder.Build(this), 4);
                     }
                     catch (GooglePlayServicesRepairableException exception)
                     {
                         Crashes.TrackError(exception);
                         Toast.MakeText(this, GetText(Resource.String.Lbl_Google_Not_Available),
                                        ToastLength.Short).Show();
                     }
                 }
                 catch (GooglePlayServicesNotAvailableException exception)
                 {
                     Crashes.TrackError(exception);
                     Toast.MakeText(this, GetText(Resource.String.Lbl_Google_Not_Available),
                                    ToastLength.Short).Show();
                 }
                 catch (Exception exception)
                 {
                     Crashes.TrackError(exception);
                     Toast.MakeText(this, GetText(Resource.String.Lbl_Google_Exception), ToastLength.Short)
                     .Show();
                 }
示例#13
0
        private void OnPickAPlaceButtonTapped(object sender, EventArgs eventArgs)
        {
            var builder = new PlacePicker.IntentBuilder();

            StartActivityForResult(builder.Build(Activity), 418);
        }
        protected void ChooseLocation(object sender, EventArgs e)
        {
            var builder = new PlacePicker.IntentBuilder();

            StartActivityForResult(builder.Build(this), PlacePickerRequset);
        }
示例#15
0
        private void OnPickAPlaceLocation(object sender, EventArgs e)
        {
            var builder = new PlacePicker.IntentBuilder();

            StartActivityForResult(builder.Build(this), PLACE_REQUEST);
        }