From 57f25137841c9269a29c78aa9b9cb34e434bf203 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 7 Jul 2010 06:42:17 +0000 Subject: [PATCH] fix small issues with gps/network provider git-svn-id: https://osmand.googlecode.com/svn/trunk@297 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8 --- DataExtractionOSM/src/com/osmand/ToDoConstants.java | 6 +----- .../src/com/osmand/osm/OpeningHoursParser.java | 2 +- OsmAnd/src/com/osmand/activities/MapActivity.java | 8 ++++++-- .../src/com/osmand/activities/OpeningHoursView.java | 12 ++++++++---- .../osmand/activities/search/SearchPOIActivity.java | 9 ++++++++- OsmAnd/src/com/osmand/views/PointLocationLayer.java | 2 ++ 6 files changed, 26 insertions(+), 13 deletions(-) diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index e9fbfe4044..5ad6364187 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -16,7 +16,7 @@ public class ToDoConstants { // TODO ANDROID - // Prepare update v 0.2.1: android description, sites(osmand/wiki), screenshots, Amerika indexes & poi/transport.index + // Prepare update v 0.2.1: screenshots, // android description, sites(osmand/wiki), US/canada indexes & poi/transport.index // 61. Provide route information for YOURS (calclate turns/angle/expected time). // Fix some missing turns in CloudMade (for secondary roads wo name). Add them (if dist to prev/next turn > 150m) [dacha] @@ -53,10 +53,6 @@ public class ToDoConstants { // DONE ANDROID : // 33. Build transport locations. Create transport index (transport-stops) (investigate) // Not implemented : show key/transit stops on map, follow mode (show next stop) - // 50. Invent opening hours editor in order to edit POI hours better on device - // 67. Improve POI search show direction where to go in search & introduce option show near you - // 42. Revise UI (icons/layouts). Support different devices. Add inactive/focus(!) icon versions. - // Some icons are not fine (as back menu from map - it is blured). // DONE SWING diff --git a/DataExtractionOSM/src/com/osmand/osm/OpeningHoursParser.java b/DataExtractionOSM/src/com/osmand/osm/OpeningHoursParser.java index 15d07fd006..ff450f1f41 100644 --- a/DataExtractionOSM/src/com/osmand/osm/OpeningHoursParser.java +++ b/DataExtractionOSM/src/com/osmand/osm/OpeningHoursParser.java @@ -48,7 +48,7 @@ public class OpeningHoursParser { if(p < 0){ p+=7; } - int time = cal.get(Calendar.HOUR) * 60 + cal.get(Calendar.MINUTE); + int time = cal.get(Calendar.HOUR_OF_DAY) * 60 + cal.get(Calendar.MINUTE); // one day working 10 - 20 (not 20 - 04) if(startTime < endTime || endTime == -1){ if(days[d]){ diff --git a/OsmAnd/src/com/osmand/activities/MapActivity.java b/OsmAnd/src/com/osmand/activities/MapActivity.java index 3124ac42e0..6dd89da660 100644 --- a/OsmAnd/src/com/osmand/activities/MapActivity.java +++ b/OsmAnd/src/com/osmand/activities/MapActivity.java @@ -537,6 +537,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE); sensorMgr.unregisterListener(this); sensorRegistered = false; + currentLocationProvider = null; OsmandSettings.setLastKnownMapLocation(this, (float) mapView.getLatitude(), (float) mapView.getLongitude()); OsmandSettings.setLastKnownMapZoom(this, mapView.getZoom()); @@ -603,11 +604,14 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat service.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this); LocationProvider prov = service.getProvider(LocationManager.GPS_PROVIDER); - if(!service.isProviderEnabled(LocationManager.GPS_PROVIDER)){ + if(!service.isProviderEnabled(LocationManager.GPS_PROVIDER) && !isRunningOnEmulator()){ service.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this); prov = service.getProvider(LocationManager.NETWORK_PROVIDER); + currentLocationProvider = LocationManager.NETWORK_PROVIDER; + } else { + currentLocationProvider = LocationManager.GPS_PROVIDER; } - + providerSupportsBearing = prov == null ? false : prov.supportsBearing() && !isRunningOnEmulator(); providerSupportsSpeed = prov == null ? false : prov.supportsSpeed() && !isRunningOnEmulator(); diff --git a/OsmAnd/src/com/osmand/activities/OpeningHoursView.java b/OsmAnd/src/com/osmand/activities/OpeningHoursView.java index 114b19a798..6b336aa635 100644 --- a/OsmAnd/src/com/osmand/activities/OpeningHoursView.java +++ b/OsmAnd/src/com/osmand/activities/OpeningHoursView.java @@ -68,7 +68,7 @@ public class OpeningHoursView { timePickerEnd.setIs24HourView(true); timePickerStart.setIs24HourView(true); - timePickerStart.setCurrentHour(8); + timePickerStart.setCurrentHour(9); timePickerStart.setCurrentMinute(0); timePickerEnd.setCurrentHour(20); timePickerEnd.setCurrentMinute(0); @@ -99,10 +99,14 @@ public class OpeningHoursView { @Override public void onClick(View v) { BasicDayOpeningHourRule r = new BasicDayOpeningHourRule(); - r.setStartTime(9*60); - r.setEndTime(20*60); + r.setStartTime(timePickerStart.getCurrentHour()*60 + timePickerStart.getCurrentMinute()); + r.setEndTime(timePickerEnd.getCurrentHour()*60 + timePickerEnd.getCurrentMinute()); + boolean[] days = r.getDays(); - Arrays.fill(days, true); + if(position == 0){ + // first time full all + Arrays.fill(days, true); + } showDaysDialog(r, position); } diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java index ac14a0f5a1..fdf2ffa4f0 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java @@ -259,12 +259,16 @@ public class SearchPOIActivity extends ListActivity implements LocationListener, @Override protected void onResume() { super.onResume(); + if(searchNearBy){ + location = null; + } if (filter != null && location != null) { searchedLocation = location; amenityAdapter.setNewModel(filter.initializeNewSearch(location.getLatitude(), location.getLongitude(), 40)); searchPOILevel.setEnabled(filter.isSearchFurtherAvailable()); searchArea.setText(filter.getSearchArea()); } else { + amenityAdapter.notifyDataSetChanged(); searchPOILevel.setEnabled(false); } if(searchNearBy && location == null){ @@ -276,8 +280,9 @@ public class SearchPOIActivity extends ListActivity implements LocationListener, if (searchNearBy) { LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); service.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this); - if (!service.isProviderEnabled(LocationManager.GPS_PROVIDER)) { + if (!isRunningOnEmulator() && !service.isProviderEnabled(LocationManager.GPS_PROVIDER)) { service.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this); + currentLocationProvider = LocationManager.NETWORK_PROVIDER; } } } @@ -314,6 +319,7 @@ public class SearchPOIActivity extends ListActivity implements LocationListener, SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE); sensorMgr.unregisterListener(this); sensorRegistered = false; + currentLocationProvider = null; } } @@ -411,6 +417,7 @@ public class SearchPOIActivity extends ListActivity implements LocationListener, for (Amenity obj : amenityList) { this.add(obj); } + setNotifyOnChange(true); this.notifyDataSetChanged(); } diff --git a/OsmAnd/src/com/osmand/views/PointLocationLayer.java b/OsmAnd/src/com/osmand/views/PointLocationLayer.java index f7ad11f1e0..176802b7b8 100644 --- a/OsmAnd/src/com/osmand/views/PointLocationLayer.java +++ b/OsmAnd/src/com/osmand/views/PointLocationLayer.java @@ -86,9 +86,11 @@ public class PointLocationLayer implements OsmandMapLayer { if(appMode == ApplicationMode.CAR){ if(!lastKnownLocation.hasBearing()){ canvas.drawCircle(locationX, locationY, RADIUS * 2.5f, location); + canvas.drawCircle(locationX, locationY, RADIUS, bearingOver); } } else { canvas.drawCircle(locationX, locationY, RADIUS, location); + canvas.drawCircle(locationX, locationY, RADIUS, bearingOver); } if (radius > RADIUS) { canvas.drawCircle(locationX, locationY, radius, area);