Clean options

This commit is contained in:
Victor Shcherb 2013-02-17 21:04:02 +01:00
parent c9a6d47c82
commit 5acc6b3495
2 changed files with 2 additions and 24 deletions

View file

@ -252,8 +252,6 @@ public class MapActivityLayers {
dialog.dismiss(); dialog.dismiss();
showGPXFileLayer(mapView); showGPXFileLayer(mapView);
} }
} else if(itemId == R.string.layer_route){
routeInfoLayer.setVisible(isChecked);
} else if(itemId == R.string.layer_transport_route){ } else if(itemId == R.string.layer_transport_route){
transportInfoLayer.setVisible(isChecked); transportInfoLayer.setVisible(isChecked);
} else if(itemId == R.string.layer_transport){ } else if(itemId == R.string.layer_transport){
@ -277,15 +275,10 @@ public class MapActivityLayers {
R.drawable.list_activities_favorites); R.drawable.list_activities_favorites);
adapter.registerSelectedItem(R.string.layer_gpx_layer, adapter.registerSelectedItem(R.string.layer_gpx_layer,
getApplication().getGpxFileToDisplay() != null ? 1 : 0, R.drawable.list_activities_gpx_tracks); getApplication().getGpxFileToDisplay() != null ? 1 : 0, R.drawable.list_activities_gpx_tracks);
if(routeInfoLayer.couldBeVisible()){
adapter.registerSelectedItem(R.string.layer_route,
routeInfoLayer.isUserDefinedVisible() ? 1 : 0, R.drawable.list_activities_route);
}
adapter.registerSelectedItem(R.string.layer_transport, settings.SHOW_TRANSPORT_OVER_MAP.get() ? 1 : 0, adapter.registerSelectedItem(R.string.layer_transport, settings.SHOW_TRANSPORT_OVER_MAP.get() ? 1 : 0,
R.drawable.list_activities_transport_stops); R.drawable.list_activities_transport_stops);
if(TransportRouteHelper.getInstance().routeIsCalculated()){ if(TransportRouteHelper.getInstance().routeIsCalculated()){
adapter.registerSelectedItem(R.string.layer_transport_route, adapter.registerSelectedItem(R.string.layer_transport_route, 1 , R.drawable.list_activities_transport_stops);
routeInfoLayer.isUserDefinedVisible() ? 1 : 0, R.drawable.list_activities_transport_stops);
} }

View file

@ -27,7 +27,6 @@ public class RouteInfoLayer extends OsmandMapLayer implements IRouteInformationL
private Button next; private Button next;
private Button prev; private Button prev;
private Button info; private Button info;
private boolean visible = true;
private int directionInfo = -1; private int directionInfo = -1;
private DisplayMetrics dm; private DisplayMetrics dm;
@ -107,11 +106,9 @@ public class RouteInfoLayer extends OsmandMapLayer implements IRouteInformationL
} }
public boolean isVisible(){ public boolean isVisible(){
return visible && routingHelper.isRouteCalculated() && !routingHelper.isFollowingMode();
}
public boolean couldBeVisible(){
return routingHelper.isRouteCalculated() && !routingHelper.isFollowingMode(); return routingHelper.isRouteCalculated() && !routingHelper.isFollowingMode();
} }
private void updateVisibility(){ private void updateVisibility(){
int vis = isVisible() ? View.VISIBLE : View.INVISIBLE; int vis = isVisible() ? View.VISIBLE : View.INVISIBLE;
prev.setVisibility(vis); prev.setVisibility(vis);
@ -142,22 +139,10 @@ public class RouteInfoLayer extends OsmandMapLayer implements IRouteInformationL
@Override @Override
public void newRouteIsCalculated(boolean newRoute) { public void newRouteIsCalculated(boolean newRoute) {
directionInfo = -1; directionInfo = -1;
if (!routingHelper.isFollowingMode()) {
visible = true;
}
updateVisibility(); updateVisibility();
view.refreshMap(); view.refreshMap();
} }
public boolean isUserDefinedVisible() {
return visible;
}
public void setVisible(boolean visible) {
this.visible = visible;
updateVisibility();
}
public int getDirectionInfo() { public int getDirectionInfo() {
return directionInfo; return directionInfo;
} }