Change logic

This commit is contained in:
PavelRatushny 2017-10-02 17:06:57 +03:00
parent f1c42f6d2b
commit 32f35e7ed6
8 changed files with 15 additions and 55 deletions

View file

@ -7,11 +7,6 @@
android:orientation="vertical">
<FrameLayout
android:id="@+id/map_markers_top_bar_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/map_markers_top_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -193,8 +188,6 @@
</FrameLayout>
</FrameLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -239,11 +232,6 @@
android:orientation="vertical">
<FrameLayout
android:id="@+id/map_top_bar_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/map_top_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -384,8 +372,6 @@
</LinearLayout>
</FrameLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/widget_top_bar"
android:layout_width="match_parent"

View file

@ -9,11 +9,6 @@
<!-- TOP ROW -->
<FrameLayout
android:id="@+id/map_top_bar_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/map_top_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -154,8 +149,6 @@
</LinearLayout>
</FrameLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/widget_top_bar"
android:layout_width="match_parent"
@ -292,11 +285,6 @@
</FrameLayout>
<FrameLayout
android:id="@+id/map_markers_top_bar_layout"
android:layout_width="fill_parent"
android:layout_height="wrap_content">
<FrameLayout
android:id="@+id/map_markers_top_bar"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
@ -467,8 +455,6 @@
</FrameLayout>
</FrameLayout>
<!-- Widgets -->
<FrameLayout

View file

@ -1753,11 +1753,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
return mapInfoLayer.getTopToolbarController(type);
}
public TopToolbarController getTopToolbarController() {
MapInfoLayer mapInfoLayer = getMapLayers().getMapInfoLayer();
return mapInfoLayer.getTopController();
}
public void showTopToolbar(TopToolbarController controller) {
MapInfoLayer mapInfoLayer = getMapLayers().getMapInfoLayer();
mapInfoLayer.addTopToolbarController(controller);

View file

@ -453,15 +453,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
private void updateWidgetsAndTopbarsVisibility(boolean visible) {
int visibility = visible ? View.VISIBLE : View.GONE;
mapActivity.findViewById(R.id.map_top_bar_layout).setVisibility(visibility);
mapActivity.findViewById(R.id.map_markers_top_bar_layout).setVisibility(visibility);
TopToolbarController controller = mapActivity.getTopToolbarController();
if (controller != null && controller.getType() != TopToolbarControllerType.CONTEXT_MENU) {
mapActivity.findViewById(R.id.widget_top_bar).setVisibility(visibility);
}
mapActivity.findViewById(R.id.map_center_info).setVisibility(visibility);
mapActivity.findViewById(R.id.map_left_widgets_panel).setVisibility(visibility);
mapActivity.findViewById(R.id.map_right_widgets_panel).setVisibility(visibility);
mapActivity.refreshMap();
}
// timeout in msec

View file

@ -708,11 +708,12 @@ public class MapControlsLayer extends OsmandMapLayer {
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
boolean routeDialogOpened = MapRouteInfoMenu.isVisible();
boolean trackDialogOpened = TrackDetailsMenu.isVisible();
boolean contextMenuOpened = mapActivity.getContextMenu().isVisible();
boolean showRouteCalculationControls = routePlanningMode ||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
updateMyLocation(rh, routeDialogOpened || trackDialogOpened);
updateMyLocation(rh, routeDialogOpened || trackDialogOpened, contextMenuOpened);
boolean showButtons = (showRouteCalculationControls || !routeFollowingMode)
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode();
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened;
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_gabout_dark : R.drawable.map_directions);
if (rh.isFollowingMode()) {
routePlanningBtn.setIconResId(R.drawable.map_start_navigation);
@ -727,16 +728,16 @@ public class MapControlsLayer extends OsmandMapLayer {
routePlanningBtn.updateVisibility(showButtons);
menuControl.updateVisibility(showButtons);
mapZoomIn.updateVisibility(!routeDialogOpened);
mapZoomOut.updateVisibility(!routeDialogOpened);
mapZoomIn.updateVisibility(!routeDialogOpened && !contextMenuOpened);
mapZoomOut.updateVisibility(!routeDialogOpened && !contextMenuOpened);
compassHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && shouldShowCompass()
&& !isInMeasurementToolMode() && !isInPlanRouteMode());
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
if (layersHud.setIconResId(settings.getApplicationMode().getMapIconId())) {
layersHud.update(app, isNight);
}
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode());
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode());
layersHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
quickSearchHud.updateVisibility(!routeDialogOpened && !trackDialogOpened && !isInMeasurementToolMode() && !isInPlanRouteMode() && !contextMenuOpened);
if (!routePlanningMode && !routeFollowingMode) {
if (mapView.isZooming()) {
@ -795,7 +796,7 @@ public class MapControlsLayer extends OsmandMapLayer {
return new CompassDrawable(originalDrawable);
}
private void updateMyLocation(RoutingHelper rh, boolean dialogOpened) {
private void updateMyLocation(RoutingHelper rh, boolean dialogOpened, boolean contextMenuOpened) {
Location lastKnownLocation = mapActivity.getMyApplication().getLocationProvider().getLastKnownLocation();
boolean enabled = lastKnownLocation != null;
boolean tracked = mapActivity.getMapViewTrackingUtilities().isMapLinkedToLocation();
@ -814,7 +815,7 @@ public class MapControlsLayer extends OsmandMapLayer {
backToLocationControl.iv.setContentDescription(mapActivity.getString(R.string.map_widget_back_to_loc));
}
boolean visible = !(tracked && rh.isFollowingMode());
backToLocationControl.updateVisibility(visible && !dialogOpened);
backToLocationControl.updateVisibility(visible && !dialogOpened && !contextMenuOpened);
if (app.accessibilityEnabled()) {
backToLocationControl.iv.setClickable(enabled && visible);
}

View file

@ -126,10 +126,6 @@ public class MapInfoLayer extends OsmandMapLayer {
return topToolbarView.getTopController() != null;
}
public TopToolbarController getTopController() {
return topToolbarView.getTopController();
}
public TopToolbarController getTopToolbarController(TopToolbarControllerType type) {
return topToolbarView.getController(type);
}

View file

@ -577,7 +577,7 @@ public class MapInfoWidgetsFactory {
initToolbar(defaultController);
defaultController.updateToolbar(this);
}
updateVisibility(controller != null);
updateVisibility(controller != null && (!map.getContextMenu().isVisible() || controller.getType() == TopToolbarControllerType.CONTEXT_MENU));
}
public void updateColors(TopToolbarController controller) {
@ -801,7 +801,7 @@ public class MapInfoWidgetsFactory {
}
}
}
if (map.isTopToolbarActive()) {
if (map.isTopToolbarActive() || map.getContextMenu().isVisible()) {
updateVisibility(false);
} else if (!showNextTurn && updateWaypoint()) {
updateVisibility(true);

View file

@ -197,7 +197,8 @@ public class MapMarkersWidgetsFactory {
|| map.getMyApplication().getRoutingHelper().isRoutePlanningMode()
|| MapRouteInfoMenu.isVisible()
|| addressTopBar.getVisibility() == View.VISIBLE
|| map.isTopToolbarActive()) {
|| map.isTopToolbarActive()
|| map.getContextMenu().isVisible()) {
updateVisibility(false);
return;
}