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;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void mark(Activity activity, int status, int... widgets) {
|
public static void setVisibility(@NonNull Activity activity, int visibility, int... widgets) {
|
||||||
if (activity != null) {
|
for (int widget : widgets) {
|
||||||
for (int widget : widgets) {
|
View view = activity.findViewById(widget);
|
||||||
View view = activity.findViewById(widget);
|
if (view != null && view.getVisibility() != visibility) {
|
||||||
if (view != null) {
|
view.setVisibility(visibility);
|
||||||
view.setVisibility(status);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -623,11 +623,11 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
|
||||||
markersLayer.setInPlanRouteMode(true);
|
markersLayer.setInPlanRouteMode(true);
|
||||||
mapActivity.disableDrawer();
|
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_left_widgets_panel,
|
||||||
R.id.map_right_widgets_panel,
|
R.id.map_right_widgets_panel,
|
||||||
R.id.map_center_info);
|
R.id.map_center_info);
|
||||||
AndroidUiHelper.mark(mapActivity, View.GONE,
|
AndroidUiHelper.setVisibility(mapActivity, View.GONE,
|
||||||
R.id.map_route_info_button,
|
R.id.map_route_info_button,
|
||||||
R.id.map_menu_button,
|
R.id.map_menu_button,
|
||||||
R.id.map_compass_button,
|
R.id.map_compass_button,
|
||||||
|
@ -694,7 +694,7 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
|
||||||
mapActivity.hideTopToolbar(toolbarController);
|
mapActivity.hideTopToolbar(toolbarController);
|
||||||
}
|
}
|
||||||
|
|
||||||
AndroidUiHelper.mark(mapActivity, View.VISIBLE,
|
AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE,
|
||||||
R.id.map_left_widgets_panel,
|
R.id.map_left_widgets_panel,
|
||||||
R.id.map_right_widgets_panel,
|
R.id.map_right_widgets_panel,
|
||||||
R.id.map_center_info,
|
R.id.map_center_info,
|
||||||
|
|
|
@ -1047,7 +1047,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||||
mapActivity.showTopToolbar(toolBarController);
|
mapActivity.showTopToolbar(toolBarController);
|
||||||
}
|
}
|
||||||
markGeneralComponents(enable ? View.GONE : View.VISIBLE);
|
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_text,
|
||||||
R.id.move_point_controls);
|
R.id.move_point_controls);
|
||||||
mainIcon.setImageDrawable(getActiveIcon(enable
|
mainIcon.setImageDrawable(getActiveIcon(enable
|
||||||
|
@ -1067,7 +1067,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||||
mapActivity.showTopToolbar(toolBarController);
|
mapActivity.showTopToolbar(toolBarController);
|
||||||
}
|
}
|
||||||
markGeneralComponents(enable ? View.GONE : View.VISIBLE);
|
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_text,
|
||||||
R.id.add_point_before_after_controls);
|
R.id.add_point_before_after_controls);
|
||||||
if (!enable) {
|
if (!enable) {
|
||||||
|
@ -1078,7 +1078,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||||
private void markGeneralComponents(int status) {
|
private void markGeneralComponents(int status) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
AndroidUiHelper.mark(mapActivity, status,
|
AndroidUiHelper.setVisibility(mapActivity, status,
|
||||||
R.id.measurement_distance_text_view,
|
R.id.measurement_distance_text_view,
|
||||||
R.id.measurement_points_text_view,
|
R.id.measurement_points_text_view,
|
||||||
R.id.distance_to_center_text_view,
|
R.id.distance_to_center_text_view,
|
||||||
|
@ -1554,11 +1554,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||||
mapActivity.refreshMap();
|
mapActivity.refreshMap();
|
||||||
mapActivity.disableDrawer();
|
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_left_widgets_panel,
|
||||||
R.id.map_right_widgets_panel,
|
R.id.map_right_widgets_panel,
|
||||||
R.id.map_center_info);
|
R.id.map_center_info);
|
||||||
AndroidUiHelper.mark(mapActivity, View.GONE,
|
AndroidUiHelper.setVisibility(mapActivity, View.GONE,
|
||||||
R.id.map_route_info_button,
|
R.id.map_route_info_button,
|
||||||
R.id.map_menu_button,
|
R.id.map_menu_button,
|
||||||
R.id.map_compass_button,
|
R.id.map_compass_button,
|
||||||
|
@ -1588,7 +1588,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
||||||
measurementLayer.setInMeasurementMode(false);
|
measurementLayer.setInMeasurementMode(false);
|
||||||
mapActivity.enableDrawer();
|
mapActivity.enableDrawer();
|
||||||
|
|
||||||
AndroidUiHelper.mark(mapActivity, View.VISIBLE,
|
AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE,
|
||||||
R.id.map_left_widgets_panel,
|
R.id.map_left_widgets_panel,
|
||||||
R.id.map_right_widgets_panel,
|
R.id.map_right_widgets_panel,
|
||||||
R.id.map_center_info,
|
R.id.map_center_info,
|
||||||
|
|
|
@ -245,7 +245,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
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_left_widgets_panel,
|
||||||
R.id.map_right_widgets_panel,
|
R.id.map_right_widgets_panel,
|
||||||
R.id.map_center_info);
|
R.id.map_center_info);
|
||||||
|
@ -255,7 +255,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
|
||||||
private void exitTrackAppearanceMode() {
|
private void exitTrackAppearanceMode() {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
AndroidUiHelper.mark(mapActivity, View.VISIBLE,
|
AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE,
|
||||||
R.id.map_left_widgets_panel,
|
R.id.map_left_widgets_panel,
|
||||||
R.id.map_right_widgets_panel,
|
R.id.map_right_widgets_panel,
|
||||||
R.id.map_center_info,
|
R.id.map_center_info,
|
||||||
|
|
|
@ -455,7 +455,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
mInGpxDetailsMode = true;
|
mInGpxDetailsMode = true;
|
||||||
activity.disableDrawer();
|
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);
|
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);
|
View collapseButton = activity.findViewById(R.id.map_collapse_button);
|
||||||
|
@ -470,7 +470,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
public void exitGpxDetailsMode() {
|
public void exitGpxDetailsMode() {
|
||||||
mInGpxDetailsMode = false;
|
mInGpxDetailsMode = false;
|
||||||
activity.enableDrawer();
|
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);
|
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);
|
View collapseButton = activity.findViewById(R.id.map_collapse_button);
|
||||||
|
@ -481,7 +481,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
private void quitMovingMarker() {
|
private void quitMovingMarker() {
|
||||||
mInChangeMarkerPositionMode = false;
|
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);
|
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);
|
View collapseButton = activity.findViewById(R.id.map_collapse_button);
|
||||||
|
@ -492,7 +492,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
public void quitAddGpxPoint() {
|
public void quitAddGpxPoint() {
|
||||||
mInAddGpxPointMode = false;
|
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);
|
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);
|
View collapseButton = activity.findViewById(R.id.map_collapse_button);
|
||||||
|
@ -509,7 +509,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
mInAddGpxPointMode = true;
|
mInAddGpxPointMode = true;
|
||||||
mAddGpxPointBottomSheetHelper.show(newGpxPoint);
|
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);
|
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);
|
View collapseButton = activity.findViewById(R.id.map_collapse_button);
|
||||||
|
@ -542,7 +542,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
||||||
|
|
||||||
mInChangeMarkerPositionMode = true;
|
mInChangeMarkerPositionMode = true;
|
||||||
mMoveMarkerBottomSheetHelper.show(menu.getRightIcon());
|
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);
|
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);
|
View collapseButton = activity.findViewById(R.id.map_collapse_button);
|
||||||
|
|
|
@ -311,7 +311,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
view.setLatLon(lat, lon);
|
view.setLatLon(lat, lon);
|
||||||
|
|
||||||
inMovingMarkerMode = true;
|
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);
|
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);
|
View collapseButton = mapActivity.findViewById(R.id.map_collapse_button);
|
||||||
|
@ -349,7 +349,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
}
|
}
|
||||||
|
|
||||||
inMovingMarkerMode = false;
|
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);
|
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);
|
View collapseButton = mapActivity.findViewById(R.id.map_collapse_button);
|
||||||
|
|
Loading…
Reference in a new issue