Merge branch 'r3.3'
This commit is contained in:
commit
9e104c60eb
3 changed files with 35 additions and 16 deletions
|
@ -79,6 +79,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
public static final String ROUTE_INFO_STATE_KEY = "route_info_state_key";
|
public static final String ROUTE_INFO_STATE_KEY = "route_info_state_key";
|
||||||
public static final String INITIAL_MENU_STATE_KEY = "initial_menu_state_key";
|
public static final String INITIAL_MENU_STATE_KEY = "initial_menu_state_key";
|
||||||
public static final String USE_ROUTE_INFO_MENU_KEY = "use_route_info_menu_key";
|
public static final String USE_ROUTE_INFO_MENU_KEY = "use_route_info_menu_key";
|
||||||
|
public static final String ADJUST_MAP_KEY = "adjust_map_key";
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private LockableViewPager viewPager;
|
private LockableViewPager viewPager;
|
||||||
|
@ -103,6 +104,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
private boolean publicTransportMode;
|
private boolean publicTransportMode;
|
||||||
private boolean useRouteInfoMenu;
|
private boolean useRouteInfoMenu;
|
||||||
private boolean openingAnalyseOnMap = false;
|
private boolean openingAnalyseOnMap = false;
|
||||||
|
private boolean needAdjustMap;
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
@Override
|
@Override
|
||||||
|
@ -119,6 +121,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
if (args != null) {
|
if (args != null) {
|
||||||
routeIndex = args.getInt(ROUTE_INDEX_KEY);
|
routeIndex = args.getInt(ROUTE_INDEX_KEY);
|
||||||
useRouteInfoMenu = args.getBoolean(USE_ROUTE_INFO_MENU_KEY, false);
|
useRouteInfoMenu = args.getBoolean(USE_ROUTE_INFO_MENU_KEY, false);
|
||||||
|
needAdjustMap = args.getBoolean(ADJUST_MAP_KEY, false);
|
||||||
initialMenuState = args.getInt(INITIAL_MENU_STATE_KEY, initialMenuState);
|
initialMenuState = args.getInt(INITIAL_MENU_STATE_KEY, initialMenuState);
|
||||||
}
|
}
|
||||||
routesCount = 1;
|
routesCount = 1;
|
||||||
|
@ -816,6 +819,10 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
updatePagesViewVisibility(menuState);
|
updatePagesViewVisibility(menuState);
|
||||||
updateZoomButtonsVisibility(menuState);
|
updateZoomButtonsVisibility(menuState);
|
||||||
updateViewPager(fragment.getViewY());
|
updateViewPager(fragment.getViewY());
|
||||||
|
if (needAdjustMap) {
|
||||||
|
needAdjustMap = false;
|
||||||
|
f.showRouteOnMap();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -846,14 +853,14 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static boolean showFromRouteInfo(FragmentManager fragmentManager, int routeIndex,
|
static boolean showFromRouteInfo(FragmentManager fragmentManager, int routeIndex, int initialMenuState) {
|
||||||
boolean useRouteInfoMenu, int initialMenuState) {
|
|
||||||
try {
|
try {
|
||||||
ChooseRouteFragment fragment = new ChooseRouteFragment();
|
ChooseRouteFragment fragment = new ChooseRouteFragment();
|
||||||
Bundle args = new Bundle();
|
Bundle args = new Bundle();
|
||||||
args.putInt(ROUTE_INDEX_KEY, routeIndex);
|
args.putInt(ROUTE_INDEX_KEY, routeIndex);
|
||||||
args.putBoolean(USE_ROUTE_INFO_MENU_KEY, useRouteInfoMenu);
|
args.putBoolean(USE_ROUTE_INFO_MENU_KEY, true);
|
||||||
args.putInt(INITIAL_MENU_STATE_KEY, initialMenuState);
|
args.putInt(INITIAL_MENU_STATE_KEY, initialMenuState);
|
||||||
|
args.putBoolean(ADJUST_MAP_KEY, initialMenuState != MenuState.FULL_SCREEN);
|
||||||
fragment.setArguments(args);
|
fragment.setArguments(args);
|
||||||
fragmentManager.beginTransaction()
|
fragmentManager.beginTransaction()
|
||||||
.add(R.id.routeMenuContainer, fragment, TAG)
|
.add(R.id.routeMenuContainer, fragment, TAG)
|
||||||
|
|
|
@ -601,7 +601,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (mapActivity != null) {
|
if (mapActivity != null) {
|
||||||
if (card instanceof SimpleRouteCard) {
|
if (card instanceof SimpleRouteCard) {
|
||||||
hide();
|
hide();
|
||||||
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(), 0, true, MenuState.FULL_SCREEN);
|
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(), 0, MenuState.FULL_SCREEN);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -626,15 +626,14 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (buttonIndex == PublicTransportCard.DETAILS_BUTTON_INDEX) {
|
if (buttonIndex == PublicTransportCard.DETAILS_BUTTON_INDEX) {
|
||||||
hide();
|
hide();
|
||||||
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(),
|
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(),
|
||||||
((PublicTransportCard) card).getRouteId(), true, MenuState.FULL_SCREEN);
|
((PublicTransportCard) card).getRouteId(), MenuState.FULL_SCREEN);
|
||||||
} else if (buttonIndex == PublicTransportCard.SHOW_BUTTON_INDEX) {
|
} else if (buttonIndex == PublicTransportCard.SHOW_BUTTON_INDEX) {
|
||||||
setupCards();
|
setupCards();
|
||||||
openMenuHeaderOnly();
|
openMenuHeaderOnly();
|
||||||
}
|
}
|
||||||
} else if (card instanceof SimpleRouteCard) {
|
} else if (card instanceof SimpleRouteCard) {
|
||||||
hide();
|
hide();
|
||||||
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(), 0,
|
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(), 0, MenuState.FULL_SCREEN);
|
||||||
true, MenuState.FULL_SCREEN);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1325,7 +1324,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
||||||
if (app.getRoutingHelper().isPublicTransportMode()) {
|
if (app.getRoutingHelper().isPublicTransportMode()) {
|
||||||
if (isTransportRouteCalculated()) {
|
if (isTransportRouteCalculated()) {
|
||||||
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(),
|
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(),
|
||||||
app.getTransportRoutingHelper().getCurrentRoute(), true, MenuState.HEADER_ONLY);
|
app.getTransportRoutingHelper().getCurrentRoute(), MenuState.HEADER_ONLY);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
mapActivity.getMapLayers().getMapControlsLayer().startNavigation();
|
mapActivity.getMapLayers().getMapControlsLayer().startNavigation();
|
||||||
|
|
|
@ -620,6 +620,21 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
|
||||||
((ViewGroup) view).addView(baseItemView);
|
((ViewGroup) view).addView(baseItemView);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void showRouteOnMap() {
|
||||||
|
OsmandApplication app = requireMyApplication();
|
||||||
|
if (transportCard == null) {
|
||||||
|
RouteCalculationResult route = app.getRoutingHelper().getRoute();
|
||||||
|
if (route != null) {
|
||||||
|
showRouteOnMap(route);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
TransportRouteResult route = app.getTransportRoutingHelper().getCurrentRouteResult();
|
||||||
|
if (route != null) {
|
||||||
|
showRouteOnMap(route);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void showRouteOnMap(@NonNull RouteCalculationResult result) {
|
public void showRouteOnMap(@NonNull RouteCalculationResult result) {
|
||||||
QuadRect rect = result.getLocationsRect();
|
QuadRect rect = result.getLocationsRect();
|
||||||
if (rect != null) {
|
if (rect != null) {
|
||||||
|
@ -644,8 +659,7 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void showRouteOnMap(TransportRouteResult result) {
|
public void showRouteOnMap(@NonNull TransportRouteResult result) {
|
||||||
if (result != null) {
|
|
||||||
OsmandApplication app = requireMyApplication();
|
OsmandApplication app = requireMyApplication();
|
||||||
QuadRect rect = app.getTransportRoutingHelper().getTransportRouteRect(result);
|
QuadRect rect = app.getTransportRoutingHelper().getTransportRouteRect(result);
|
||||||
if (rect != null) {
|
if (rect != null) {
|
||||||
|
@ -653,7 +667,6 @@ public class RouteDetailsFragment extends ContextMenuFragment implements PublicT
|
||||||
fitRectOnMap(rect);
|
fitRectOnMap(rect);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
private void addWalkRouteIcon(LinearLayout container) {
|
private void addWalkRouteIcon(LinearLayout container) {
|
||||||
OsmandApplication app = requireMyApplication();
|
OsmandApplication app = requireMyApplication();
|
||||||
|
|
Loading…
Reference in a new issue