fix small issues with gps/network provider

git-svn-id: https://osmand.googlecode.com/svn/trunk@297 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Victor Shcherb 2010-07-07 06:42:17 +00:00
parent cbb2a10a08
commit 57f2513784
6 changed files with 26 additions and 13 deletions

View file

@ -16,7 +16,7 @@ public class ToDoConstants {
// TODO ANDROID // 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). // 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] // 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 : // DONE ANDROID :
// 33. Build transport locations. Create transport index (transport-stops) (investigate) // 33. Build transport locations. Create transport index (transport-stops) (investigate)
// Not implemented : show key/transit stops on map, follow mode (show next stop) // 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 // DONE SWING

View file

@ -48,7 +48,7 @@ public class OpeningHoursParser {
if(p < 0){ if(p < 0){
p+=7; 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) // one day working 10 - 20 (not 20 - 04)
if(startTime < endTime || endTime == -1){ if(startTime < endTime || endTime == -1){
if(days[d]){ if(days[d]){

View file

@ -537,6 +537,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE); SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);
sensorMgr.unregisterListener(this); sensorMgr.unregisterListener(this);
sensorRegistered = false; sensorRegistered = false;
currentLocationProvider = null;
OsmandSettings.setLastKnownMapLocation(this, (float) mapView.getLatitude(), (float) mapView.getLongitude()); OsmandSettings.setLastKnownMapLocation(this, (float) mapView.getLatitude(), (float) mapView.getLongitude());
OsmandSettings.setLastKnownMapZoom(this, mapView.getZoom()); OsmandSettings.setLastKnownMapZoom(this, mapView.getZoom());
@ -603,9 +604,12 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat
service.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this); service.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this);
LocationProvider prov = service.getProvider(LocationManager.GPS_PROVIDER); 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); service.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this);
prov = service.getProvider(LocationManager.NETWORK_PROVIDER); prov = service.getProvider(LocationManager.NETWORK_PROVIDER);
currentLocationProvider = LocationManager.NETWORK_PROVIDER;
} else {
currentLocationProvider = LocationManager.GPS_PROVIDER;
} }
providerSupportsBearing = prov == null ? false : prov.supportsBearing() && !isRunningOnEmulator(); providerSupportsBearing = prov == null ? false : prov.supportsBearing() && !isRunningOnEmulator();

View file

@ -68,7 +68,7 @@ public class OpeningHoursView {
timePickerEnd.setIs24HourView(true); timePickerEnd.setIs24HourView(true);
timePickerStart.setIs24HourView(true); timePickerStart.setIs24HourView(true);
timePickerStart.setCurrentHour(8); timePickerStart.setCurrentHour(9);
timePickerStart.setCurrentMinute(0); timePickerStart.setCurrentMinute(0);
timePickerEnd.setCurrentHour(20); timePickerEnd.setCurrentHour(20);
timePickerEnd.setCurrentMinute(0); timePickerEnd.setCurrentMinute(0);
@ -99,10 +99,14 @@ public class OpeningHoursView {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
BasicDayOpeningHourRule r = new BasicDayOpeningHourRule(); BasicDayOpeningHourRule r = new BasicDayOpeningHourRule();
r.setStartTime(9*60); r.setStartTime(timePickerStart.getCurrentHour()*60 + timePickerStart.getCurrentMinute());
r.setEndTime(20*60); r.setEndTime(timePickerEnd.getCurrentHour()*60 + timePickerEnd.getCurrentMinute());
boolean[] days = r.getDays(); boolean[] days = r.getDays();
if(position == 0){
// first time full all
Arrays.fill(days, true); Arrays.fill(days, true);
}
showDaysDialog(r, position); showDaysDialog(r, position);
} }

View file

@ -259,12 +259,16 @@ public class SearchPOIActivity extends ListActivity implements LocationListener,
@Override @Override
protected void onResume() { protected void onResume() {
super.onResume(); super.onResume();
if(searchNearBy){
location = null;
}
if (filter != null && location != null) { if (filter != null && location != null) {
searchedLocation = location; searchedLocation = location;
amenityAdapter.setNewModel(filter.initializeNewSearch(location.getLatitude(), location.getLongitude(), 40)); amenityAdapter.setNewModel(filter.initializeNewSearch(location.getLatitude(), location.getLongitude(), 40));
searchPOILevel.setEnabled(filter.isSearchFurtherAvailable()); searchPOILevel.setEnabled(filter.isSearchFurtherAvailable());
searchArea.setText(filter.getSearchArea()); searchArea.setText(filter.getSearchArea());
} else { } else {
amenityAdapter.notifyDataSetChanged();
searchPOILevel.setEnabled(false); searchPOILevel.setEnabled(false);
} }
if(searchNearBy && location == null){ if(searchNearBy && location == null){
@ -276,8 +280,9 @@ public class SearchPOIActivity extends ListActivity implements LocationListener,
if (searchNearBy) { if (searchNearBy) {
LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE); LocationManager service = (LocationManager) getSystemService(LOCATION_SERVICE);
service.requestLocationUpdates(LocationManager.GPS_PROVIDER, GPS_TIMEOUT_REQUEST, GPS_DIST_REQUEST, this); 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); 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); SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE);
sensorMgr.unregisterListener(this); sensorMgr.unregisterListener(this);
sensorRegistered = false; sensorRegistered = false;
currentLocationProvider = null;
} }
} }
@ -411,6 +417,7 @@ public class SearchPOIActivity extends ListActivity implements LocationListener,
for (Amenity obj : amenityList) { for (Amenity obj : amenityList) {
this.add(obj); this.add(obj);
} }
setNotifyOnChange(true);
this.notifyDataSetChanged(); this.notifyDataSetChanged();
} }

View file

@ -86,9 +86,11 @@ public class PointLocationLayer implements OsmandMapLayer {
if(appMode == ApplicationMode.CAR){ if(appMode == ApplicationMode.CAR){
if(!lastKnownLocation.hasBearing()){ if(!lastKnownLocation.hasBearing()){
canvas.drawCircle(locationX, locationY, RADIUS * 2.5f, location); canvas.drawCircle(locationX, locationY, RADIUS * 2.5f, location);
canvas.drawCircle(locationX, locationY, RADIUS, bearingOver);
} }
} else { } else {
canvas.drawCircle(locationX, locationY, RADIUS, location); canvas.drawCircle(locationX, locationY, RADIUS, location);
canvas.drawCircle(locationX, locationY, RADIUS, bearingOver);
} }
if (radius > RADIUS) { if (radius > RADIUS) {
canvas.drawCircle(locationX, locationY, radius, area); canvas.drawCircle(locationX, locationY, radius, area);