Fix finish point row visibility for follow track
This commit is contained in:
parent
529b77c077
commit
8b17b7dc85
4 changed files with 45 additions and 17 deletions
|
@ -328,7 +328,7 @@
|
|||
</LinearLayout>
|
||||
|
||||
<View
|
||||
android:id="@+id/viaLayoutDivider"
|
||||
android:id="@+id/toLayoutDivider"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginStart="@dimen/route_info_start_divider_margin"
|
||||
|
|
|
@ -35,8 +35,6 @@ import net.osmand.data.PointDescription;
|
|||
import net.osmand.data.QuadRect;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.map.ITileSource;
|
||||
import net.osmand.plus.dialogs.SpeedCamerasBottomSheet;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.ContextMenuAdapter;
|
||||
import net.osmand.plus.ContextMenuAdapter.ItemClickListener;
|
||||
import net.osmand.plus.ContextMenuItem;
|
||||
|
@ -46,7 +44,6 @@ import net.osmand.plus.MapMarkersHelper.MapMarker;
|
|||
import net.osmand.plus.OsmAndLocationProvider;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.OsmandPlugin;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.UiUtilities;
|
||||
|
@ -54,6 +51,7 @@ import net.osmand.plus.Version;
|
|||
import net.osmand.plus.activities.actions.OsmAndDialogs;
|
||||
import net.osmand.plus.dashboard.DashboardOnMap.DashboardType;
|
||||
import net.osmand.plus.dialogs.FavoriteDialogs;
|
||||
import net.osmand.plus.dialogs.SpeedCamerasBottomSheet;
|
||||
import net.osmand.plus.download.IndexItem;
|
||||
import net.osmand.plus.liveupdates.OsmLiveActivity;
|
||||
import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment;
|
||||
|
@ -66,11 +64,13 @@ import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
|||
import net.osmand.plus.routepreparationmenu.WaypointsFragment;
|
||||
import net.osmand.plus.routing.RouteProvider.GPXRouteParamsBuilder;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.settings.fragments.BaseSettingsFragment;
|
||||
import net.osmand.plus.views.BaseMapLayer;
|
||||
import net.osmand.plus.views.layers.MapControlsLayer;
|
||||
import net.osmand.plus.views.MapTileLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.layers.MapControlsLayer;
|
||||
import net.osmand.plus.wikipedia.WikipediaDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.WikivoyageWelcomeDialogFragment;
|
||||
import net.osmand.plus.wikivoyage.data.TravelDbHelper;
|
||||
|
@ -106,7 +106,6 @@ import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_A
|
|||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_ADD_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_AVOID_ROAD;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_DIRECTIONS_FROM_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_EDIT_GPX_WP;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MARKER_ID;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MEASURE_DISTANCE;
|
||||
import static net.osmand.aidlapi.OsmAndCustomizationConstants.MAP_CONTEXT_MENU_MORE_ID;
|
||||
|
@ -512,7 +511,9 @@ public class MapActivityActions implements DialogProvider {
|
|||
TargetPointsHelper tg = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||
tg.clearStartPoint(false);
|
||||
Location finishLoc = ps.get(ps.size() - 1);
|
||||
tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), false, -1);
|
||||
PointDescription point = new PointDescription(PointDescription.POINT_TYPE_GPX, result.path, "");
|
||||
point.setName(PointDescription.getSearchAddressStr(mapActivity));
|
||||
tg.navigateToPoint(new LatLon(finishLoc.getLatitude(), finishLoc.getLongitude()), false, -1, point);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -128,7 +128,7 @@ import java.util.Stack;
|
|||
public class MapRouteInfoMenu implements IRouteInformationListener, CardListener, FavoritesListener {
|
||||
|
||||
private static final Log LOG = PlatformUtil.getLog(MapRouteInfoMenu.class);
|
||||
|
||||
|
||||
private static final int BUTTON_ANIMATION_DELAY = 2000;
|
||||
public static final int DEFAULT_MENU_STATE = 0;
|
||||
private static final int MAX_PEDESTRIAN_ROUTE_DURATION = 30 * 60;
|
||||
|
@ -452,7 +452,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
fragment.updateInfo();
|
||||
if (!routeCalculationInProgress) {
|
||||
fragment.hideRouteCalculationProgressBar();
|
||||
if(!app.getSettings().OPEN_ONLY_HEADER_STATE_ROUTE_CALCULATED.
|
||||
if (!app.getSettings().OPEN_ONLY_HEADER_STATE_ROUTE_CALCULATED.
|
||||
getModeValue(app.getRoutingHelper().getAppMode())) {
|
||||
fragment.openMenuHalfScreen();
|
||||
} else {
|
||||
|
@ -1544,17 +1544,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
}
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
View viaLayout = mainView.findViewById(R.id.ViaLayout);
|
||||
View viaLayoutDivider = mainView.findViewById(R.id.viaLayoutDivider);
|
||||
|
||||
String viaDescription = generateViaDescription();
|
||||
GPXRouteParamsBuilder routeParams = app.getRoutingHelper().getCurrentGPXRoute();
|
||||
if (routeParams == null && Algorithms.isEmpty(viaDescription)) {
|
||||
AndroidUiHelper.updateVisibility(viaLayout, false);
|
||||
AndroidUiHelper.updateVisibility(viaLayoutDivider, false);
|
||||
return;
|
||||
} else {
|
||||
AndroidUiHelper.updateVisibility(viaLayout, true);
|
||||
AndroidUiHelper.updateVisibility(viaLayoutDivider, true);
|
||||
}
|
||||
|
||||
if (routeParams != null) {
|
||||
|
@ -1578,6 +1575,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
setupViaText(mainView);
|
||||
|
||||
FrameLayout viaButton = (FrameLayout) mainView.findViewById(R.id.via_button);
|
||||
AndroidUiHelper.updateVisibility(viaButton, isFinishPointFromTrack());
|
||||
viaButton.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -1663,8 +1661,20 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
}
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
|
||||
setupToText(mainView);
|
||||
final View toLayout = mainView.findViewById(R.id.ToLayout);
|
||||
View toLayout = mainView.findViewById(R.id.ToLayout);
|
||||
View viaLayout = mainView.findViewById(R.id.ViaLayout);
|
||||
View toLayoutDivider = mainView.findViewById(R.id.toLayoutDivider);
|
||||
|
||||
if (isFinishPointFromTrack()) {
|
||||
AndroidUiHelper.updateVisibility(toLayout, false);
|
||||
AndroidUiHelper.updateVisibility(toLayoutDivider, false);
|
||||
return;
|
||||
} else {
|
||||
boolean dividerVisible = viaLayout.getVisibility() == View.VISIBLE;
|
||||
AndroidUiHelper.updateVisibility(toLayout, true);
|
||||
AndroidUiHelper.updateVisibility(toLayoutDivider, dividerVisible);
|
||||
}
|
||||
|
||||
toLayout.setOnClickListener(new OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
@ -1674,6 +1684,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
}
|
||||
}
|
||||
});
|
||||
setupToText(mainView);
|
||||
|
||||
FrameLayout toButton = (FrameLayout) mainView.findViewById(R.id.to_button);
|
||||
if (app.getRoutingHelper().isPublicTransportMode()) {
|
||||
|
@ -1727,6 +1738,22 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
toIcon.setImageDrawable(getIconOrig(R.drawable.list_destination));
|
||||
}
|
||||
|
||||
private boolean isFinishPointFromTrack() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
GPXRouteParamsBuilder routeParams = app.getRoutingHelper().getCurrentGPXRoute();
|
||||
if (routeParams != null) {
|
||||
TargetPoint target = app.getTargetPointsHelper().getPointToNavigate();
|
||||
if (target != null) {
|
||||
PointDescription pointDescription = target.getOriginalPointDescription();
|
||||
return pointDescription != null && routeParams.getFile().path.equals(pointDescription.getTypeName());
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updateStartPointView() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
final View mainView = getMainView();
|
||||
|
@ -1866,7 +1893,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
addButtonCollapsing = false;
|
||||
}
|
||||
|
||||
private void setupButtonIcon(ImageView imageView, @DrawableRes int iconId){
|
||||
private void setupButtonIcon(ImageView imageView, @DrawableRes int iconId) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
UiUtilities uiUtilities = mapActivity.getMyApplication().getUIUtilities();
|
||||
|
@ -1880,7 +1907,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
}
|
||||
}
|
||||
|
||||
private void setupButtonBackground(View button, View buttonContainer){
|
||||
private void setupButtonBackground(View button, View buttonContainer) {
|
||||
if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) {
|
||||
AndroidUtils.setBackground(app, button, nightMode, R.drawable.btn_rounded_light, R.drawable.btn_rounded_dark);
|
||||
AndroidUtils.setBackground(app, buttonContainer, nightMode, R.drawable.ripple_rounded_light, R.drawable.ripple_rounded_dark);
|
||||
|
|
|
@ -462,7 +462,7 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
R.color.card_and_list_background_light, R.color.card_and_list_background_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerFromDropDown), isNightMode(),
|
||||
R.color.divider_color_light, R.color.divider_color_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.viaLayoutDivider), isNightMode(),
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.toLayoutDivider), isNightMode(),
|
||||
R.color.divider_color_light, R.color.divider_color_dark);
|
||||
AndroidUtils.setBackground(ctx, mainView.findViewById(R.id.dividerButtons), isNightMode(),
|
||||
R.color.divider_color_light, R.color.divider_color_dark);
|
||||
|
|
Loading…
Reference in a new issue