From 6ec3c371cd970ec39cd70f9f44927034f6282de8 Mon Sep 17 00:00:00 2001 From: androiddevkotlin <64539346+androiddevkotlin@users.noreply.github.com> Date: Fri, 23 Apr 2021 20:04:10 +0300 Subject: [PATCH] Widgets appears on the map after open Search > Item > Context menu: close menu. --- .../MeasurementToolFragment.java | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index 57d2cd36c6..dd572f702e 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -12,6 +12,7 @@ import android.view.View; import android.view.View.OnClickListener; import android.view.ViewGroup; import android.view.ViewGroup.MarginLayoutParams; +import android.view.ViewTreeObserver; import android.widget.FrameLayout; import android.widget.ImageButton; import android.widget.ImageView; @@ -1883,7 +1884,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route } private void enterMeasurementMode() { - MapActivity mapActivity = getMapActivity(); + final MapActivity mapActivity = getMapActivity(); MeasurementToolLayer measurementLayer = getMeasurementLayer(); if (mapActivity != null && measurementLayer != null) { measurementLayer.setInMeasurementMode(true); @@ -1902,6 +1903,20 @@ public class MeasurementToolFragment extends BaseOsmAndFragment implements Route R.id.map_search_button, R.id.map_quick_actions_button); + final View widgetRight = mapActivity.findViewById(R.id.map_right_widgets_panel); + widgetRight.setTag(widgetRight.getVisibility()); + widgetRight.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener() { + @Override + public void onGlobalLayout() { + int newVis = widgetRight.getVisibility(); + if ((int) widgetRight.getTag() != newVis) { + widgetRight.setTag(widgetRight.getVisibility()); + AndroidUiHelper.setVisibility(mapActivity, portrait ? View.INVISIBLE : View.GONE, + R.id.map_right_widgets_panel); + } + } + }); + View collapseButton = mapActivity.findViewById(R.id.map_collapse_button); if (collapseButton != null && collapseButton.getVisibility() == View.VISIBLE) { wasCollapseButtonVisible = true;