Fix small issues
This commit is contained in:
parent
4c7d62cfd6
commit
ab9397d39e
5 changed files with 41 additions and 13 deletions
|
@ -388,16 +388,31 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
if (!routingHelper.isFollowingMode() && !routingHelper.isRoutePlanningMode()) {
|
||||
mapActivity.getMapActions().enterRoutePlanningMode(null, null, false);
|
||||
} else {
|
||||
mapActivity.getRoutingHelper().setRoutePlanningMode(true);
|
||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||
mapActivity.refreshMap();
|
||||
switchToRoutePlanningLayout();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
});
|
||||
}
|
||||
|
||||
|
||||
public void switchToRouteFollowingLayout() {
|
||||
touchEvent = 0;
|
||||
mapActivity.getMyApplication().getRoutingHelper().setRoutePlanningMode(false);
|
||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||
mapActivity.refreshMap();
|
||||
}
|
||||
|
||||
public boolean switchToRoutePlanningLayout() {
|
||||
if (!mapActivity.getRoutingHelper().isRoutePlanningMode() && mapActivity.getRoutingHelper().isFollowingMode()) {
|
||||
mapActivity.getRoutingHelper().setRoutePlanningMode(true);
|
||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||
mapActivity.refreshMap();
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void initZooms() {
|
||||
final OsmandMapTileView view = mapActivity.getMapView();
|
||||
|
@ -436,12 +451,12 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
RoutingHelper routingHelper = app.getRoutingHelper();
|
||||
if (routingHelper.isFollowingMode()) {
|
||||
routingHelper.setRoutePlanningMode(false);
|
||||
mapActivity.getMapViewTrackingUtilities().switchToRoutePlanningMode();
|
||||
switchToRouteFollowingLayout();
|
||||
} else {
|
||||
if (!app.getTargetPointsHelper().checkPointToNavigateShort()) {
|
||||
mapRouteInfoControlDialog.showDialog();
|
||||
} else {
|
||||
touchEvent = 0;
|
||||
mapActivity.getMapViewTrackingUtilities().backToLocationImpl();
|
||||
app.getSettings().FOLLOW_THE_ROUTE.set(true);
|
||||
routingHelper.setFollowingMode(true);
|
||||
|
@ -453,6 +468,8 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
private void stopCounter() {
|
||||
startCounter = 0;
|
||||
|
||||
|
@ -534,14 +551,14 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||
boolean showRouteCalculationControls = routePlanningMode ||
|
||||
((System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS) && routeFollowingMode);
|
||||
boolean showButtons = routePlanningMode || !routeFollowingMode;
|
||||
boolean showMenuButton = showRouteCalculationControls || !routeFollowingMode;
|
||||
updateMyLocation(rh);
|
||||
// routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions );
|
||||
// routePlanningBtn.updateVisibility(showButtons && !routePlanningMode);
|
||||
routePlanningBtn.setIconResId(R.drawable.map_directions );
|
||||
routePlanningBtn.updateVisibility(!routeFollowingMode && !routePlanningMode);
|
||||
|
||||
menuControl.updateVisibility(showButtons);
|
||||
menuControl.updateVisibility(showMenuButton);
|
||||
|
||||
if(routeFollowingMode || routePlanningMode) {
|
||||
mapAppModeShadow.setVisibility(View.GONE);
|
||||
|
|
|
@ -569,10 +569,14 @@ public class MapRouteInfoControl implements IRouteInformationListener {
|
|||
|
||||
public void showDialog() {
|
||||
dialog = createDialog();
|
||||
final boolean switched = mapControlsLayer.switchToRoutePlanningLayout();
|
||||
dialog.show();
|
||||
dialog.setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dlg) {
|
||||
if(switched) {
|
||||
mapControlsLayer.switchToRouteFollowingLayout();
|
||||
}
|
||||
dialog = null;
|
||||
}
|
||||
});
|
||||
|
|
|
@ -132,18 +132,22 @@ public class MapRoutePreferencesControl {
|
|||
dialog.hide();
|
||||
dialog = null;
|
||||
} else {
|
||||
dialog = showDialog();
|
||||
final boolean switched = controlsLayer.switchToRoutePlanningLayout();
|
||||
dialog = createDialog();
|
||||
dialog.show();
|
||||
dialog.setOnDismissListener(new OnDismissListener() {
|
||||
@Override
|
||||
public void onDismiss(DialogInterface dlg) {
|
||||
dialog = null;
|
||||
if(switched) {
|
||||
controlsLayer.switchToRouteFollowingLayout();
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
private Dialog showDialog() {
|
||||
private Dialog createDialog() {
|
||||
Dialog dialog = new Dialog(mapActivity);
|
||||
View ll = createLayout();
|
||||
WindowManager.LayoutParams lp = new WindowManager.LayoutParams();
|
||||
|
|
|
@ -30,7 +30,6 @@ import android.app.AlertDialog.Builder;
|
|||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.graphics.Typeface;
|
||||
import android.util.DisplayMetrics;
|
||||
import android.view.View;
|
||||
import android.view.WindowManager;
|
||||
|
@ -175,6 +174,7 @@ public class MapInfoWidgetsFactory {
|
|||
private View waypointInfoBar;
|
||||
private LocationPointWrapper lastPoint;
|
||||
private TurnDrawable turnDrawable;
|
||||
private int shadowRad;
|
||||
|
||||
public TopTextView(OsmandApplication app, MapActivity map) {
|
||||
topBar = map.findViewById(R.id.map_top_bar);
|
||||
|
@ -208,6 +208,7 @@ public class MapInfoWidgetsFactory {
|
|||
}
|
||||
|
||||
public void updateTextColor(boolean nightMode, int textColor, int textShadowColor, boolean bold, int rad) {
|
||||
this.shadowRad = rad;
|
||||
TextInfoWidget.updateTextColor(addressText, addressTextShadow, textColor, textShadowColor, bold, rad);
|
||||
TextInfoWidget.updateTextColor((TextView) waypointInfoBar.findViewById(R.id.waypoint_text),
|
||||
(TextView) waypointInfoBar.findViewById(R.id.waypoint_text_shadow),
|
||||
|
@ -263,7 +264,7 @@ public class MapInfoWidgetsFactory {
|
|||
text = "";
|
||||
}
|
||||
}
|
||||
if(!showNextTurn && updateWaypoint()) {
|
||||
if (!showNextTurn && updateWaypoint()) {
|
||||
updateVisibility(true);
|
||||
updateVisibility(addressText, false);
|
||||
updateVisibility(addressTextShadow, false);
|
||||
|
@ -273,7 +274,7 @@ public class MapInfoWidgetsFactory {
|
|||
updateVisibility(true);
|
||||
updateVisibility(waypointInfoBar, false);
|
||||
updateVisibility(addressText, true);
|
||||
updateVisibility(addressTextShadow, true);
|
||||
updateVisibility(addressTextShadow, shadowRad > 0);
|
||||
boolean update = turnDrawable.setTurnType(type[0]);
|
||||
|
||||
int h = addressText.getHeight() / 4 * 3;
|
||||
|
|
|
@ -526,6 +526,7 @@ public class RouteInfoWidgetsFactory {
|
|||
private LanesDrawable lanesDrawable;
|
||||
private View centerInfo;
|
||||
private View progress;
|
||||
private int shadowRadius;
|
||||
|
||||
public LanesControl(final MapActivity map, final OsmandMapTileView view) {
|
||||
lanesView = (ImageView) map.findViewById(R.id.map_lanes);
|
||||
|
@ -543,6 +544,7 @@ public class RouteInfoWidgetsFactory {
|
|||
}
|
||||
|
||||
public void updateTextSize(boolean isNight, int textColor, int textShadowColor, boolean textBold, int shadowRadius) {
|
||||
this.shadowRadius = shadowRadius;
|
||||
TextInfoWidget.updateTextColor(lanesText, lanesShadowText, textColor, textShadowColor, textBold, shadowRadius);
|
||||
}
|
||||
|
||||
|
@ -613,7 +615,7 @@ public class RouteInfoWidgetsFactory {
|
|||
lanesText.invalidate();
|
||||
}
|
||||
}
|
||||
updateVisibility(lanesShadowText, visible);
|
||||
updateVisibility(lanesShadowText, visible && shadowRadius > 0);
|
||||
updateVisibility(lanesText, visible);
|
||||
updateVisibility(lanesView, visible);
|
||||
updateVisibility(centerInfo, visible || progress.getVisibility() == View.VISIBLE);
|
||||
|
|
Loading…
Reference in a new issue