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){
case MAIN_MENU:
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();
CallbackWithObject<GPXFile[]> callbackWithObject = new CallbackWithObject<GPXFile[]>() {
@Override
@ -243,14 +243,15 @@ public class MapActivityLayers {
mapView.getZoom(), true);
}
mapView.refreshMap();
activity.getMapActions().refreshDrawer();
return true;
}
};
if (files == null) {
GpxUiHelper.selectGPXFile(activity, true, true, callbackWithObject);
return GpxUiHelper.selectGPXFile(activity, true, true, callbackWithObject);
} 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
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();
if (itemId == R.string.layer_poi) {
if (isChecked) {
@ -130,7 +130,14 @@ public class ConfigureMapMenu {
if (ma.getMyApplication().getSelectedGpxHelper().isShowingAnyGpxFiles()) {
ma.getMyApplication().getSelectedGpxHelper().clearAllGpxFileToShow();
} 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!)
} else if (itemId == R.string.layer_transport_route) {