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();
showGPXFileLayer(mapView);
}
} else if(itemId == R.string.layer_route){
routeInfoLayer.setVisible(isChecked);
} else if(itemId == R.string.layer_transport_route){
transportInfoLayer.setVisible(isChecked);
} else if(itemId == R.string.layer_transport){
@ -277,15 +275,10 @@ public class MapActivityLayers {
R.drawable.list_activities_favorites);
adapter.registerSelectedItem(R.string.layer_gpx_layer,
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,
R.drawable.list_activities_transport_stops);
if(TransportRouteHelper.getInstance().routeIsCalculated()){
adapter.registerSelectedItem(R.string.layer_transport_route,
routeInfoLayer.isUserDefinedVisible() ? 1 : 0, R.drawable.list_activities_transport_stops);
adapter.registerSelectedItem(R.string.layer_transport_route, 1 , R.drawable.list_activities_transport_stops);
}

View file

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