diff --git a/OsmAnd/res/layout/route_directions_card.xml b/OsmAnd/res/layout/route_directions_card.xml new file mode 100644 index 0000000000..09e313bd02 --- /dev/null +++ b/OsmAnd/res/layout/route_directions_card.xml @@ -0,0 +1,27 @@ + + + + + + + + \ No newline at end of file diff --git a/OsmAnd/res/layout/route_info_header.xml b/OsmAnd/res/layout/route_info_header.xml index 5ddd977456..7fa1246257 100644 --- a/OsmAnd/res/layout/route_info_header.xml +++ b/OsmAnd/res/layout/route_info_header.xml @@ -121,6 +121,7 @@ + android:visibility="visible"/> routeDirections = app.getRoutingHelper().getRouteDirections(); - for (int i = 0; i < routeDirections.size(); i++) { - RouteDirectionInfo routeDirectionInfo = routeDirections.get(i); - OnClickListener onClickListener = createRouteDirectionInfoViewClickListener(i, routeDirectionInfo); - View view = getRouteDirectionView(i, routeDirectionInfo, routeDirections, onClickListener); - cardsContainer.addView(view); - } - } - - private OnClickListener createRouteDirectionInfoViewClickListener(final int directionInfoIndex, final RouteDirectionInfo routeDirectionInfo) { - return new OnClickListener() { - @Override - public void onClick(View view) { - OsmandApplication app = requireMyApplication(); - Location loc = app.getRoutingHelper().getLocationFromRouteDirection(routeDirectionInfo); - if (loc != null) { - MapRouteInfoMenu.directionInfo = directionInfoIndex; - OsmandSettings settings = app.getSettings(); - settings.setMapLocationToShow(loc.getLatitude(), loc.getLongitude(), - Math.max(13, settings.getLastKnownMapZoom()), - new PointDescription(PointDescription.POINT_TYPE_MARKER, - routeDirectionInfo.getDescriptionRoutePart() + " " + getTimeDescription(app, routeDirectionInfo)), - false, null); - MapActivity.launchMapActivityMoveToTop(getActivity()); - dismiss(); - } - } - }; - } - private void createRouteStatisticCards(LinearLayout cardsContainer) { MapActivity mapActivity = getMapActivity(); if (mapActivity == null) { return; } OsmandApplication app = mapActivity.getMyApplication(); + RouteStatisticCard statisticCard = new RouteStatisticCard(mapActivity, gpx, new View.OnTouchListener() { + @Override + public boolean onTouch(View v, MotionEvent event) { + InterceptorLinearLayout mainView = getMainView(); + if (mainView != null) { + mainView.requestDisallowInterceptTouchEvent(true); + } + return false; + } + }, new OnClickListener() { + @Override + public void onClick(View v) { + openDetails(); + } + }); + statisticCard.setTransparentBackground(true); + menuCards.add(statisticCard); + cardsContainer.addView(statisticCard.build(mapActivity)); + buildRowDivider(cardsContainer, false); + slopeDataSet = statisticCard.getSlopeDataSet(); + elevationDataSet = statisticCard.getElevationDataSet(); if (gpx.hasAltitude) { - RouteStatisticCard statisticCard = new RouteStatisticCard(mapActivity, gpx, new View.OnTouchListener() { - @Override - public boolean onTouch(View v, MotionEvent event) { - InterceptorLinearLayout mainView = getMainView(); - if (mainView != null) { - mainView.requestDisallowInterceptTouchEvent(true); - } - return false; - } - }, new OnClickListener() { - @Override - public void onClick(View v) { - openDetails(); - } - }); - statisticCard.setTransparentBackground(true); - menuCards.add(statisticCard); - cardsContainer.addView(statisticCard.build(mapActivity)); - buildRowDivider(cardsContainer, false); - slopeDataSet = statisticCard.getSlopeDataSet(); - elevationDataSet = statisticCard.getElevationDataSet(); List route = app.getRoutingHelper().getRoute().getOriginalRoute(); if (route != null) { RenderingRulesStorage currentRenderer = app.getRendererRegistry().getCurrentSelectedRenderer(); @@ -360,6 +316,19 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT } } + private void createRouteDirectionsCard(LinearLayout cardsContainer) { + MapActivity mapActivity = getMapActivity(); + if (mapActivity == null) { + return; + } + RouteDirectionsCard directionsCard = new RouteDirectionsCard(mapActivity); + directionsCard.setTransparentBackground(true); + directionsCard.setListener(this); + menuCards.add(directionsCard); + cardsContainer.addView(directionsCard.build(mapActivity)); + buildRowDivider(cardsContainer, false); + } + private void createRouteCard(LinearLayout cardsContainer, RouteInfoCard routeInfoCard) { OsmandApplication app = requireMyApplication(); menuCards.add(routeInfoCard); @@ -374,7 +343,7 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT } private void buildSegmentItem(View view, final TransportRouteResultSegment segment, - final TransportRouteResultSegment nextSegment, int[] startTime, double walkSpeed, double boardingTime) { + final TransportRouteResultSegment nextSegment, int[] startTime, double walkSpeed, double boardingTime) { OsmandApplication app = requireMyApplication(); TransportRoute transportRoute = segment.route; List stops = segment.getTravelStops(); @@ -1483,6 +1452,30 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT } } + private void showDirectionsInfo(int directionInfoIndex) { + MapActivity mapActivity = getMapActivity(); + if (mapActivity == null) { + return; + } + RoutingHelper helper = mapActivity.getRoutingHelper(); + List routeDirections = helper.getRouteDirections(); + if (routeDirections.size() > directionInfoIndex) { + RouteDirectionInfo routeDirectionInfo = routeDirections.get(directionInfoIndex); + Location loc = helper.getLocationFromRouteDirection(routeDirectionInfo); + if (loc != null) { + MapRouteInfoMenu.directionInfo = directionInfoIndex; + OsmandSettings settings = mapActivity.getMyApplication().getSettings(); + settings.setMapLocationToShow(loc.getLatitude(), loc.getLongitude(), + Math.max(13, settings.getLastKnownMapZoom()), + new PointDescription(PointDescription.POINT_TYPE_MARKER, + routeDirectionInfo.getDescriptionRoutePart() + " " + getTimeDescription(mapActivity.getMyApplication(), routeDirectionInfo)), + false, null); + MapActivity.launchMapActivityMoveToTop(mapActivity); + dismiss(); + } + } + } + @Override public void onPublicTransportCardBadgePressed(@NonNull PublicTransportCard card, @NonNull TransportRouteResultSegment segment) { showRouteSegmentOnMap(segment); @@ -1512,6 +1505,8 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT public void onCardButtonPressed(@NonNull BaseCard card, int buttonIndex) { if (card instanceof PublicTransportCard && buttonIndex == 0) { openMenuFullScreen(); + } else if (card instanceof RouteDirectionsCard && buttonIndex >= 0) { + showDirectionsInfo(buttonIndex); } } @@ -1525,48 +1520,6 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT } } - public View getRouteDirectionView(int position, RouteDirectionInfo model, List directionsInfo, OnClickListener onClickListener) { - MapActivity mapActivity = getMapActivity(); - if (mapActivity == null) { - return null; - } - OsmandApplication app = mapActivity.getMyApplication(); - ContextThemeWrapper context = new ContextThemeWrapper(mapActivity, isNightMode() ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme); - View row = LayoutInflater.from(context).inflate(R.layout.route_info_list_item, null); - - TextView label = (TextView) row.findViewById(R.id.description); - TextView distanceLabel = (TextView) row.findViewById(R.id.distance); - TextView timeLabel = (TextView) row.findViewById(R.id.time); - TextView cumulativeDistanceLabel = (TextView) row.findViewById(R.id.cumulative_distance); - TextView cumulativeTimeLabel = (TextView) row.findViewById(R.id.cumulative_time); - ImageView icon = (ImageView) row.findViewById(R.id.direction); - row.findViewById(R.id.divider).setVisibility(position == directionsInfo.size() - 1 ? View.INVISIBLE : View.VISIBLE); - - TurnPathHelper.RouteDrawable drawable = new TurnPathHelper.RouteDrawable(getResources(), true); - drawable.setColorFilter(new PorterDuffColorFilter(getActiveColor(), PorterDuff.Mode.SRC_ATOP)); - drawable.setRouteType(model.getTurnType()); - icon.setImageDrawable(drawable); - - label.setText(model.getDescriptionRoutePart()); - if (model.distance > 0) { - distanceLabel.setText(OsmAndFormatter.getFormattedDistance(model.distance, app)); - timeLabel.setText(getTimeDescription(app, model)); - row.setContentDescription(label.getText() + " " + timeLabel.getText()); - } else { - if (Algorithms.isEmpty(label.getText().toString())) { - label.setText(getString((position != directionsInfo.size() - 1) ? R.string.arrived_at_intermediate_point : R.string.arrived_at_destination)); - } - distanceLabel.setText(""); - timeLabel.setText(""); - row.setContentDescription(""); - } - CumulativeInfo cumulativeInfo = getRouteDirectionCumulativeInfo(position, directionsInfo); - cumulativeDistanceLabel.setText(OsmAndFormatter.getFormattedDistance(cumulativeInfo.distance, app)); - cumulativeTimeLabel.setText(Algorithms.formatDuration(cumulativeInfo.time, app.accessibilityEnabled())); - row.setOnClickListener(onClickListener); - return row; - } - public static CumulativeInfo getRouteDirectionCumulativeInfo(int position, List routeDirections) { CumulativeInfo cumulativeInfo = new CumulativeInfo(); if (position >= routeDirections.size()) { diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/WaypointsFragment.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/WaypointsFragment.java index 3d1fb1ac8d..386a67ee8d 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/WaypointsFragment.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/WaypointsFragment.java @@ -41,6 +41,7 @@ import net.osmand.plus.TargetPointsHelper; import net.osmand.plus.TargetPointsHelper.TargetPoint; import net.osmand.plus.activities.MapActivity; import net.osmand.plus.base.BaseOsmAndFragment; +import net.osmand.plus.base.ContextMenuFragment; import net.osmand.plus.helpers.AndroidUiHelper; import net.osmand.plus.helpers.WaypointDialogHelper; import net.osmand.plus.helpers.WaypointDialogHelper.TargetOptionsBottomSheetDialogFragment; @@ -59,6 +60,8 @@ import java.util.ArrayList; import java.util.List; import static net.osmand.plus.helpers.WaypointDialogHelper.showOnMap; +import static net.osmand.plus.routepreparationmenu.ChooseRouteFragment.INITIAL_MENU_STATE_KEY; +import static net.osmand.plus.routepreparationmenu.ChooseRouteFragment.ROUTE_INFO_STATE_KEY; public class WaypointsFragment extends BaseOsmAndFragment implements ObservableScrollViewCallbacks, DynamicListViewCallbacks, WaypointDialogHelper.WaypointDialogHelperCallback { @@ -88,6 +91,8 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS private boolean nightMode; private boolean wasDrawerDisabled; + private int routeInfoMenuState = -1; + @Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); @@ -107,7 +112,10 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS return null; } AndroidUtils.addStatusBarPadding21v(app, view); - + Bundle args = getArguments(); + if (args != null) { + routeInfoMenuState = args.getInt(ROUTE_INFO_STATE_KEY, -1); + } mainView = view.findViewById(R.id.main_view); listView = (DynamicListView) view.findViewById(R.id.dash_list_view); @@ -434,6 +442,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS AndroidUtils.setBackground(app, clearButtonDescr, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark); } AndroidUtils.setBackground(app, view.findViewById(R.id.cancel_button), nightMode, R.color.card_and_list_background_light, R.color.card_and_list_background_dark); + AndroidUtils.setBackground(app, view.findViewById(R.id.controls_divider), nightMode, R.color.divider_light, R.color.divider_dark); ((TextView) view.findViewById(R.id.cancel_button_descr)).setTextColor(colorActive); ((TextView) view.findViewById(R.id.start_button_descr)).setText(getText(R.string.shared_string_apply)); @@ -864,15 +873,21 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS } } - public static boolean showInstance(final MapActivity mapActivity) { - try { - mapActivity.getContextMenu().hideMenues(); + public static boolean showInstance(FragmentManager fragmentManager) { + return WaypointsFragment.showInstance(fragmentManager, -1, ContextMenuFragment.MenuState.HEADER_ONLY); + } + public static boolean showInstance(FragmentManager fragmentManager, int routeInfoState, int initialMenuState) { + try { WaypointsFragment fragment = new WaypointsFragment(); - mapActivity.getSupportFragmentManager() - .beginTransaction() + + Bundle args = new Bundle(); + args.putInt(ROUTE_INFO_STATE_KEY, routeInfoState); + args.putInt(INITIAL_MENU_STATE_KEY, initialMenuState); + fragment.setArguments(args); + + fragmentManager.beginTransaction() .add(R.id.routeMenuContainer, fragment, TAG) - .addToBackStack(TAG) .commitAllowingStateLoss(); return true; @@ -883,14 +898,16 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS } private void dismiss() { - FragmentActivity activity = getActivity(); - if (activity != null) { - try { - activity.getSupportFragmentManager().popBackStack(TAG, - FragmentManager.POP_BACK_STACK_INCLUSIVE); - } catch (Exception e) { - // + try { + MapActivity mapActivity = (MapActivity) getActivity(); + if (mapActivity != null) { + mapActivity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss(); + if (routeInfoMenuState != -1) { + mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog(routeInfoMenuState); + } } + } catch (Exception e) { + // } } } \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteDirectionsCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteDirectionsCard.java new file mode 100644 index 0000000000..09380e43d6 --- /dev/null +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteDirectionsCard.java @@ -0,0 +1,105 @@ +package net.osmand.plus.routepreparationmenu.cards; + +import android.graphics.PorterDuff; +import android.graphics.PorterDuffColorFilter; +import android.support.annotation.NonNull; +import android.support.v7.view.ContextThemeWrapper; +import android.view.LayoutInflater; +import android.view.View; +import android.widget.ImageView; +import android.widget.LinearLayout; +import android.widget.TextView; + +import net.osmand.plus.OsmAndFormatter; +import net.osmand.plus.OsmandApplication; +import net.osmand.plus.R; +import net.osmand.plus.activities.MapActivity; +import net.osmand.plus.routepreparationmenu.RouteDetailsFragment; +import net.osmand.plus.routing.RouteDirectionInfo; +import net.osmand.plus.views.TurnPathHelper; +import net.osmand.util.Algorithms; + +import java.util.List; + +public class RouteDirectionsCard extends BaseCard { + + public RouteDirectionsCard(@NonNull MapActivity mapActivity) { + super(mapActivity); + } + + @Override + public int getCardLayoutId() { + return R.layout.route_directions_card; + } + + @Override + protected void updateContent() { + LinearLayout root = (LinearLayout) view.findViewById(R.id.items); + root.removeAllViews(); + createRouteDirections(root); + } + + private void createRouteDirections(LinearLayout cardsContainer) { + List routeDirections = app.getRoutingHelper().getRouteDirections(); + for (int i = 0; i < routeDirections.size(); i++) { + RouteDirectionInfo routeDirectionInfo = routeDirections.get(i); + View view = getRouteDirectionView(i, routeDirectionInfo, routeDirections); + cardsContainer.addView(view); + } + } + + private static String getTimeDescription(OsmandApplication app, RouteDirectionInfo model) { + final int timeInSeconds = model.getExpectedTime(); + return Algorithms.formatDuration(timeInSeconds, app.accessibilityEnabled()); + } + + private View getRouteDirectionView(final int directionInfoIndex, RouteDirectionInfo model, List directionsInfo) { + MapActivity mapActivity = getMapActivity(); + if (mapActivity == null) { + return null; + } + OsmandApplication app = mapActivity.getMyApplication(); + ContextThemeWrapper context = new ContextThemeWrapper(mapActivity, nightMode ? R.style.OsmandDarkTheme : R.style.OsmandLightTheme); + View row = LayoutInflater.from(context).inflate(R.layout.route_info_list_item, null); + + TextView label = (TextView) row.findViewById(R.id.description); + TextView distanceLabel = (TextView) row.findViewById(R.id.distance); + TextView timeLabel = (TextView) row.findViewById(R.id.time); + TextView cumulativeDistanceLabel = (TextView) row.findViewById(R.id.cumulative_distance); + TextView cumulativeTimeLabel = (TextView) row.findViewById(R.id.cumulative_time); + ImageView icon = (ImageView) row.findViewById(R.id.direction); + row.findViewById(R.id.divider).setVisibility(directionInfoIndex == directionsInfo.size() - 1 ? View.INVISIBLE : View.VISIBLE); + + TurnPathHelper.RouteDrawable drawable = new TurnPathHelper.RouteDrawable(mapActivity.getResources(), true); + drawable.setColorFilter(new PorterDuffColorFilter(getActiveColor(), PorterDuff.Mode.SRC_ATOP)); + drawable.setRouteType(model.getTurnType()); + icon.setImageDrawable(drawable); + + label.setText(model.getDescriptionRoutePart()); + if (model.distance > 0) { + distanceLabel.setText(OsmAndFormatter.getFormattedDistance(model.distance, app)); + timeLabel.setText(getTimeDescription(app, model)); + row.setContentDescription(label.getText() + " " + timeLabel.getText()); + } else { + if (Algorithms.isEmpty(label.getText().toString())) { + label.setText(mapActivity.getString((directionInfoIndex != directionsInfo.size() - 1) ? R.string.arrived_at_intermediate_point : R.string.arrived_at_destination)); + } + distanceLabel.setText(""); + timeLabel.setText(""); + row.setContentDescription(""); + } + RouteDetailsFragment.CumulativeInfo cumulativeInfo = RouteDetailsFragment.getRouteDirectionCumulativeInfo(directionInfoIndex, directionsInfo); + cumulativeDistanceLabel.setText(OsmAndFormatter.getFormattedDistance(cumulativeInfo.distance, app)); + cumulativeTimeLabel.setText(Algorithms.formatDuration(cumulativeInfo.time, app.accessibilityEnabled())); + row.setOnClickListener(new View.OnClickListener() { + @Override + public void onClick(View v) { + CardListener listener = getListener(); + if (listener != null) { + listener.onCardButtonPressed(RouteDirectionsCard.this, directionInfoIndex); + } + } + }); + return row; + } +} \ No newline at end of file diff --git a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteStatisticCard.java b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteStatisticCard.java index 4754894e9a..6f42fe128b 100644 --- a/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteStatisticCard.java +++ b/OsmAnd/src/net/osmand/plus/routepreparationmenu/cards/RouteStatisticCard.java @@ -100,40 +100,49 @@ public class RouteStatisticCard extends BaseCard { String arriveStr = app.getString(R.string.arrive_at_time, OsmAndFormatter.getFormattedTime(time, true)); arriveTimeTv.setText(arriveStr); - GPXTrackAnalysis analysis = gpx.getAnalysis(0); - - buildHeader(analysis); - - ((TextView) view.findViewById(R.id.average_text)).setText(OsmAndFormatter.getFormattedAlt(analysis.avgElevation, app)); - - String min = OsmAndFormatter.getFormattedAlt(analysis.minElevation, app); - String max = OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app); - ((TextView) view.findViewById(R.id.range_text)).setText(min + " - " + max); - - String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app); - String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app); - ((TextView) view.findViewById(R.id.descent_text)).setText(desc); - ((TextView) view.findViewById(R.id.ascent_text)).setText(asc); - - ((ImageView) view.findViewById(R.id.average_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_average)); - ((ImageView) view.findViewById(R.id.range_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_average)); - ((ImageView) view.findViewById(R.id.descent_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_descent)); - ((ImageView) view.findViewById(R.id.ascent_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_ascent)); + buildSlopeInfo(); if (isTransparentBackground()) { view.setBackgroundDrawable(null); } + } - FrameLayout analyseButton = (FrameLayout) view.findViewById(R.id.analyse_button); - TextView analyseButtonDescr = (TextView) view.findViewById(R.id.analyse_button_descr); + private void buildSlopeInfo() { + GPXTrackAnalysis analysis = gpx.getAnalysis(0); - if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { - AndroidUtils.setBackground(app, analyseButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark); - AndroidUtils.setBackground(app, analyseButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark); - } else { - AndroidUtils.setBackground(app, analyseButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark); + buildHeader(analysis); + if (analysis.hasElevationData) { + ((TextView) view.findViewById(R.id.average_text)).setText(OsmAndFormatter.getFormattedAlt(analysis.avgElevation, app)); + + String min = OsmAndFormatter.getFormattedAlt(analysis.minElevation, app); + String max = OsmAndFormatter.getFormattedAlt(analysis.maxElevation, app); + ((TextView) view.findViewById(R.id.range_text)).setText(min + " - " + max); + + String asc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationUp, app); + String desc = OsmAndFormatter.getFormattedAlt(analysis.diffElevationDown, app); + ((TextView) view.findViewById(R.id.descent_text)).setText(desc); + ((TextView) view.findViewById(R.id.ascent_text)).setText(asc); + + ((ImageView) view.findViewById(R.id.average_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_average)); + ((ImageView) view.findViewById(R.id.range_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_average)); + ((ImageView) view.findViewById(R.id.descent_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_descent)); + ((ImageView) view.findViewById(R.id.ascent_icon)).setImageDrawable(getContentIcon(R.drawable.ic_action_altitude_ascent)); + + TextView analyseButtonDescr = (TextView) view.findViewById(R.id.analyse_button_descr); + + FrameLayout analyseButton = (FrameLayout) view.findViewById(R.id.analyse_button); + if (Build.VERSION.SDK_INT > Build.VERSION_CODES.LOLLIPOP) { + AndroidUtils.setBackground(app, analyseButton, nightMode, R.drawable.btn_border_light, R.drawable.btn_border_dark); + AndroidUtils.setBackground(app, analyseButtonDescr, nightMode, R.drawable.ripple_light, R.drawable.ripple_dark); + } else { + AndroidUtils.setBackground(app, analyseButton, nightMode, R.drawable.btn_border_trans_light, R.drawable.btn_border_trans_dark); + } + analyseButton.setOnClickListener(onAnalyseClickListener); } - analyseButton.setOnClickListener(onAnalyseClickListener); + view.findViewById(R.id.altitude_container).setVisibility(analysis.hasElevationData ? View.VISIBLE : View.GONE); + view.findViewById(R.id.slope_info_divider).setVisibility(analysis.hasElevationData ? View.VISIBLE : View.GONE); + view.findViewById(R.id.slope_container).setVisibility(analysis.hasElevationData ? View.VISIBLE : View.GONE); + view.findViewById(R.id.buttons_container).setVisibility(analysis.hasElevationData ? View.VISIBLE : View.GONE); } @Nullable diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index 6b7d3e6e26..3f187d6042 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -1003,7 +1003,8 @@ public class MapInfoWidgetsFactory { all.setOnClickListener(new OnClickListener() { @Override public void onClick(View view) { - WaypointsFragment.showInstance(map); + map.hideContextAndRouteInfoMenus(); + WaypointsFragment.showInstance(map.getSupportFragmentManager()); } }); remove.setOnClickListener(new OnClickListener() {