Merge pull request #10673 from osmandapp/points_fixes
GPX menu fixes second part
This commit is contained in:
commit
22f49928da
15 changed files with 111 additions and 115 deletions
30
OsmAnd/res/layout/context_menu_controls.xml
Normal file
30
OsmAnd/res/layout/context_menu_controls.xml
Normal file
|
@ -0,0 +1,30 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:tools="http://schemas.android.com/tools"
|
||||||
|
android:id="@+id/map_controls_container"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
tools:visibility="invisible">
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/map_ruler"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="start|bottom"
|
||||||
|
android:layout_marginStart="@dimen/fab_margin_right"
|
||||||
|
android:layout_marginLeft="@dimen/fab_margin_right"
|
||||||
|
android:layout_marginEnd="@dimen/fab_margin_right"
|
||||||
|
android:layout_marginRight="@dimen/fab_margin_right" />
|
||||||
|
|
||||||
|
<include
|
||||||
|
layout="@layout/map_hud_controls"
|
||||||
|
android:layout_width="wrap_content"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_gravity="end|bottom"
|
||||||
|
android:layout_marginStart="@dimen/fab_margin_right"
|
||||||
|
android:layout_marginLeft="@dimen/fab_margin_right"
|
||||||
|
android:layout_marginEnd="@dimen/fab_margin_right"
|
||||||
|
android:layout_marginRight="@dimen/fab_margin_right" />
|
||||||
|
|
||||||
|
</FrameLayout>
|
|
@ -99,34 +99,7 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<include layout="@layout/context_menu_controls" />
|
||||||
android:id="@+id/map_controls_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
tools:visibility="invisible">
|
|
||||||
|
|
||||||
<include
|
|
||||||
layout="@layout/map_ruler"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="start|bottom"
|
|
||||||
android:layout_marginStart="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginLeft="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginEnd="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginRight="@dimen/fab_margin_right" />
|
|
||||||
|
|
||||||
<include
|
|
||||||
layout="@layout/map_hud_controls"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="end|bottom"
|
|
||||||
android:layout_marginStart="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginLeft="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginEnd="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginRight="@dimen/fab_margin_right" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/control_buttons"
|
android:id="@+id/control_buttons"
|
||||||
|
|
|
@ -90,34 +90,7 @@
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
<FrameLayout
|
<include layout="@layout/context_menu_controls" />
|
||||||
android:id="@+id/map_controls_container"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="bottom"
|
|
||||||
tools:visibility="invisible">
|
|
||||||
|
|
||||||
<include
|
|
||||||
layout="@layout/map_ruler"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="start|bottom"
|
|
||||||
android:layout_marginStart="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginLeft="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginEnd="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginRight="@dimen/fab_margin_right" />
|
|
||||||
|
|
||||||
<include
|
|
||||||
layout="@layout/map_hud_controls"
|
|
||||||
android:layout_width="wrap_content"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_gravity="end|bottom"
|
|
||||||
android:layout_marginStart="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginLeft="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginEnd="@dimen/fab_margin_right"
|
|
||||||
android:layout_marginRight="@dimen/fab_margin_right" />
|
|
||||||
|
|
||||||
</FrameLayout>
|
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:id="@+id/control_buttons"
|
android:id="@+id/control_buttons"
|
||||||
|
|
|
@ -191,6 +191,8 @@
|
||||||
|
|
||||||
</com.google.android.material.appbar.AppBarLayout>
|
</com.google.android.material.appbar.AppBarLayout>
|
||||||
|
|
||||||
|
<include layout="@layout/context_menu_controls" />
|
||||||
|
|
||||||
<com.google.android.material.bottomnavigation.BottomNavigationView
|
<com.google.android.material.bottomnavigation.BottomNavigationView
|
||||||
android:id="@+id/bottom_navigation"
|
android:id="@+id/bottom_navigation"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
|
|
|
@ -70,7 +70,6 @@ import net.osmand.plus.GpxSelectionHelper.GpxDisplayItem;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.OnDismissDialogFragmentListener;
|
import net.osmand.plus.OnDismissDialogFragmentListener;
|
||||||
import net.osmand.plus.OsmAndConstants;
|
import net.osmand.plus.OsmAndConstants;
|
||||||
import net.osmand.plus.OsmAndLocationProvider;
|
|
||||||
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
import net.osmand.plus.OsmAndLocationProvider.OsmAndLocationListener;
|
||||||
import net.osmand.plus.OsmAndLocationSimulation;
|
import net.osmand.plus.OsmAndLocationSimulation;
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
|
@ -1568,6 +1567,17 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public boolean shouldHideTopControls() {
|
||||||
|
boolean hideTopControls = !mapContextMenu.shouldShowTopControls();
|
||||||
|
|
||||||
|
TrackMenuFragment fragment = getTrackMenuFragment();
|
||||||
|
if (fragment != null) {
|
||||||
|
hideTopControls = hideTopControls || !fragment.shouldShowTopControls();
|
||||||
|
}
|
||||||
|
|
||||||
|
return hideTopControls;
|
||||||
|
}
|
||||||
|
|
||||||
public OsmandMapTileView getMapView() {
|
public OsmandMapTileView getMapView() {
|
||||||
return mapView;
|
return mapView;
|
||||||
}
|
}
|
||||||
|
|
|
@ -103,7 +103,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment
|
||||||
|
|
||||||
public interface ContextMenuFragmentListener {
|
public interface ContextMenuFragmentListener {
|
||||||
void onContextMenuYPosChanged(@NonNull ContextMenuFragment fragment, int y, boolean needMapAdjust, boolean animated);
|
void onContextMenuYPosChanged(@NonNull ContextMenuFragment fragment, int y, boolean needMapAdjust, boolean animated);
|
||||||
void onContextMenuStateChanged(@NonNull ContextMenuFragment fragment, int menuState);
|
void onContextMenuStateChanged(@NonNull ContextMenuFragment fragment, int menuState, int previousMenuState);
|
||||||
void onContextMenuDismiss(@NonNull ContextMenuFragment fragment);
|
void onContextMenuDismiss(@NonNull ContextMenuFragment fragment);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -815,7 +815,7 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment
|
||||||
|
|
||||||
ContextMenuFragmentListener listener = this.listener;
|
ContextMenuFragmentListener listener = this.listener;
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onContextMenuStateChanged(this, newMenuState);
|
listener.onContextMenuStateChanged(this, newMenuState, currentMenuState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -971,7 +971,8 @@ public abstract class ContextMenuFragment extends BaseOsmAndFragment
|
||||||
|
|
||||||
ContextMenuFragmentListener listener = ContextMenuFragment.this.listener;
|
ContextMenuFragmentListener listener = ContextMenuFragment.this.listener;
|
||||||
if (listener != null) {
|
if (listener != null) {
|
||||||
listener.onContextMenuStateChanged(ContextMenuFragment.this, getCurrentMenuState());
|
int menuState = getCurrentMenuState();
|
||||||
|
listener.onContextMenuStateChanged(ContextMenuFragment.this, menuState, menuState);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -82,7 +82,7 @@ public abstract class ContextMenuScrollFragment extends ContextMenuFragment impl
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuStateChanged(@NonNull ContextMenuFragment fragment, int menuState) {
|
public void onContextMenuStateChanged(@NonNull ContextMenuFragment fragment, int menuState, int previousMenuState) {
|
||||||
updateMapControlsVisibility(menuState);
|
updateMapControlsVisibility(menuState);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -22,18 +22,17 @@ import net.osmand.data.FavouritePoint;
|
||||||
import net.osmand.data.LatLon;
|
import net.osmand.data.LatLon;
|
||||||
import net.osmand.data.PointDescription;
|
import net.osmand.data.PointDescription;
|
||||||
import net.osmand.data.TransportStop;
|
import net.osmand.data.TransportStop;
|
||||||
import net.osmand.plus.settings.backend.ApplicationMode;
|
|
||||||
import net.osmand.plus.ContextMenuAdapter;
|
import net.osmand.plus.ContextMenuAdapter;
|
||||||
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
import net.osmand.plus.GpxSelectionHelper.SelectedGpxFile;
|
||||||
import net.osmand.plus.mapmarkers.MapMarker;
|
|
||||||
import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
|
|
||||||
import net.osmand.plus.OsmandApplication;
|
import net.osmand.plus.OsmandApplication;
|
||||||
import net.osmand.plus.OsmandPlugin;
|
import net.osmand.plus.OsmandPlugin;
|
||||||
import net.osmand.plus.R;
|
import net.osmand.plus.R;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
import net.osmand.plus.TargetPointsHelper.TargetPoint;
|
||||||
import net.osmand.plus.TargetPointsHelper.TargetPointChangedListener;
|
import net.osmand.plus.TargetPointsHelper.TargetPointChangedListener;
|
||||||
import net.osmand.plus.activities.MapActivity;
|
import net.osmand.plus.activities.MapActivity;
|
||||||
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.GpxUiHelper;
|
import net.osmand.plus.helpers.GpxUiHelper;
|
||||||
|
import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment.ContextMenuItemClickListener;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.ContextMenuToolbarController;
|
import net.osmand.plus.mapcontextmenu.MenuController.ContextMenuToolbarController;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
import net.osmand.plus.mapcontextmenu.MenuController.MenuState;
|
||||||
import net.osmand.plus.mapcontextmenu.MenuController.MenuType;
|
import net.osmand.plus.mapcontextmenu.MenuController.MenuType;
|
||||||
|
@ -47,12 +46,14 @@ import net.osmand.plus.mapcontextmenu.editors.RtePtEditor;
|
||||||
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
|
import net.osmand.plus.mapcontextmenu.editors.WptPtEditor;
|
||||||
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
import net.osmand.plus.mapcontextmenu.other.MapMultiSelectionMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
import net.osmand.plus.mapcontextmenu.other.ShareMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.AdditionalActionsBottomSheetDialogFragment.ContextMenuItemClickListener;
|
import net.osmand.plus.mapmarkers.MapMarker;
|
||||||
|
import net.osmand.plus.mapmarkers.MapMarkersHelper.MapMarkerChangedListener;
|
||||||
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
import net.osmand.plus.monitoring.OsmandMonitoringPlugin;
|
||||||
import net.osmand.plus.routing.RoutingHelper;
|
import net.osmand.plus.routing.RoutingHelper;
|
||||||
|
import net.osmand.plus.settings.backend.ApplicationMode;
|
||||||
import net.osmand.plus.transport.TransportStopRoute;
|
import net.osmand.plus.transport.TransportStopRoute;
|
||||||
import net.osmand.plus.views.layers.ContextMenuLayer;
|
|
||||||
import net.osmand.plus.views.OsmandMapLayer;
|
import net.osmand.plus.views.OsmandMapLayer;
|
||||||
|
import net.osmand.plus.views.layers.ContextMenuLayer;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarController;
|
||||||
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
import net.osmand.plus.views.mapwidgets.MapInfoWidgetsFactory.TopToolbarControllerType;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
|
@ -570,18 +571,21 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
public void updateControlsVisibility(boolean menuVisible) {
|
public void updateControlsVisibility(boolean menuVisible) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
int topControlsVisibility = shouldShowTopControls(menuVisible) ? View.VISIBLE : View.GONE;
|
boolean topControlsVisible = shouldShowTopControls(menuVisible);
|
||||||
mapActivity.findViewById(R.id.map_center_info).setVisibility(topControlsVisibility);
|
boolean bottomControlsVisible = shouldShowBottomControls(menuVisible);
|
||||||
mapActivity.findViewById(R.id.map_left_widgets_panel).setVisibility(topControlsVisibility);
|
updateControlsVisibility(mapActivity, topControlsVisible, bottomControlsVisible);
|
||||||
mapActivity.findViewById(R.id.map_right_widgets_panel).setVisibility(topControlsVisibility);
|
|
||||||
|
|
||||||
int bottomControlsVisibility = shouldShowBottomControls(menuVisible) ? View.VISIBLE : View.GONE;
|
|
||||||
mapActivity.findViewById(R.id.bottom_controls_container).setVisibility(bottomControlsVisibility);
|
|
||||||
|
|
||||||
mapActivity.refreshMap();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void updateControlsVisibility(@NonNull MapActivity mapActivity, boolean topControlsVisible, boolean bottomControlsVisible) {
|
||||||
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_center_info), topControlsVisible);
|
||||||
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_left_widgets_panel), topControlsVisible);
|
||||||
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_right_widgets_panel), topControlsVisible);
|
||||||
|
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.bottom_controls_container), bottomControlsVisible);
|
||||||
|
|
||||||
|
mapActivity.refreshMap();
|
||||||
|
}
|
||||||
|
|
||||||
public boolean shouldShowTopControls() {
|
public boolean shouldShowTopControls() {
|
||||||
return shouldShowTopControls(isVisible());
|
return shouldShowTopControls(isVisible());
|
||||||
}
|
}
|
||||||
|
|
|
@ -815,7 +815,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onContextMenuStateChanged(@NonNull ContextMenuFragment fragment, int menuState) {
|
public void onContextMenuStateChanged(@NonNull ContextMenuFragment fragment, int menuState, int previousMenuState) {
|
||||||
LockableViewPager viewPager = this.viewPager;
|
LockableViewPager viewPager = this.viewPager;
|
||||||
RouteDetailsFragment current = getCurrentFragment();
|
RouteDetailsFragment current = getCurrentFragment();
|
||||||
if (viewPager != null && fragment == current) {
|
if (viewPager != null && fragment == current) {
|
||||||
|
|
|
@ -74,7 +74,9 @@ public class OptionsCard extends BaseCard {
|
||||||
items.add(createDirectionsItem());
|
items.add(createDirectionsItem());
|
||||||
}
|
}
|
||||||
items.add(createDividerItem());
|
items.add(createDividerItem());
|
||||||
items.add(createJoinGapsItem());
|
if (gpxFile.getGeneralTrack() != null) {
|
||||||
|
items.add(createJoinGapsItem());
|
||||||
|
}
|
||||||
items.add(createAnalyzeOnMapItem());
|
items.add(createAnalyzeOnMapItem());
|
||||||
items.add(createAnalyzeByIntervalsItem());
|
items.add(createAnalyzeByIntervalsItem());
|
||||||
|
|
||||||
|
|
|
@ -152,6 +152,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
|
|
||||||
private int menuTitleHeight;
|
private int menuTitleHeight;
|
||||||
private int toolbarHeightPx;
|
private int toolbarHeightPx;
|
||||||
|
private boolean mapPositionAdjusted;
|
||||||
|
|
||||||
public enum TrackMenuType {
|
public enum TrackMenuType {
|
||||||
OVERVIEW(R.id.action_overview, R.string.shared_string_overview),
|
OVERVIEW(R.id.action_overview, R.string.shared_string_overview),
|
||||||
|
@ -258,6 +259,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
|
|
||||||
if (isPortrait()) {
|
if (isPortrait()) {
|
||||||
AndroidUiHelper.updateVisibility(getTopShadow(), true);
|
AndroidUiHelper.updateVisibility(getTopShadow(), true);
|
||||||
|
AndroidUiHelper.updateVisibility(view.findViewById(R.id.map_my_location_button), false);
|
||||||
} else {
|
} else {
|
||||||
int widthNoShadow = getLandscapeNoShadowWidth();
|
int widthNoShadow = getLandscapeNoShadowWidth();
|
||||||
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(widthNoShadow, ViewGroup.LayoutParams.WRAP_CONTENT);
|
FrameLayout.LayoutParams params = new FrameLayout.LayoutParams(widthNoShadow, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||||
|
@ -269,7 +271,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
setupToolbar();
|
setupToolbar();
|
||||||
updateHeader();
|
updateHeader();
|
||||||
setupButtons(view);
|
setupButtons(view);
|
||||||
enterTrackAppearanceMode();
|
|
||||||
runLayoutListener();
|
runLayoutListener();
|
||||||
}
|
}
|
||||||
return view;
|
return view;
|
||||||
|
@ -455,15 +456,21 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
public void onContextMenuStateChanged(@NonNull ContextMenuFragment fragment, int currentMenuState, int previousMenuState) {
|
||||||
super.onViewCreated(view, savedInstanceState);
|
super.onContextMenuStateChanged(fragment, currentMenuState, previousMenuState);
|
||||||
adjustMapPosition(getHeight());
|
|
||||||
|
boolean changed = currentMenuState != previousMenuState;
|
||||||
|
if (changed) {
|
||||||
|
updateControlsVisibility(true);
|
||||||
|
}
|
||||||
|
if (currentMenuState != MenuState.FULL_SCREEN && (changed || !mapPositionAdjusted)) {
|
||||||
|
adjustMapPosition(getViewY());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onDestroyView() {
|
public void onDestroyView() {
|
||||||
super.onDestroyView();
|
super.onDestroyView();
|
||||||
exitTrackAppearanceMode();
|
|
||||||
updateStatusBarColor();
|
updateStatusBarColor();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -474,6 +481,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
if (mapActivity != null && trackChartPoints != null) {
|
if (mapActivity != null && trackChartPoints != null) {
|
||||||
mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(trackChartPoints);
|
mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(trackChartPoints);
|
||||||
}
|
}
|
||||||
|
updateControlsVisibility(true);
|
||||||
startLocationUpdate();
|
startLocationUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -484,6 +492,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(null);
|
mapActivity.getMapLayers().getGpxLayer().setTrackChartPoints(null);
|
||||||
}
|
}
|
||||||
|
updateControlsVisibility(false);
|
||||||
stopLocationUpdate();
|
stopLocationUpdate();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -569,26 +578,25 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
updateContent();
|
updateContent();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void enterTrackAppearanceMode() {
|
public void updateControlsVisibility(boolean menuVisible) {
|
||||||
MapActivity mapActivity = getMapActivity();
|
MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
boolean portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
boolean topControlsVisible = shouldShowTopControls(menuVisible);
|
||||||
AndroidUiHelper.setVisibility(mapActivity, portrait ? View.INVISIBLE : View.GONE,
|
boolean bottomControlsVisible = shouldShowBottomControls(menuVisible);
|
||||||
R.id.map_left_widgets_panel,
|
MapContextMenu.updateControlsVisibility(mapActivity, topControlsVisible, bottomControlsVisible);
|
||||||
R.id.map_right_widgets_panel,
|
|
||||||
R.id.map_center_info);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void exitTrackAppearanceMode() {
|
public boolean shouldShowTopControls() {
|
||||||
MapActivity mapActivity = getMapActivity();
|
return shouldShowTopControls(isVisible());
|
||||||
if (mapActivity != null) {
|
}
|
||||||
AndroidUiHelper.setVisibility(mapActivity, View.VISIBLE,
|
|
||||||
R.id.map_left_widgets_panel,
|
public boolean shouldShowTopControls(boolean menuVisible) {
|
||||||
R.id.map_right_widgets_panel,
|
return !menuVisible || !isPortrait() || getCurrentMenuState() == MenuState.HEADER_ONLY;
|
||||||
R.id.map_center_info,
|
}
|
||||||
R.id.map_search_button);
|
|
||||||
}
|
public boolean shouldShowBottomControls(boolean menuVisible) {
|
||||||
|
return !menuVisible || !isPortrait();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -760,15 +768,6 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
protected int applyPosY(int currentY, boolean needCloseMenu, boolean needMapAdjust, int previousMenuState, int newMenuState, int dZoom, boolean animated) {
|
|
||||||
int y = super.applyPosY(currentY, needCloseMenu, needMapAdjust, previousMenuState, newMenuState, dZoom, animated);
|
|
||||||
if (needMapAdjust) {
|
|
||||||
adjustMapPosition(y);
|
|
||||||
}
|
|
||||||
return y;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateToolbar(int y, boolean animated) {
|
public void updateToolbar(int y, boolean animated) {
|
||||||
final MapActivity mapActivity = getMapActivity();
|
final MapActivity mapActivity = getMapActivity();
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
|
@ -821,6 +820,7 @@ public class TrackMenuFragment extends ContextMenuScrollFragment implements Card
|
||||||
if (r.left != 0 && r.right != 0) {
|
if (r.left != 0 && r.right != 0) {
|
||||||
mapActivity.getMapView().fitRectToMap(r.left, r.right, r.top, r.bottom, tileBoxWidthPx, tileBoxHeightPx, 0);
|
mapActivity.getMapView().fitRectToMap(r.left, r.right, r.top, r.bottom, tileBoxWidthPx, tileBoxHeightPx, 0);
|
||||||
}
|
}
|
||||||
|
mapPositionAdjusted = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -859,30 +859,30 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
}
|
}
|
||||||
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
boolean routeFollowingMode = !routePlanningMode && rh.isFollowingMode();
|
||||||
boolean trackDialogOpened = mapActivity.getTrackDetailsMenu().isVisible();
|
boolean trackDialogOpened = mapActivity.getTrackDetailsMenu().isVisible();
|
||||||
boolean contextMenuOpened = !mapActivity.getContextMenu().shouldShowTopControls();
|
boolean shouldHideTopControls = mapActivity.shouldHideTopControls();
|
||||||
boolean showRouteCalculationControls = routePlanningMode ||
|
boolean showRouteCalculationControls = routePlanningMode ||
|
||||||
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
((app.accessibilityEnabled() || (System.currentTimeMillis() - touchEvent < TIMEOUT_TO_SHOW_BUTTONS)) && routeFollowingMode);
|
||||||
boolean routeDialogOpened = mapRouteInfoMenu.isVisible() || (showRouteCalculationControls && mapRouteInfoMenu.needShowMenu());
|
boolean routeDialogOpened = mapRouteInfoMenu.isVisible() || (showRouteCalculationControls && mapRouteInfoMenu.needShowMenu());
|
||||||
updateMyLocationVisibility(backToLocationControl, rh, routeDialogOpened || contextMenuOpened);
|
updateMyLocationVisibility(backToLocationControl, rh, routeDialogOpened || shouldHideTopControls);
|
||||||
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_info_dark : R.drawable.ic_action_gdirections_dark);
|
//routePlanningBtn.setIconResId(routeFollowingMode ? R.drawable.ic_action_info_dark : R.drawable.ic_action_gdirections_dark);
|
||||||
|
|
||||||
updateRoutePlaningButton(rh, routePlanningMode);
|
updateRoutePlaningButton(rh, routePlanningMode);
|
||||||
|
|
||||||
boolean showBottomMenuButtons = (showRouteCalculationControls || !routeFollowingMode)
|
boolean showBottomMenuButtons = (showRouteCalculationControls || !routeFollowingMode)
|
||||||
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode()
|
&& !isInMovingMarkerMode() && !isInGpxDetailsMode() && !isInMeasurementToolMode()
|
||||||
&& !isInPlanRouteMode() && !contextMenuOpened && !isInChoosingRoutesMode()
|
&& !isInPlanRouteMode() && !shouldHideTopControls && !isInChoosingRoutesMode()
|
||||||
&& !isInWaypointsChoosingMode() && !isInFollowTrackMode() && !isInTrackAppearanceMode();
|
&& !isInWaypointsChoosingMode() && !isInFollowTrackMode() && !isInTrackAppearanceMode();
|
||||||
routePlanningBtn.updateVisibility(showBottomMenuButtons);
|
routePlanningBtn.updateVisibility(showBottomMenuButtons);
|
||||||
menuControl.updateVisibility(showBottomMenuButtons);
|
menuControl.updateVisibility(showBottomMenuButtons);
|
||||||
|
|
||||||
boolean showZoomButtons = !routeDialogOpened && !contextMenuOpened && !isInTrackAppearanceMode()
|
boolean showZoomButtons = !routeDialogOpened && !shouldHideTopControls && !isInTrackAppearanceMode()
|
||||||
&& (!isInGpxApproximationMode() || !isPotrait())
|
&& (!isInGpxApproximationMode() || !isPotrait())
|
||||||
&& !isInFollowTrackMode() && (!isInChoosingRoutesMode() || !isInWaypointsChoosingMode() || !portrait);
|
&& !isInFollowTrackMode() && (!isInChoosingRoutesMode() || !isInWaypointsChoosingMode() || !portrait);
|
||||||
mapZoomIn.updateVisibility(showZoomButtons);
|
mapZoomIn.updateVisibility(showZoomButtons);
|
||||||
mapZoomOut.updateVisibility(showZoomButtons);
|
mapZoomOut.updateVisibility(showZoomButtons);
|
||||||
|
|
||||||
boolean forceHideCompass = routeDialogOpened || trackDialogOpened || isInMeasurementToolMode()
|
boolean forceHideCompass = routeDialogOpened || trackDialogOpened || isInMeasurementToolMode()
|
||||||
|| isInPlanRouteMode() || contextMenuOpened || isInChoosingRoutesMode()
|
|| isInPlanRouteMode() || shouldHideTopControls || isInChoosingRoutesMode()
|
||||||
|| isInTrackAppearanceMode() || isInWaypointsChoosingMode() || isInFollowTrackMode();
|
|| isInTrackAppearanceMode() || isInWaypointsChoosingMode() || isInFollowTrackMode();
|
||||||
compassHud.forceHideCompass = forceHideCompass;
|
compassHud.forceHideCompass = forceHideCompass;
|
||||||
compassHud.updateVisibility(!forceHideCompass && shouldShowCompass());
|
compassHud.updateVisibility(!forceHideCompass && shouldShowCompass());
|
||||||
|
@ -892,7 +892,7 @@ public class MapControlsLayer extends OsmandMapLayer {
|
||||||
if (layersHud.setIconResId(appMode.getIconRes())) {
|
if (layersHud.setIconResId(appMode.getIconRes())) {
|
||||||
layersHud.update(app, isNight);
|
layersHud.update(app, isNight);
|
||||||
}
|
}
|
||||||
boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !contextMenuOpened
|
boolean showTopButtons = !routeDialogOpened && !trackDialogOpened && !shouldHideTopControls
|
||||||
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !isInChoosingRoutesMode()
|
&& !isInMeasurementToolMode() && !isInPlanRouteMode() && !isInChoosingRoutesMode()
|
||||||
&& !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode();
|
&& !isInTrackAppearanceMode() && !isInWaypointsChoosingMode() && !isInFollowTrackMode();
|
||||||
layersHud.updateVisibility(showTopButtons);
|
layersHud.updateVisibility(showTopButtons);
|
||||||
|
|
|
@ -425,6 +425,7 @@ public class MapQuickActionLayer extends OsmandMapLayer implements QuickActionRe
|
||||||
measurementToolLayer.isInMeasurementMode() ||
|
measurementToolLayer.isInMeasurementMode() ||
|
||||||
mapMarkersLayer.isInPlanRouteMode() ||
|
mapMarkersLayer.isInPlanRouteMode() ||
|
||||||
gpxLayer.isInTrackAppearanceMode() ||
|
gpxLayer.isInTrackAppearanceMode() ||
|
||||||
|
mapControlsLayer.isInTrackMenuMode() ||
|
||||||
mapRouteInfoMenu.isVisible() ||
|
mapRouteInfoMenu.isVisible() ||
|
||||||
MapRouteInfoMenu.chooseRoutesVisible ||
|
MapRouteInfoMenu.chooseRoutesVisible ||
|
||||||
MapRouteInfoMenu.waypointsVisible ||
|
MapRouteInfoMenu.waypointsVisible ||
|
||||||
|
|
|
@ -974,7 +974,7 @@ public class MapInfoWidgetsFactory {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (map.isTopToolbarActive() || !map.getContextMenu().shouldShowTopControls() || MapRouteInfoMenu.chooseRoutesVisible || MapRouteInfoMenu.waypointsVisible) {
|
if (map.isTopToolbarActive() || map.shouldHideTopControls() || MapRouteInfoMenu.chooseRoutesVisible || MapRouteInfoMenu.waypointsVisible) {
|
||||||
updateVisibility(false);
|
updateVisibility(false);
|
||||||
} else if (showClosestWaypointFirstInAddress && updateWaypoint()) {
|
} else if (showClosestWaypointFirstInAddress && updateWaypoint()) {
|
||||||
updateVisibility(true);
|
updateVisibility(true);
|
||||||
|
@ -1232,7 +1232,7 @@ public class MapInfoWidgetsFactory {
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public boolean updateInfo() {
|
public boolean updateInfo() {
|
||||||
boolean visible = settings.SHOW_COORDINATES_WIDGET.get() && map.getContextMenu().shouldShowTopControls()
|
boolean visible = settings.SHOW_COORDINATES_WIDGET.get() && !map.shouldHideTopControls()
|
||||||
&& map.getMapRouteInfoMenu().shouldShowTopControls() && !map.isTopToolbarActive()
|
&& map.getMapRouteInfoMenu().shouldShowTopControls() && !map.isTopToolbarActive()
|
||||||
&& !map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
&& !map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
||||||
&& !MapRouteInfoMenu.chooseRoutesVisible && !MapRouteInfoMenu.waypointsVisible
|
&& !MapRouteInfoMenu.chooseRoutesVisible && !MapRouteInfoMenu.waypointsVisible
|
||||||
|
|
|
@ -191,7 +191,7 @@ public class MapMarkersWidgetsFactory {
|
||||||
|| map.getMapRouteInfoMenu().isVisible()
|
|| map.getMapRouteInfoMenu().isVisible()
|
||||||
|| addressTopBar.getVisibility() == View.VISIBLE
|
|| addressTopBar.getVisibility() == View.VISIBLE
|
||||||
|| map.isTopToolbarActive()
|
|| map.isTopToolbarActive()
|
||||||
|| !map.getContextMenu().shouldShowTopControls()
|
|| map.shouldHideTopControls()
|
||||||
|| map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
|| map.getMapLayers().getGpxLayer().isInTrackAppearanceMode()
|
||||||
|| map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()) {
|
|| map.getMapLayers().getMapMarkersLayer().isInPlanRouteMode()) {
|
||||||
updateVisibility(false);
|
updateVisibility(false);
|
||||||
|
|
Loading…
Reference in a new issue