Fixed issue with GPX track checkbox working bad in drawer

This commit is contained in:
Denis 2015-01-16 13:08:46 +02:00
parent d21c23b154
commit aa1366351e
3 changed files with 17 additions and 5 deletions

View file

@ -623,6 +623,10 @@ public class MapActivityActions implements DialogProvider {
} }
}); });
} }
refreshDrawer();
}
public void refreshDrawer(){
switch (currentDrawer){ switch (currentDrawer){
case MAIN_MENU: case MAIN_MENU:
prepareOptionsMenu(createMainOptionsMenu()); prepareOptionsMenu(createMainOptionsMenu());

View file

@ -217,7 +217,7 @@ public class MapActivityLayers {
public void showGPXFileLayer(List<String> files, final OsmandMapTileView mapView) { public AlertDialog showGPXFileLayer(List<String> files, final OsmandMapTileView mapView) {
final OsmandSettings settings = getApplication().getSettings(); final OsmandSettings settings = getApplication().getSettings();
CallbackWithObject<GPXFile[]> callbackWithObject = new CallbackWithObject<GPXFile[]>() { CallbackWithObject<GPXFile[]> callbackWithObject = new CallbackWithObject<GPXFile[]>() {
@Override @Override
@ -243,14 +243,15 @@ public class MapActivityLayers {
mapView.getZoom(), true); mapView.getZoom(), true);
} }
mapView.refreshMap(); mapView.refreshMap();
activity.getMapActions().refreshDrawer();
return true; return true;
} }
}; };
if (files == null) { if (files == null) {
GpxUiHelper.selectGPXFile(activity, true, true, callbackWithObject); return GpxUiHelper.selectGPXFile(activity, true, true, callbackWithObject);
} else { } else {
GpxUiHelper.selectGPXFile(files, activity, true, true, callbackWithObject); return GpxUiHelper.selectGPXFile(files, activity, true, true, callbackWithObject);
} }
} }

View file

@ -115,7 +115,7 @@ public class ConfigureMapMenu {
} }
@Override @Override
public boolean onContextMenuClick(ArrayAdapter<?> adapter, int itemId, int pos, boolean isChecked) { public boolean onContextMenuClick(final ArrayAdapter<?> adapter, int itemId, final int pos, boolean isChecked) {
OsmandSettings settings = ma.getMyApplication().getSettings(); OsmandSettings settings = ma.getMyApplication().getSettings();
if (itemId == R.string.layer_poi) { if (itemId == R.string.layer_poi) {
if (isChecked) { if (isChecked) {
@ -130,7 +130,14 @@ public class ConfigureMapMenu {
if (ma.getMyApplication().getSelectedGpxHelper().isShowingAnyGpxFiles()) { if (ma.getMyApplication().getSelectedGpxHelper().isShowingAnyGpxFiles()) {
ma.getMyApplication().getSelectedGpxHelper().clearAllGpxFileToShow(); ma.getMyApplication().getSelectedGpxHelper().clearAllGpxFileToShow();
} else { } else {
ma.getMapLayers().showGPXFileLayer(getAlreadySelectedGpx(), ma.getMapView()); AlertDialog dialog = ma.getMapLayers().showGPXFileLayer(getAlreadySelectedGpx(), ma.getMapView());
dialog.setOnCancelListener(new DialogInterface.OnCancelListener() {
@Override
public void onCancel(DialogInterface dialogInterface) {
cm.setSelection(pos, 0);
adapter.notifyDataSetChanged();
}
});
} }
// TODO: tick mark of "Show GPX" needs to be synced after return form sub-selection screen (user may or may not have selected files!) // TODO: tick mark of "Show GPX" needs to be synced after return form sub-selection screen (user may or may not have selected files!)
} else if (itemId == R.string.layer_transport_route) { } else if (itemId == R.string.layer_transport_route) {