Fix route menu state after follow track
This commit is contained in:
parent
94ed07a3df
commit
276e07bc95
4 changed files with 34 additions and 10 deletions
|
@ -127,7 +127,6 @@ import net.osmand.plus.quickaction.QuickActionListFragment;
|
|||
import net.osmand.plus.render.RendererRegistry;
|
||||
import net.osmand.plus.resources.ResourceManager;
|
||||
import net.osmand.plus.routepreparationmenu.ChooseRouteFragment;
|
||||
import net.osmand.plus.routepreparationmenu.FollowTrackFragment;
|
||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenu;
|
||||
import net.osmand.plus.routepreparationmenu.MapRouteInfoMenuFragment;
|
||||
import net.osmand.plus.routing.IRouteInformationListener;
|
||||
|
@ -2330,10 +2329,6 @@ public class MapActivity extends OsmandActionBarActivity implements DownloadEven
|
|||
return getFragment(GpxApproximationFragment.TAG);
|
||||
}
|
||||
|
||||
public FollowTrackFragment getFollowTrackFragment() {
|
||||
return getFragment(FollowTrackFragment.TAG);
|
||||
}
|
||||
|
||||
private SnapTrackWarningBottomSheet getSnapTrackWarningBottomSheet() {
|
||||
return getFragment(SnapTrackWarningBottomSheet.TAG);
|
||||
}
|
||||
|
|
|
@ -297,6 +297,7 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
|||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
exitTrackAppearanceMode();
|
||||
onDismiss();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -554,4 +555,18 @@ public class FollowTrackFragment extends ContextMenuScrollFragment implements Ca
|
|||
log.error(e);
|
||||
}
|
||||
}
|
||||
|
||||
private void onDismiss() {
|
||||
try {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
if (!mapActivity.isChangingConfigurations()) {
|
||||
mapActivity.getMapRouteInfoMenu().cancelSelectionFromTracks();
|
||||
}
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error(e);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -147,6 +147,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
private PointType selectFromMapPointType;
|
||||
private int selectFromMapMenuState = MenuState.HEADER_ONLY;
|
||||
private boolean selectFromMapWaypoints;
|
||||
private boolean selectFromTracks;
|
||||
|
||||
private boolean showMenu = false;
|
||||
private int showMenuState = DEFAULT_MENU_STATE;
|
||||
|
@ -1563,8 +1564,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
if (mapActivity != null) {
|
||||
GPXRouteParamsBuilder routeParams = mapActivity.getRoutingHelper().getCurrentGPXRoute();
|
||||
if (routeParams != null) {
|
||||
FollowTrackFragment trackOptionsFragment = new FollowTrackFragment();
|
||||
FollowTrackFragment.showInstance(mapActivity, trackOptionsFragment);
|
||||
selectTrack();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1950,6 +1950,19 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
}
|
||||
}
|
||||
|
||||
public void selectTrack() {
|
||||
selectFromTracks = true;
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
FollowTrackFragment trackOptionsFragment = new FollowTrackFragment();
|
||||
FollowTrackFragment.showInstance(mapActivity, trackOptionsFragment);
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelSelectionFromTracks() {
|
||||
selectFromTracks = false;
|
||||
}
|
||||
|
||||
public void setupFields(PointType pointType) {
|
||||
View mainView = getMainView();
|
||||
if (mainView != null) {
|
||||
|
@ -2249,7 +2262,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
if (switched) {
|
||||
mapActivity.getMapLayers().getMapControlsLayer().switchToRouteFollowingLayout();
|
||||
}
|
||||
if (mapActivity.getPointToNavigate() == null && !selectFromMapTouch && mapActivity.getFollowTrackFragment() == null) {
|
||||
if (mapActivity.getPointToNavigate() == null && !selectFromMapTouch && !selectFromTracks) {
|
||||
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
||||
}
|
||||
mapActivity.updateStatusBarColor();
|
||||
|
|
|
@ -367,8 +367,9 @@ public class RouteOptionsBottomSheet extends MenuBottomSheetDialogFragment {
|
|||
.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FollowTrackFragment trackOptionsFragment = new FollowTrackFragment();
|
||||
FollowTrackFragment.showInstance(mapActivity, trackOptionsFragment);
|
||||
MapRouteInfoMenu mapRouteInfoMenu = mapActivity.getMapRouteInfoMenu();
|
||||
mapRouteInfoMenu.hide();
|
||||
mapRouteInfoMenu.selectTrack();
|
||||
dismiss();
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Reference in a new issue