use of net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder in project Osmand by osmandapp.
the class MapRouteInfoMenu method updateViaView.
private void updateViaView() {
View mainView = getMainView();
MapActivity mapActivity = getMapActivity();
if (mapActivity == null || mainView == null) {
return;
}
OsmandApplication app = mapActivity.getMyApplication();
View viaLayout = mainView.findViewById(R.id.ViaLayout);
String viaDescription = generateViaDescription();
GPXRouteParamsBuilder routeParams = app.getRoutingHelper().getCurrentGPXRoute();
if (routeParams == null && Algorithms.isEmpty(viaDescription)) {
AndroidUiHelper.updateVisibility(viaLayout, false);
return;
} else {
AndroidUiHelper.updateVisibility(viaLayout, true);
}
if (routeParams != null) {
viaLayout.setOnClickListener(v -> {
MapActivity mapActivity1 = getMapActivity();
if (mapActivity1 != null) {
GPXRouteParamsBuilder routeParams1 = mapActivity1.getRoutingHelper().getCurrentGPXRoute();
if (routeParams1 != null) {
hide();
selectTrack();
}
}
});
} else {
viaLayout.setClickable(false);
viaLayout.setOnClickListener(null);
}
setupViaText(mainView);
FrameLayout viaButton = mainView.findViewById(R.id.via_button);
AndroidUiHelper.updateVisibility(viaButton, routeParams == null || isFinishPointFromTrack());
viaButton.setOnClickListener(v -> {
MapActivity mapActivity12 = getMapActivity();
if (mapActivity12 != null) {
GPXRouteParamsBuilder routeParams12 = mapActivity12.getRoutingHelper().getCurrentGPXRoute();
if (routeParams12 != null) {
AddPointBottomSheetDialog.showInstance(mapActivity12, PointType.TARGET);
} else if (mapActivity12.getMyApplication().getTargetPointsHelper().checkPointToNavigateShort()) {
hide();
WaypointsFragment.showInstance(mapActivity12.getSupportFragmentManager(), true);
}
}
});
LinearLayout viaButtonContainer = mainView.findViewById(R.id.via_button_container);
setupButtonBackground(viaButton, viaButtonContainer);
ImageView viaButtonImageView = mainView.findViewById(R.id.via_button_image_view);
int iconId = routeParams != null ? R.drawable.ic_action_plus : R.drawable.ic_action_edit_dark;
setupButtonIcon(viaButtonImageView, iconId);
final View textView = mainView.findViewById(R.id.via_button_description);
if (!editButtonCollapsing && !editButtonCollapsed && viaButton.getVisibility() == View.VISIBLE && textView.getVisibility() == View.VISIBLE) {
editButtonCollapsing = true;
collapseButtonAnimated(R.id.via_button, R.id.via_button_description, success -> {
editButtonCollapsing = false;
editButtonCollapsed = success;
});
} else if (editButtonCollapsed) {
textView.setVisibility(View.GONE);
}
updateViaIcon(mainView);
}
use of net.osmand.plus.routing.GPXRouteParams.GPXRouteParamsBuilder in project Osmand by osmandapp.
the class MapRouteInfoMenu method updateViaIcon.
private void updateViaIcon(View parentView) {
ImageView viaIcon = parentView.findViewById(R.id.viaIcon);
OsmandApplication app = (OsmandApplication) parentView.getContext().getApplicationContext();
GPXRouteParamsBuilder routeParams = app.getRoutingHelper().getCurrentGPXRoute();
if (routeParams != null) {
viaIcon.setImageDrawable(app.getUIUtilities().getThemedIcon(R.drawable.ic_action_polygom_dark));
} else {
viaIcon.setImageDrawable(getIconOrig(R.drawable.list_intermediate));
}
}
Aggregations