Rename mark to setVisibility
This commit is contained in:
parent
012fbc599d
commit
086f52d61d
6 changed files with 24 additions and 26 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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,
|
||||
|
|
|
@ -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);
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue