Fix menu state after selection on map
This commit is contained in:
parent
c0faad79dc
commit
8d33234eb3
3 changed files with 21 additions and 5 deletions
|
@ -87,7 +87,6 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
createSwitchStartAndEndItem();
|
||||
break;
|
||||
case TARGET:
|
||||
createMyLocItem();
|
||||
createSelectOnTheMapItem();
|
||||
createFavouritesItem();
|
||||
createMarkersItem();
|
||||
|
|
|
@ -92,6 +92,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
|
||||
private boolean selectFromMapTouch;
|
||||
private PointType selectFromMapPointType;
|
||||
private int selectFromMapMenuState = MenuState.HEADER_ONLY;
|
||||
|
||||
private boolean showMenu = false;
|
||||
private MapActivity mapActivity;
|
||||
|
@ -194,7 +195,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
targets.setWorkPoint(latlon, null);
|
||||
break;
|
||||
}
|
||||
show();
|
||||
show(selectFromMapMenuState);
|
||||
if (selectFromMapPointType == PointType.INTERMEDIATE && targets.checkPointToNavigateShort()) {
|
||||
WaypointsFragment.showInstance(mapActivity);
|
||||
}
|
||||
|
@ -1071,6 +1072,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
public void selectOnScreen(PointType pointType) {
|
||||
selectFromMapTouch = true;
|
||||
selectFromMapPointType = pointType;
|
||||
selectFromMapMenuState = currentMenuState;
|
||||
hide();
|
||||
}
|
||||
|
||||
|
@ -1347,8 +1349,12 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
|||
}
|
||||
|
||||
public void show() {
|
||||
show(getInitialMenuState());
|
||||
}
|
||||
|
||||
public void show(int menuState) {
|
||||
if (!visible) {
|
||||
currentMenuState = getInitialMenuState();
|
||||
currentMenuState = menuState;
|
||||
visible = true;
|
||||
switched = mapControlsLayer.switchToRoutePlanningLayout();
|
||||
boolean refreshMap = !switched;
|
||||
|
|
|
@ -6,6 +6,7 @@ import android.view.View;
|
|||
import android.widget.TextView;
|
||||
|
||||
import net.osmand.AndroidUtils;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
|
@ -47,8 +48,18 @@ public class PreviousRouteCard extends BaseCard {
|
|||
}
|
||||
startTitle.setText(startText.toString());
|
||||
TargetPoint destinationPoint = targetPointsHelper.getPointToNavigateBackup();
|
||||
destinationTitle.setText(destinationPoint != null ?
|
||||
destinationPoint.getPointDescription(mapActivity).getSimpleName(mapActivity, false) : "");
|
||||
String destinationName = "";
|
||||
if (destinationPoint != null) {
|
||||
PointDescription description = destinationPoint.getOriginalPointDescription();
|
||||
if (description != null && !Algorithms.isEmpty(description.getName()) &&
|
||||
!description.getName().equals(mapActivity.getString(R.string.no_address_found))) {
|
||||
destinationName = description.getName();
|
||||
} else {
|
||||
destinationName = PointDescription.getLocationName(mapActivity,
|
||||
destinationPoint.point.getLatitude(), destinationPoint.point.getLongitude(), true).replace('\n', ' ');
|
||||
}
|
||||
}
|
||||
destinationTitle.setText(destinationName);
|
||||
View homeButton = view.findViewById(R.id.card_button);
|
||||
homeButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue