diff --git a/OsmAnd/res/layout-land/map_hud_top.xml b/OsmAnd/res/layout-land/map_hud_top.xml index e651de0368..d21fb04b07 100644 --- a/OsmAnd/res/layout-land/map_hud_top.xml +++ b/OsmAnd/res/layout-land/map_hud_top.xml @@ -3,6 +3,7 @@ xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" + xmlns:osmand="http://schemas.android.com/apk/res-auto" android:orientation="vertical"> + + @@ -234,6 +235,26 @@ android:contentDescription="@string/shared_string_close" android:src="@drawable/ic_action_remove_dark"/> + + 0) { + saveAsNewSegment(mapActivity); + } else { + Toast.makeText(mapActivity, getString(R.string.none_point_error), Toast.LENGTH_SHORT).show(); + } } }); mapActivity.showTopToolbar(toolBarController); @@ -810,16 +814,17 @@ public class MeasurementToolFragment extends Fragment { } private static class MeasurementToolBarController extends TopToolbarController { + private NewGpxLine newGpxLine; - MeasurementToolBarController() { + MeasurementToolBarController(NewGpxLine newGpxLine) { super(MapInfoWidgetsFactory.TopToolbarControllerType.MEASUREMENT_TOOL); + this.newGpxLine = newGpxLine; setBackBtnIconClrIds(0, 0); - setCloseBtnIconClrIds(0, 0); setTitleTextClrIds(R.color.primary_text_dark, R.color.primary_text_dark); setDescrTextClrIds(R.color.primary_text_dark, R.color.primary_text_dark); setBgIds(R.drawable.gradient_toolbar, R.drawable.gradient_toolbar, R.drawable.gradient_toolbar, R.drawable.gradient_toolbar); - setCloseBtnIconIds(R.drawable.ic_overflow_menu_white, R.drawable.ic_overflow_menu_white); // Pasha, change this icon :) + setCloseBtnVisible(false); setBackBtnIconIds(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_dark); setSingleLineTitle(false); } @@ -828,6 +833,9 @@ public class MeasurementToolFragment extends Fragment { public void updateToolbar(MapInfoWidgetsFactory.TopToolbarView view) { super.updateToolbar(view); view.getShadowView().setVisibility(View.GONE); + if (newGpxLine != null) { + view.getSaveView().setVisibility(View.VISIBLE); + } } } } diff --git a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java index d0911e299d..4b78628700 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -247,6 +247,7 @@ public class MapInfoWidgetsFactory { OnClickListener onTitleClickListener; OnClickListener onCloseButtonClickListener; OnClickListener onRefreshButtonClickListener; + OnClickListener onSaveViewClickListener; Runnable onCloseToolbarListener; @@ -343,6 +344,10 @@ public class MapInfoWidgetsFactory { this.onCloseButtonClickListener = onCloseButtonClickListener; } + public void setOnSaveViewClickListener(OnClickListener onSaveViewClickListener) { + this.onSaveViewClickListener = onSaveViewClickListener; + } + public void setOnRefreshButtonClickListener(OnClickListener onRefreshButtonClickListener) { this.onRefreshButtonClickListener = onRefreshButtonClickListener; } @@ -393,6 +398,7 @@ public class MapInfoWidgetsFactory { private TextView descrView; private ImageButton refreshButton; private ImageButton closeButton; + private TextView saveView; private View shadowView; private boolean nightMode; @@ -407,6 +413,7 @@ public class MapInfoWidgetsFactory { refreshButton = (ImageButton) map.findViewById(R.id.widget_top_bar_refresh_button); closeButton = (ImageButton) map.findViewById(R.id.widget_top_bar_close_button); titleView = (TextView) map.findViewById(R.id.widget_top_bar_title); + saveView = (TextView) map.findViewById(R.id.widget_top_bar_save); descrView = (TextView) map.findViewById(R.id.widget_top_bar_description); shadowView = map.findViewById(R.id.widget_top_bar_shadow); updateVisibility(false); @@ -444,6 +451,10 @@ public class MapInfoWidgetsFactory { return closeButton; } + public TextView getSaveView() { + return saveView; + } + public ImageButton getRefreshButton() { return refreshButton; } @@ -515,6 +526,7 @@ public class MapInfoWidgetsFactory { topBarTitleLayout.setOnClickListener(controller.onTitleClickListener); closeButton.setOnClickListener(controller.onCloseButtonClickListener); refreshButton.setOnClickListener(controller.onRefreshButtonClickListener); + saveView.setOnClickListener(controller.onSaveViewClickListener); } public void updateInfo() { @@ -553,6 +565,7 @@ public class MapInfoWidgetsFactory { int descrColor = map.getResources().getColor(controller.descrTextClrDarkId); titleView.setTextColor(titleColor); descrView.setTextColor(descrColor); + saveView.setTextColor(titleColor); } else { topBarLayout.setBackgroundResource(AndroidUiHelper.isOrientationPortrait(map) ? controller.bgLightId : controller.bgLightLandId); if (controller.backBtnIconLightId == 0) { @@ -574,6 +587,7 @@ public class MapInfoWidgetsFactory { int descrColor = map.getResources().getColor(controller.descrTextClrLightId); titleView.setTextColor(titleColor); descrView.setTextColor(descrColor); + saveView.setTextColor(titleColor); } if (controller.singleLineTitle) { titleView.setSingleLine(true);