// Lifecycle methods protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.BikeTheftsPerNeighborhood); this.registerReturnButton(); // Show location on the map Button showLocationOnMap = FindViewById <Button>(Resource.Id.showLocationOnMap); showLocationOnMap.Click += delegate { Map.OpenMap(this, location); }; if (GooglePlayService.IsGooglePlayServicesInstalled(this)) { apiClient = new GoogleApiClient.Builder(this, this, this).AddApi(LocationServices.API).Build(); // generate a location request that we will pass into a call for location updates locRequest = new LocationRequest(); } else { Log.Error("OnCreate", "Google Play Services is not installed"); Toast.MakeText(this, "Google Play Services is not installed", ToastLength.Long).Show(); Finish(); } }
// Lifecycle methods protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.BikeLocations); this.registerReturnButton(); // Load spinner Spinner spinner = FindViewById <Spinner>(Resource.Id.spinner); BikeLocationsElements.CreateSpinner(this, spinner); TextView locationName = FindViewById <TextView>(Resource.Id.LocationName); // Save locattion Button saveLocationButton = FindViewById <Button>(Resource.Id.saveLocation); saveLocationButton.Click += delegate { // Save location BikeLocationsElements.SaveLocation(this, location, locationName); // Hide keyboard General.HideKeyboard(this); // Reload spinner BikeLocationsElements.CreateSpinner(this, spinner); // Reload map InitMapFragment(); // Display message Toast.MakeText(this, "Location has been saved", ToastLength.Long).Show(); Map.CreateBikeMarkers(this, map); }; if (GooglePlayService.IsGooglePlayServicesInstalled(this)) { apiClient = new GoogleApiClient.Builder(this, this, this).AddApi(LocationServices.API).Build(); // generate a location request that we will pass into a call for location updates locRequest = new LocationRequest(); } else { Log.Error("OnCreate", "Google Play Services is not installed"); Toast.MakeText(this, "Google Play Services is not installed", ToastLength.Long).Show(); Finish(); } }
// Lifecycle methods protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.RouteCalculator); this.registerReturnButton(); // Show closest bicyledrum on the map Button showClosestBicyledrum = FindViewById <Button>(Resource.Id.showClosestBicyledrum); showClosestBicyledrum.Click += delegate { Map.FocusOnClosestBicyledrum(map, location); }; // Generate route to closest bicyledrum Button routeToClosestBicyledrum = FindViewById <Button>(Resource.Id.routeToClosestBicyledrum); routeToClosestBicyledrum.Click += delegate { Map.GetRouteToBicyleDrum(this, location); }; if (GooglePlayService.IsGooglePlayServicesInstalled(this)) { apiClient = new GoogleApiClient.Builder(this, this, this).AddApi(LocationServices.API).Build(); // generate a location request that we will pass into a call for location updates locRequest = new LocationRequest(); } else { Log.Error("OnCreate", "Google Play Services is not installed"); Toast.MakeText(this, "Google Play Services is not installed", ToastLength.Long).Show(); Finish(); } }
protected override void OnCreate(Bundle bundle) { base.OnCreate(bundle); SetContentView(Resource.Layout.BikeAgenda); this.registerReturnButton(); // If GPS is installed for the geolocater.. if (GooglePlayService.IsGooglePlayServicesInstalled(this)) { // API client that will be used for the location apiClient = new GoogleApiClient.Builder(this, this, this).AddApi(LocationServices.API).Build(); // generate a location request that we will pass into a call for location updates locRequest = new LocationRequest(); // We get our location GetLocation(); } else { // GPS is not installed, error message & return to home. Log.Error("OnCreate", "Google Play Services is not installed"); Toast.MakeText(this, "Google Play Services is niet geinstalleerd!", ToastLength.Long).Show(); Finish(); } // The used UI elements DatePicker datePicker = (DatePicker)FindViewById(Resource.Id.datePicker); TimePicker timePicker = (TimePicker)FindViewById(Resource.Id.timePicker); timePicker.ClearFocus(); Button confirmButton = FindViewById <Button>(Resource.Id.datePickerSelect); // Confirm button & it's event handler. confirmButton.Click += delegate { // The date int cDay = datePicker.DayOfMonth; int cMonth = datePicker.Month; int cYear = datePicker.Year; // The time int cHour = (int)timePicker.CurrentHour; int cMin = (int)timePicker.CurrentMinute; // The starting times standard variables int cFirstHour = 0; int cFirstMin = 0; // If the minutes is less than 0 if you reduce it by 30 (for the first time) if (cMin - 30 < 0) { // Remove an hour cFirstHour = cHour - 1; // Remove the minutes so we can round the hours int removedMin = 30 - cMin; // Remove the leftover minutes from the rounded hour cFirstMin = 60 - removedMin; } else { // Same hours cFirstHour = cHour; // Reduced minutes cFirstMin = cMin - 30; } // Class that can save content for applications. ContentValues eventValues = new ContentValues(); // We think the standard id for a calendar is 1 on a device. eventValues.Put(CalendarContract.Events.InterfaceConsts.CalendarId, 1); // Title for the agenda item. eventValues.Put(CalendarContract.Events.InterfaceConsts.Title, "Fiets ophalen."); // Description for the agenda item. eventValues.Put(CalendarContract.Events.InterfaceConsts.Description, "Haal uw fiets op, de locatie is opgeslagen."); // Location for the agenda item. eventValues.Put(CalendarContract.Events.InterfaceConsts.EventLocation, streetName); // Convert to milliseconds so we can define a start date eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtstart, Helpers.convertToMilliseconds(cYear, cMonth, cDay, cFirstHour, cFirstMin)); // Convert to milliseconds so we can define a end date. eventValues.Put(CalendarContract.Events.InterfaceConsts.Dtend, Helpers.convertToMilliseconds(cYear, cMonth, cDay, cHour, cMin)); // Define the timezones. eventValues.Put(CalendarContract.Events.InterfaceConsts.EventTimezone, "Europe/Berlin"); eventValues.Put(CalendarContract.Events.InterfaceConsts.EventEndTimezone, "Europe/Berlin"); // Insert the data into the agenda content. var uri = ContentResolver.Insert(CalendarContract.Events.ContentUri, eventValues); // Popup message Toast.MakeText(this, "Uw reminder is toevoegd!", ToastLength.Long).Show(); }; }