Hide widgets and topbar
This commit is contained in:
parent
f229da7582
commit
c4321fe2a7
8 changed files with 70 additions and 66 deletions
|
@ -93,6 +93,17 @@ 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 boolean isXLargeDevice(@NonNull Activity ctx) {
|
||||
int lt = (ctx.getResources().getConfiguration().screenLayout & Configuration.SCREENLAYOUT_SIZE_MASK);
|
||||
return lt == Configuration.SCREENLAYOUT_SIZE_XLARGE;
|
||||
|
|
|
@ -38,13 +38,11 @@ import net.osmand.TspAnt;
|
|||
import net.osmand.data.LatLon;
|
||||
import net.osmand.data.PointDescription;
|
||||
import net.osmand.data.RotatedTileBox;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.MapMarkersHelper;
|
||||
import net.osmand.plus.MapMarkersHelper.MapMarker;
|
||||
import net.osmand.plus.OsmAndFormatter;
|
||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||
import net.osmand.plus.OsmandApplication;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.TargetPointsHelper;
|
||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||
|
@ -57,6 +55,8 @@ import net.osmand.plus.mapmarkers.adapters.MapMarkersListAdapter;
|
|||
import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment;
|
||||
import net.osmand.plus.measurementtool.SnapToRoadBottomSheetDialogFragment.SnapToRoadFragmentListener;
|
||||
import net.osmand.plus.routing.RoutingHelper;
|
||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||
import net.osmand.plus.settings.backend.OsmandSettings;
|
||||
import net.osmand.plus.views.MapMarkersLayer;
|
||||
import net.osmand.plus.views.OsmandMapTileView;
|
||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory;
|
||||
|
@ -623,11 +623,11 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
|
|||
markersLayer.setInPlanRouteMode(true);
|
||||
mapActivity.disableDrawer();
|
||||
|
||||
mark(portrait ? View.INVISIBLE : View.GONE,
|
||||
AndroidUiHelper.mark(mapActivity, portrait ? View.INVISIBLE : View.GONE,
|
||||
R.id.map_left_widgets_panel,
|
||||
R.id.map_right_widgets_panel,
|
||||
R.id.map_center_info);
|
||||
mark(View.GONE,
|
||||
AndroidUiHelper.mark(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);
|
||||
}
|
||||
|
||||
mark(View.VISIBLE,
|
||||
AndroidUiHelper.mark(mapActivity, View.VISIBLE,
|
||||
R.id.map_left_widgets_panel,
|
||||
R.id.map_right_widgets_panel,
|
||||
R.id.map_center_info,
|
||||
|
@ -778,18 +778,6 @@ public class PlanRouteFragment extends BaseOsmAndFragment implements OsmAndLocat
|
|||
}
|
||||
}
|
||||
|
||||
private void mark(int status, int... widgets) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
for (int widget : widgets) {
|
||||
View v = mapActivity.findViewById(widget);
|
||||
if (v != null) {
|
||||
v.setVisibility(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void showHideMarkersList() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null && portrait) {
|
||||
|
|
|
@ -1047,7 +1047,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
mapActivity.showTopToolbar(toolBarController);
|
||||
}
|
||||
markGeneralComponents(enable ? View.GONE : View.VISIBLE);
|
||||
mark(enable ? View.VISIBLE : View.GONE,
|
||||
AndroidUiHelper.mark(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);
|
||||
mark(enable ? View.VISIBLE : View.GONE,
|
||||
AndroidUiHelper.mark(mapActivity,enable ? View.VISIBLE : View.GONE,
|
||||
R.id.add_point_before_after_text,
|
||||
R.id.add_point_before_after_controls);
|
||||
if (!enable) {
|
||||
|
@ -1076,13 +1076,16 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
|
||||
private void markGeneralComponents(int status) {
|
||||
mark(status,
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
AndroidUiHelper.mark(mapActivity, status,
|
||||
R.id.measurement_distance_text_view,
|
||||
R.id.measurement_points_text_view,
|
||||
R.id.distance_to_center_text_view,
|
||||
R.id.up_down_button,
|
||||
R.id.measure_mode_controls);
|
||||
}
|
||||
}
|
||||
|
||||
private void addInitialPoint() {
|
||||
if (initialPoint != null) {
|
||||
|
@ -1551,11 +1554,11 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
mapActivity.refreshMap();
|
||||
mapActivity.disableDrawer();
|
||||
|
||||
mark(portrait ? View.INVISIBLE : View.GONE,
|
||||
AndroidUiHelper.mark(mapActivity, portrait ? View.INVISIBLE : View.GONE,
|
||||
R.id.map_left_widgets_panel,
|
||||
R.id.map_right_widgets_panel,
|
||||
R.id.map_center_info);
|
||||
mark(View.GONE,
|
||||
AndroidUiHelper.mark(mapActivity, View.GONE,
|
||||
R.id.map_route_info_button,
|
||||
R.id.map_menu_button,
|
||||
R.id.map_compass_button,
|
||||
|
@ -1585,7 +1588,7 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
measurementLayer.setInMeasurementMode(false);
|
||||
mapActivity.enableDrawer();
|
||||
|
||||
mark(View.VISIBLE,
|
||||
AndroidUiHelper.mark(mapActivity, View.VISIBLE,
|
||||
R.id.map_left_widgets_panel,
|
||||
R.id.map_right_widgets_panel,
|
||||
R.id.map_center_info,
|
||||
|
@ -1605,18 +1608,6 @@ public class MeasurementToolFragment extends BaseOsmAndFragment {
|
|||
}
|
||||
}
|
||||
|
||||
private void mark(int status, int... widgets) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
for (int widget : widgets) {
|
||||
View v = mapActivity.findViewById(widget);
|
||||
if (v != null) {
|
||||
v.setVisibility(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void quit(boolean hidePointsListFirst) {
|
||||
if (editingCtx.getOriginalPointToMove() != null) {
|
||||
cancelMovePointMode();
|
||||
|
|
|
@ -154,6 +154,7 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
|
|||
params.gravity = Gravity.BOTTOM | Gravity.START;
|
||||
view.findViewById(R.id.control_buttons).setLayoutParams(params);
|
||||
}
|
||||
enterMeasurementMode();
|
||||
runLayoutListener();
|
||||
}
|
||||
return view;
|
||||
|
@ -197,6 +198,34 @@ public class TrackAppearanceFragment extends ContextMenuFragment implements Card
|
|||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
exitMeasurementMode();
|
||||
}
|
||||
|
||||
private void enterMeasurementMode() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
AndroidUiHelper.mark(mapActivity, portrait ? View.INVISIBLE : View.GONE,
|
||||
R.id.map_left_widgets_panel,
|
||||
R.id.map_right_widgets_panel,
|
||||
R.id.map_center_info);
|
||||
}
|
||||
}
|
||||
|
||||
private void exitMeasurementMode() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
AndroidUiHelper.mark(mapActivity, View.VISIBLE,
|
||||
R.id.map_left_widgets_panel,
|
||||
R.id.map_right_widgets_panel,
|
||||
R.id.map_center_info,
|
||||
R.id.map_search_button);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
|
|
|
@ -57,6 +57,7 @@ import net.osmand.plus.OsmandApplication;
|
|||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.activities.MapActivityActions;
|
||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||
import net.osmand.plus.mapcontextmenu.MapContextMenu;
|
||||
import net.osmand.plus.mapcontextmenu.controllers.TransportStopController;
|
||||
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||
|
@ -454,7 +455,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
|
||||
mInGpxDetailsMode = true;
|
||||
activity.disableDrawer();
|
||||
mark(View.INVISIBLE, R.id.map_ruler_layout,
|
||||
AndroidUiHelper.mark(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);
|
||||
|
@ -469,7 +470,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
public void exitGpxDetailsMode() {
|
||||
mInGpxDetailsMode = false;
|
||||
activity.enableDrawer();
|
||||
mark(View.VISIBLE, R.id.map_ruler_layout,
|
||||
AndroidUiHelper.mark(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);
|
||||
|
@ -480,7 +481,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
|
||||
private void quitMovingMarker() {
|
||||
mInChangeMarkerPositionMode = false;
|
||||
mark(View.VISIBLE, R.id.map_ruler_layout,
|
||||
AndroidUiHelper.mark(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);
|
||||
|
@ -491,7 +492,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
|
||||
public void quitAddGpxPoint() {
|
||||
mInAddGpxPointMode = false;
|
||||
mark(View.VISIBLE, R.id.map_ruler_layout,
|
||||
AndroidUiHelper.mark(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);
|
||||
|
@ -508,7 +509,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
|
||||
mInAddGpxPointMode = true;
|
||||
mAddGpxPointBottomSheetHelper.show(newGpxPoint);
|
||||
mark(View.INVISIBLE, R.id.map_ruler_layout,
|
||||
AndroidUiHelper.mark(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);
|
||||
|
@ -541,7 +542,7 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
|
||||
mInChangeMarkerPositionMode = true;
|
||||
mMoveMarkerBottomSheetHelper.show(menu.getRightIcon());
|
||||
mark(View.INVISIBLE, R.id.map_ruler_layout,
|
||||
AndroidUiHelper.mark(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);
|
||||
|
@ -555,15 +556,6 @@ public class ContextMenuLayer extends OsmandMapLayer {
|
|||
view.refreshMap();
|
||||
}
|
||||
|
||||
private void mark(int status, int... widgets) {
|
||||
for (int widget : widgets) {
|
||||
View v = activity.findViewById(widget);
|
||||
if (v != null) {
|
||||
v.setVisibility(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelMovingMarker() {
|
||||
cancelApplyingNewMarkerPosition = true;
|
||||
quitMovingMarker();
|
||||
|
|
|
@ -311,7 +311,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
view.setLatLon(lat, lon);
|
||||
|
||||
inMovingMarkerMode = true;
|
||||
mark(View.INVISIBLE, R.id.map_ruler_layout,
|
||||
AndroidUiHelper.mark(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;
|
||||
mark(View.VISIBLE, R.id.map_ruler_layout,
|
||||
AndroidUiHelper.mark(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);
|
||||
|
@ -359,15 +359,6 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
|||
view.refreshMap();
|
||||
}
|
||||
|
||||
private void mark(int status, int... widgets) {
|
||||
for (int widget : widgets) {
|
||||
View v = mapActivity.findViewById(widget);
|
||||
if (v != null) {
|
||||
v.setVisibility(status);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
||||
if (isInMovingMarkerMode() && !pressedQuickActionWidget(point.x, point.y)) {
|
||||
|
|
|
@ -1275,6 +1275,7 @@ public class MapInfoWidgetsFactory {
|
|||
public boolean updateInfo() {
|
||||
boolean visible = settings.SHOW_COORDINATES_WIDGET.get() && map.getContextMenu().shouldShowTopControls()
|
||||
&& map.getMapRouteInfoMenu().shouldShowTopControls() && !map.isTopToolbarActive()
|
||||
&& !map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
||||
&& !MapRouteInfoMenu.chooseRoutesVisible && !MapRouteInfoMenu.waypointsVisible;
|
||||
|
||||
updateVisibility(visible);
|
||||
|
|
|
@ -191,6 +191,7 @@ public class MapMarkersWidgetsFactory {
|
|||
|| addressTopBar.getVisibility() == View.VISIBLE
|
||||
|| map.isTopToolbarActive()
|
||||
|| !map.getContextMenu().shouldShowTopControls()
|
||||
|| map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
||||
|| map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()) {
|
||||
updateVisibility(false);
|
||||
return;
|
||||
|
|
Loading…
Reference in a new issue