Fix exception

This commit is contained in:
Victor Shcherb 2012-09-15 17:12:00 +02:00
parent bd29fe7171
commit 8a5ae6accf
3 changed files with 17 additions and 8 deletions

View file

@ -615,7 +615,10 @@ public class FavouritesActivity extends OsmandExpandableListActivity {
public void onClick(View v) { public void onClick(View v) {
if (ch.isChecked()) { if (ch.isChecked()) {
groupsToDelete.add(model); groupsToDelete.add(model);
favoritesToDelete.addAll(helper.getFavoriteGroups().get(model)); List<FavouritePoint> fvs = helper.getFavoriteGroups().get(model);
if (fvs != null) {
favoritesToDelete.addAll(fvs);
}
favouritesAdapter.notifyDataSetInvalidated(); favouritesAdapter.notifyDataSetInvalidated();
} else { } else {
groupsToDelete.remove(model); groupsToDelete.remove(model);

View file

@ -352,15 +352,16 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() { builder.setPositiveButton(R.string.default_buttons_yes, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
restoreRoutingMode(); quit = true;
restoreRoutingModeInner();
} }
}); });
builder.setNegativeButton(R.string.default_buttons_no, new DialogInterface.OnClickListener() { builder.setNegativeButton(R.string.default_buttons_no, new DialogInterface.OnClickListener() {
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
notRestoreRoutingMode();
quit = true; quit = true;
notRestoreRoutingMode();
} }
}); });
final AlertDialog dlg = builder.show(); final AlertDialog dlg = builder.show();
@ -383,8 +384,11 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
delay --; delay --;
tv.setText(getString(R.string.continue_follow_previous_route_auto, delay + "")); tv.setText(getString(R.string.continue_follow_previous_route_auto, delay + ""));
if(delay <= 0) { if(delay <= 0) {
if(dlg.isShowing()) {
dlg.dismiss(); dlg.dismiss();
restoreRoutingMode(); }
quit = true;
restoreRoutingModeInner();
} else { } else {
uiHandler.postDelayed(delayDisplay, 1000); uiHandler.postDelayed(delayDisplay, 1000);
} }
@ -394,8 +398,7 @@ public class MapActivity extends AccessibleActivity implements IMapLocationListe
delayDisplay.run(); delayDisplay.run();
} }
private void restoreRoutingMode() { private void restoreRoutingModeInner() {
quit = true;
AsyncTask<String, Void, GPXFile> task = new AsyncTask<String, Void, GPXFile>() { AsyncTask<String, Void, GPXFile> task = new AsyncTask<String, Void, GPXFile>() {
@Override @Override
protected GPXFile doInBackground(String... params) { protected GPXFile doInBackground(String... params) {

View file

@ -45,6 +45,9 @@ public class OsmEditingPlugin extends OsmandPlugin {
@Override @Override
public void updateLayers(OsmandMapTileView mapView, MapActivity activity){ public void updateLayers(OsmandMapTileView mapView, MapActivity activity){
if (osmBugsLayer == null) {
registerLayers(activity);
}
if(mapView.getLayers().contains(osmBugsLayer) != settings.SHOW_OSM_BUGS.get()){ if(mapView.getLayers().contains(osmBugsLayer) != settings.SHOW_OSM_BUGS.get()){
if(settings.SHOW_OSM_BUGS.get()){ if(settings.SHOW_OSM_BUGS.get()){
mapView.addLayer(osmBugsLayer, 2); mapView.addLayer(osmBugsLayer, 2);