From 086f52d61dd74bb443a5a0f1853d71d9bf840ba2 Mon Sep 17 00:00:00 2001 From: Vitaliy Date: Mon, 27 Jul 2020 11:17:23 +0300 Subject: [PATCH] Rename mark to setVisibility --- .../src/net/osmand/plus/helpers/AndroidUiHelper.java | 12 +++++------- .../osmand/plus/mapmarkers/PlanRouteFragment.java | 6 +++--- .../measurementtool/MeasurementToolFragment.java | 12 ++++++------ .../osmand/plus/track/TrackAppearanceFragment.java | 4 ++-- .../src/net/osmand/plus/views/ContextMenuLayer.java | 12 ++++++------ .../net/osmand/plus/views/MapQuickActionLayer.java | 4 ++-- 6 files changed, 24 insertions(+), 26 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/AndroidUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/AndroidUiHelper.java index 4bebdaf751..4980d25025 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/AndroidUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/AndroidUiHelper.java @@ -93,13 +93,11 @@ public class AndroidUiHelper { return false; } - public static void mark(Activity activity, int status, int... widgets) { - if (activity != null) { - for (int widget : widgets) { - View view = activity.findViewById(widget); - if (view != null) { - view.setVisibility(status); - } + public static void setVisibility(@NonNull Activity activity, int visibility, int... widgets) { + for (int widget : widgets) { + View view = activity.findViewById(widget); + if (view != null && view.getVisibility() != visibility) { + view.setVisibility(visibility); } } } diff --git a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java index 64e458ff5a..8cdee993c1 100644 --- a/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java +++ b/OsmAnd/src/net/osmand/plus/mapmarkers/PlanRouteFragment.java @@ -623,11 +623,11 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat markersLayer.setInPlanRouteMode(true); mapActivity.disableDrawer(); - AndroidUiHelper.mark(mapActivity, portrait ? View.INVISIBLE : View.GONE, + AndroidUiHelper.setVisibility(mapActivity, portrait ? View.INVISIBLE : View.GONE, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); - AndroidUiHelper.mark(mapActivity, View.GONE, + AndroidUiHelper.setVisibility(mapActivity, View.GONE, R.id.map_route_info_button, R.id.map_menu_button, R.id.map_compass_button, @@ -694,7 +694,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat mapActivity.hideTopToolbar(toolbarController); } - AndroidUiHelper.mark(mapActivity, View.VISIBLE, + AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info, diff --git a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java index c9911bc100..2a28560af6 100644 --- a/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java +++ b/OsmAnd/src/net/osmand/plus/measurementtool/MeasurementToolFragment.java @@ -1047,7 +1047,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { mapActivity.showTopToolbar(toolBarController); } markGeneralComponents(enable ? View.GONE : View.VISIBLE); - AndroidUiHelper.mark(mapActivity, enable ? View.VISIBLE : View.GONE, + AndroidUiHelper.setVisibility(mapActivity, enable ? View.VISIBLE : View.GONE, R.id.move_point_text, R.id.move_point_controls); mainIcon.setImageDrawable(getActiveIcon(enable @@ -1067,7 +1067,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { mapActivity.showTopToolbar(toolBarController); } markGeneralComponents(enable ? View.GONE : View.VISIBLE); - AndroidUiHelper.mark(mapActivity,enable ? View.VISIBLE : View.GONE, + AndroidUiHelper.setVisibility(mapActivity,enable ? View.VISIBLE : View.GONE, R.id.add_point_before_after_text, R.id.add_point_before_after_controls); if (!enable) { @@ -1078,7 +1078,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { private void markGeneralComponents(int status) { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - AndroidUiHelper.mark(mapActivity, status, + AndroidUiHelper.setVisibility(mapActivity, status, R.id.measurement_distance_text_view, R.id.measurement_points_text_view, R.id.distance_to_center_text_view, @@ -1554,11 +1554,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { mapActivity.refreshMap(); mapActivity.disableDrawer(); - AndroidUiHelper.mark(mapActivity, portrait ? View.INVISIBLE : View.GONE, + AndroidUiHelper.setVisibility(mapActivity, portrait ? View.INVISIBLE : View.GONE, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); - AndroidUiHelper.mark(mapActivity, View.GONE, + AndroidUiHelper.setVisibility(mapActivity, View.GONE, R.id.map_route_info_button, R.id.map_menu_button, R.id.map_compass_button, @@ -1588,7 +1588,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment { measurementLayer.setInMeasurementMode(false); mapActivity.enableDrawer(); - AndroidUiHelper.mark(mapActivity, View.VISIBLE, + AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info, diff --git a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java index 43891fc0a7..faaa96cf52 100644 --- a/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java +++ b/OsmAnd/src/net/osmand/plus/track/TrackAppearanceFragment.java @@ -245,7 +245,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity); - AndroidUiHelper.mark(mapActivity, portrait ? View.INVISIBLE : View.GONE, + AndroidUiHelper.setVisibility(mapActivity, portrait ? View.INVISIBLE : View.GONE, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); @@ -255,7 +255,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card private void exitTrackAppearanceMode() { MapActivity mapActivity = getMapActivity(); if (mapActivity != null) { - AndroidUiHelper.mark(mapActivity, View.VISIBLE, + AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info, diff --git a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java index 5e21db83d4..848ad6ec3e 100644 --- a/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/ContextMenuLayer.java @@ -455,7 +455,7 @@ public class ContextMenuLayer extends OsmandMapLayer { mInGpxDetailsMode = true; activity.disableDrawer(); - AndroidUiHelper.mark(activity, View.INVISIBLE, R.id.map_ruler_layout, + AndroidUiHelper.setVisibility(activity, View.INVISIBLE, R.id.map_ruler_layout, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); View collapseButton = activity.findViewById(R.id.map_collapse_button); @@ -470,7 +470,7 @@ public class ContextMenuLayer extends OsmandMapLayer { public void exitGpxDetailsMode() { mInGpxDetailsMode = false; activity.enableDrawer(); - AndroidUiHelper.mark(activity, View.VISIBLE, R.id.map_ruler_layout, + AndroidUiHelper.setVisibility(activity, View.VISIBLE, R.id.map_ruler_layout, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); View collapseButton = activity.findViewById(R.id.map_collapse_button); @@ -481,7 +481,7 @@ public class ContextMenuLayer extends OsmandMapLayer { private void quitMovingMarker() { mInChangeMarkerPositionMode = false; - AndroidUiHelper.mark(activity, View.VISIBLE, R.id.map_ruler_layout, + AndroidUiHelper.setVisibility(activity, View.VISIBLE, R.id.map_ruler_layout, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); View collapseButton = activity.findViewById(R.id.map_collapse_button); @@ -492,7 +492,7 @@ public class ContextMenuLayer extends OsmandMapLayer { public void quitAddGpxPoint() { mInAddGpxPointMode = false; - AndroidUiHelper.mark(activity, View.VISIBLE, R.id.map_ruler_layout, + AndroidUiHelper.setVisibility(activity, View.VISIBLE, R.id.map_ruler_layout, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); View collapseButton = activity.findViewById(R.id.map_collapse_button); @@ -509,7 +509,7 @@ public class ContextMenuLayer extends OsmandMapLayer { mInAddGpxPointMode = true; mAddGpxPointBottomSheetHelper.show(newGpxPoint); - AndroidUiHelper.mark(activity, View.INVISIBLE, R.id.map_ruler_layout, + AndroidUiHelper.setVisibility(activity, View.INVISIBLE, R.id.map_ruler_layout, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); View collapseButton = activity.findViewById(R.id.map_collapse_button); @@ -542,7 +542,7 @@ public class ContextMenuLayer extends OsmandMapLayer { mInChangeMarkerPositionMode = true; mMoveMarkerBottomSheetHelper.show(menu.getRightIcon()); - AndroidUiHelper.mark(activity, View.INVISIBLE, R.id.map_ruler_layout, + AndroidUiHelper.setVisibility(activity, View.INVISIBLE, R.id.map_ruler_layout, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); View collapseButton = activity.findViewById(R.id.map_collapse_button); diff --git a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java index 63146a40d7..97e9f64f2d 100644 --- a/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/MapQuickActionLayer.java @@ -311,7 +311,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe view.setLatLon(lat, lon); inMovingMarkerMode = true; - AndroidUiHelper.mark(mapActivity, View.INVISIBLE, R.id.map_ruler_layout, + AndroidUiHelper.setVisibility(mapActivity, View.INVISIBLE, R.id.map_ruler_layout, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); View collapseButton = mapActivity.findViewById(R.id.map_collapse_button); @@ -349,7 +349,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe } inMovingMarkerMode = false; - AndroidUiHelper.mark(mapActivity, View.VISIBLE, R.id.map_ruler_layout, + AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE, R.id.map_ruler_layout, R.id.map_left_widgets_panel, R.id.map_right_widgets_panel, R.id.map_center_info); View collapseButton = mapActivity.findViewById(R.id.map_collapse_button);