From 92a6e7932bafb3ad0fa8a8bd37dc756362dafa43 Mon Sep 17 00:00:00 2001 From: PavelRatushny Date: Fri, 11 Aug 2017 18:50:41 +0300 Subject: [PATCH] Fix save button visibility --- .../measurementtool/MeasurementToolFragment.java | 6 +++--- .../plus/views/mapwidgets/MapInfoWidgetsFactory.java | 12 ++++++++++++ 2 files changed, 15 insertions(+), 3 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index bff9822ac2..5f27c858f4 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -829,6 +829,9 @@ public class MeasurementToolFragment extends Fragment { setBgIds(R.drawable.gradient_toolbar, R.drawable.gradient_toolbar, R.drawable.gradient_toolbar, R.drawable.gradient_toolbar); setCloseBtnVisible(false); + if (newGpxLine != null) { + setSaveViewVisible(true); + } setBackBtnIconIds(R.drawable.ic_action_remove_dark, R.drawable.ic_action_remove_dark); setSingleLineTitle(false); } @@ -837,9 +840,6 @@ 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 4b78628700..97be2765e4 100644 --- a/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java +++ b/OsmAnd/src/net/osmand/plus/views/mapwidgets/MapInfoWidgetsFactory.java @@ -230,6 +230,7 @@ public class MapInfoWidgetsFactory { int refreshBtnIconClrLightId = R.color.icon_color; int refreshBtnIconClrDarkId = 0; boolean refreshBtnVisible = false; + boolean saveViewVisible = false; int titleTextClrLightId = R.color.primary_text_light; int titleTextClrDarkId = R.color.primary_text_dark; @@ -322,6 +323,10 @@ public class MapInfoWidgetsFactory { this.refreshBtnVisible = visible; } + public void setSaveViewVisible(boolean visible) { + this.saveViewVisible = visible; + } + public void setTitleTextClrIds(int titleTextClrLightId, int titleTextClrDarkId) { this.titleTextClrLightId = titleTextClrLightId; this.titleTextClrDarkId = titleTextClrDarkId; @@ -609,6 +614,13 @@ public class MapInfoWidgetsFactory { } else if (refreshButton.getVisibility() == View.VISIBLE) { refreshButton.setVisibility(View.GONE); } + if (controller.saveViewVisible) { + if (saveView.getVisibility() == View.GONE) { + saveView.setVisibility(View.VISIBLE); + } + } else if (saveView.getVisibility() == View.VISIBLE) { + saveView.setVisibility(View.GONE); + } } public void updateColors() {