Merge branch 'r3.3'
This commit is contained in:
commit
abcaa6595e
6 changed files with 131 additions and 110 deletions
|
@ -57,6 +57,23 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
public static final String FAVOURITES = "favourites";
|
||||
|
||||
private PointType pointType = PointType.START;
|
||||
private DialogListener listener;
|
||||
|
||||
public interface DialogListener {
|
||||
void onSelectOnMap(AddPointBottomSheetDialog dialog);
|
||||
}
|
||||
|
||||
public DialogListener getListener() {
|
||||
return listener;
|
||||
}
|
||||
|
||||
public void setListener(DialogListener listener) {
|
||||
this.listener = listener;
|
||||
}
|
||||
|
||||
public PointType getPointType() {
|
||||
return pointType;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMenuItems(Bundle savedInstanceState) {
|
||||
|
@ -249,6 +266,10 @@ public class AddPointBottomSheetDialog extends MenuBottomSheetDialogFragment {
|
|||
if (mapActivity != null) {
|
||||
MapRouteInfoMenu menu = mapActivity.getMapRouteInfoMenu();
|
||||
menu.selectOnScreen(pointType);
|
||||
DialogListener listener = getListener();
|
||||
if (listener != null) {
|
||||
listener.onSelectOnMap(AddPointBottomSheetDialog.this);
|
||||
}
|
||||
}
|
||||
dismiss();
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
public static final String ROUTE_INDEX_KEY = "route_index_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 USE_ROUTE_INFO_MENU_KEY = "use_route_info_menu_key";
|
||||
|
||||
@Nullable
|
||||
private LockableViewPager viewPager;
|
||||
|
@ -98,7 +99,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
private int routesCount;
|
||||
|
||||
private boolean publicTransportMode;
|
||||
private int routeInfoMenuState = -1;
|
||||
private boolean useRouteInfoMenu;
|
||||
private boolean openingAnalyseOnMap = false;
|
||||
|
||||
@Nullable
|
||||
|
@ -115,7 +116,7 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
Bundle args = getArguments();
|
||||
if (args != null) {
|
||||
routeIndex = args.getInt(ROUTE_INDEX_KEY);
|
||||
routeInfoMenuState = args.getInt(ROUTE_INFO_STATE_KEY, -1);
|
||||
useRouteInfoMenu = args.getBoolean(USE_ROUTE_INFO_MENU_KEY, false);
|
||||
initialMenuState = args.getInt(INITIAL_MENU_STATE_KEY, initialMenuState);
|
||||
}
|
||||
routesCount = 1;
|
||||
|
@ -218,10 +219,16 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
if (!wasDrawerDisabled) {
|
||||
mapActivity.enableDrawer();
|
||||
}
|
||||
updateControlsVisibility(true, routeInfoMenuState != -1);
|
||||
updateControlsVisibility(true, useRouteInfoMenu);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
outState.putBoolean(USE_ROUTE_INFO_MENU_KEY, useRouteInfoMenu);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getStatusBarColorId() {
|
||||
View view = getView();
|
||||
|
@ -270,8 +277,8 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
mapActivity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss();
|
||||
if (routeInfoMenuState != -1 && !openingAnalyseOnMap) {
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog(routeInfoMenuState);
|
||||
if (useRouteInfoMenu && !openingAnalyseOnMap) {
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
|
@ -837,12 +844,12 @@ public class ChooseRouteFragment extends BaseOsmAndFragment implements ContextMe
|
|||
}
|
||||
|
||||
static boolean showFromRouteInfo(FragmentManager fragmentManager, int routeIndex,
|
||||
int routeInfoState, int initialMenuState) {
|
||||
boolean useRouteInfoMenu, int initialMenuState) {
|
||||
try {
|
||||
ChooseRouteFragment fragment = new ChooseRouteFragment();
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ROUTE_INDEX_KEY, routeIndex);
|
||||
args.putInt(ROUTE_INFO_STATE_KEY, routeInfoState);
|
||||
args.putBoolean(USE_ROUTE_INFO_MENU_KEY, useRouteInfoMenu);
|
||||
args.putInt(INITIAL_MENU_STATE_KEY, initialMenuState);
|
||||
fragment.setArguments(args);
|
||||
fragmentManager.beginTransaction()
|
||||
|
|
|
@ -116,9 +116,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
private boolean selectFromMapTouch;
|
||||
private PointType selectFromMapPointType;
|
||||
private int selectFromMapMenuState = MenuState.HEADER_ONLY;
|
||||
private boolean selectFromMapWaypoints;
|
||||
|
||||
private boolean showMenu = false;
|
||||
private int showMenuState = DEFAULT_MENU_STATE;
|
||||
private int lastMenuState = MenuState.HEADER_ONLY;
|
||||
|
||||
@Nullable
|
||||
private MapActivity mapActivity;
|
||||
|
@ -234,8 +236,9 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
}
|
||||
|
||||
public boolean onSingleTap(PointF point, RotatedTileBox tileBox) {
|
||||
OsmandApplication app = getApp();
|
||||
if (app != null) {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
OsmandApplication app = mapActivity.getMyApplication();
|
||||
if (selectFromMapTouch) {
|
||||
LatLon latlon = tileBox.getLatLonFromPixel(point.x, point.y);
|
||||
selectFromMapTouch = false;
|
||||
|
@ -257,7 +260,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
targets.setWorkPoint(latlon, null);
|
||||
break;
|
||||
}
|
||||
show(selectFromMapMenuState);
|
||||
if (selectFromMapWaypoints) {
|
||||
WaypointsFragment.showInstance(mapActivity.getSupportFragmentManager(), true);
|
||||
} else {
|
||||
show(selectFromMapMenuState);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
@ -329,7 +336,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
if (fragmentRef != null) {
|
||||
return fragmentRef.get().getCurrentMenuState();
|
||||
}
|
||||
return 0;
|
||||
return lastMenuState;
|
||||
}
|
||||
|
||||
public int getSupportedMenuStates() {
|
||||
|
@ -348,6 +355,10 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
return MenuState.HEADER_ONLY | MenuState.HALF_SCREEN | MenuState.FULL_SCREEN;
|
||||
}
|
||||
|
||||
public void showHideMenu() {
|
||||
showHideMenu(lastMenuState);
|
||||
}
|
||||
|
||||
public void showHideMenu(int menuState) {
|
||||
intermediateRequestsLatLon.clear();
|
||||
if (isVisible()) {
|
||||
|
@ -593,7 +604,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
if (mapActivity != null) {
|
||||
if (card instanceof SimpleRouteCard) {
|
||||
hide();
|
||||
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(), 0, getCurrentMenuState(), MenuState.FULL_SCREEN);
|
||||
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(), 0, true, MenuState.FULL_SCREEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -618,7 +629,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
if (buttonIndex == PublicTransportCard.DETAILS_BUTTON_INDEX) {
|
||||
hide();
|
||||
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(),
|
||||
((PublicTransportCard) card).getRouteId(), getCurrentMenuState(), MenuState.FULL_SCREEN);
|
||||
((PublicTransportCard) card).getRouteId(), true, MenuState.FULL_SCREEN);
|
||||
} else if (buttonIndex == PublicTransportCard.SHOW_BUTTON_INDEX) {
|
||||
setupCards();
|
||||
openMenuHeaderOnly();
|
||||
|
@ -626,7 +637,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
} else if (card instanceof SimpleRouteCard) {
|
||||
hide();
|
||||
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(), 0,
|
||||
getCurrentMenuState(), MenuState.FULL_SCREEN);
|
||||
true, MenuState.FULL_SCREEN);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -1301,7 +1312,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
if (app.getRoutingHelper().isPublicTransportMode()) {
|
||||
if (isTransportRouteCalculated()) {
|
||||
ChooseRouteFragment.showFromRouteInfo(mapActivity.getSupportFragmentManager(),
|
||||
app.getTransportRoutingHelper().getCurrentRoute(), getCurrentMenuState(), MenuState.HEADER_ONLY);
|
||||
app.getTransportRoutingHelper().getCurrentRoute(), true, MenuState.HEADER_ONLY);
|
||||
}
|
||||
} else {
|
||||
mapActivity.getMapLayers().getMapControlsLayer().startNavigation();
|
||||
|
@ -1353,7 +1364,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null && mapActivity.getMyApplication().getTargetPointsHelper().checkPointToNavigateShort()) {
|
||||
hide();
|
||||
WaypointsFragment.showInstance(mapActivity.getSupportFragmentManager(), getCurrentMenuState());
|
||||
WaypointsFragment.showInstance(mapActivity.getSupportFragmentManager(), true);
|
||||
}
|
||||
}
|
||||
});
|
||||
|
@ -1618,9 +1629,18 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
}
|
||||
|
||||
public void selectOnScreen(PointType pointType) {
|
||||
selectOnScreen(pointType, getCurrentMenuState(), false);
|
||||
}
|
||||
|
||||
public void selectOnScreen(PointType pointType, boolean waypointsMenu) {
|
||||
selectOnScreen(pointType, getCurrentMenuState(), waypointsMenu);
|
||||
}
|
||||
|
||||
public void selectOnScreen(PointType pointType, int menuState, boolean waypointsMenu) {
|
||||
selectFromMapTouch = true;
|
||||
selectFromMapPointType = pointType;
|
||||
selectFromMapMenuState = getCurrentMenuState();
|
||||
selectFromMapMenuState = menuState;
|
||||
selectFromMapWaypoints = waypointsMenu;
|
||||
hide();
|
||||
}
|
||||
|
||||
|
@ -1901,10 +1921,11 @@ public class MapRouteInfoMenu implements IRouteInformationListener, CardListener
|
|||
public void routeWasFinished() {
|
||||
}
|
||||
|
||||
public void onDismiss() {
|
||||
public void onDismiss(int currentMenuState) {
|
||||
cancelButtonsAnimations();
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
lastMenuState = currentMenuState;
|
||||
mapActivity.getMapView().setMapPositionX(0);
|
||||
mapActivity.getMapView().refreshMap();
|
||||
AndroidUiHelper.updateVisibility(mapActivity.findViewById(R.id.map_route_land_left_margin), false);
|
||||
|
|
|
@ -177,7 +177,7 @@ public class MapRouteInfoMenuFragment extends ContextMenuFragment {
|
|||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
if (menu != null) {
|
||||
menu.onDismiss();
|
||||
menu.onDismiss(getCurrentMenuState());
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -49,6 +49,8 @@ import net.osmand.plus.views.controls.DynamicListView;
|
|||
import net.osmand.plus.views.controls.DynamicListViewCallbacks;
|
||||
import net.osmand.plus.views.controls.StableArrayAdapter;
|
||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener;
|
||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.DismissCallbacks;
|
||||
import net.osmand.plus.views.controls.SwipeDismissListViewTouchListener.Undoable;
|
||||
import net.osmand.plus.widgets.TextViewEx;
|
||||
import net.osmand.plus.widgets.TextViewExProgress;
|
||||
import net.osmand.util.Algorithms;
|
||||
|
@ -58,12 +60,12 @@ import java.util.ArrayList;
|
|||
import java.util.List;
|
||||
|
||||
import static net.osmand.plus.helpers.WaypointDialogHelper.showOnMap;
|
||||
import static net.osmand.plus.routepreparationmenu.ChooseRouteFragment.ROUTE_INFO_STATE_KEY;
|
||||
|
||||
public class WaypointsFragment extends BaseOsmAndFragment implements ObservableScrollViewCallbacks,
|
||||
DynamicListViewCallbacks, WaypointDialogHelper.WaypointDialogHelperCallback {
|
||||
DynamicListViewCallbacks, WaypointDialogHelper.WaypointDialogHelperCallback, AddPointBottomSheetDialog.DialogListener {
|
||||
|
||||
public static final String TAG = "WaypointsFragment";
|
||||
public static final String USE_ROUTE_INFO_MENU_KEY = "use_route_info_menu_key";
|
||||
|
||||
private View view;
|
||||
private View mainView;
|
||||
|
@ -83,11 +85,11 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
private boolean nightMode;
|
||||
private boolean wasDrawerDisabled;
|
||||
|
||||
private int routeInfoMenuState = -1;
|
||||
private boolean useRouteInfoMenu;
|
||||
|
||||
@Nullable
|
||||
@Override
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, Bundle savedInstanceState) {
|
||||
public View onCreateView(@NonNull LayoutInflater inflater, ViewGroup parent, final Bundle savedInstanceState) {
|
||||
MapActivity mapActivity = (MapActivity) requireActivity();
|
||||
portrait = AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||
nightMode = mapActivity.getMyApplication().getDaynightHelper().isNightModeForMapControls();
|
||||
|
@ -99,7 +101,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
AndroidUtils.addStatusBarPadding21v(mapActivity, view);
|
||||
Bundle args = getArguments();
|
||||
if (args != null) {
|
||||
routeInfoMenuState = args.getInt(ROUTE_INFO_STATE_KEY, -1);
|
||||
useRouteInfoMenu = args.getBoolean(USE_ROUTE_INFO_MENU_KEY, false);
|
||||
}
|
||||
mainView = view.findViewById(R.id.main_view);
|
||||
|
||||
|
@ -174,95 +176,44 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
swipeDismissListener = new SwipeDismissListViewTouchListener(
|
||||
mapActivity,
|
||||
listView,
|
||||
new SwipeDismissListViewTouchListener.DismissCallbacks() {
|
||||
new DismissCallbacks() {
|
||||
|
||||
@Override
|
||||
public boolean canDismiss(int position) {
|
||||
List<Object> activeObjects = ((StableArrayAdapter) listAdapter).getActiveObjects();
|
||||
Object obj = listAdapter.getItem(position);
|
||||
if (obj instanceof LocationPointWrapper) {
|
||||
LocationPointWrapper w = (LocationPointWrapper) obj;
|
||||
if (w.getPoint() instanceof TargetPoint) {
|
||||
return !((TargetPoint) w.getPoint()).start;
|
||||
StableArrayAdapter stableAdapter = listAdapter;
|
||||
if (stableAdapter != null) {
|
||||
List<Object> activeObjects = stableAdapter.getActiveObjects();
|
||||
Object obj = stableAdapter.getItem(position);
|
||||
if (obj instanceof LocationPointWrapper) {
|
||||
LocationPointWrapper w = (LocationPointWrapper) obj;
|
||||
if (w.getPoint() instanceof TargetPoint) {
|
||||
return !((TargetPoint) w.getPoint()).start;
|
||||
}
|
||||
}
|
||||
return activeObjects.contains(obj);
|
||||
}
|
||||
return activeObjects.contains(obj);
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public SwipeDismissListViewTouchListener.Undoable onDismiss(final int position) {
|
||||
final Object item;
|
||||
final StableArrayAdapter stableAdapter;
|
||||
final int activeObjPos;
|
||||
stableAdapter = (StableArrayAdapter) listAdapter;
|
||||
item = stableAdapter.getItem(position);
|
||||
|
||||
stableAdapter.setNotifyOnChange(false);
|
||||
stableAdapter.remove(item);
|
||||
stableAdapter.getObjects().remove(item);
|
||||
activeObjPos = stableAdapter.getActiveObjects().indexOf(item);
|
||||
stableAdapter.getActiveObjects().remove(item);
|
||||
stableAdapter.refreshData();
|
||||
stableAdapter.notifyDataSetChanged();
|
||||
|
||||
return new SwipeDismissListViewTouchListener.Undoable() {
|
||||
@Override
|
||||
public void undo() {
|
||||
if (item != null) {
|
||||
stableAdapter.setNotifyOnChange(false);
|
||||
stableAdapter.insert(item, position);
|
||||
stableAdapter.getObjects().add(position, item);
|
||||
stableAdapter.getActiveObjects().add(activeObjPos, item);
|
||||
stableAdapter.refreshData();
|
||||
applyPointsChanges();
|
||||
updateTitle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTitle() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
List<Object> activeObjects;
|
||||
if ((mapActivity.getRoutingHelper().isRoutePlanningMode() || mapActivity.getRoutingHelper().isFollowingMode())
|
||||
&& item != null
|
||||
&& ((activeObjects = stableAdapter.getActiveObjects()).isEmpty() || isContainsOnlyStart(activeObjects))) {
|
||||
return mapActivity.getResources().getString(R.string.cancel_navigation);
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
};
|
||||
public Undoable onDismiss(final int position) {
|
||||
StableArrayAdapter stableAdapter = listAdapter;
|
||||
if (stableAdapter != null) {
|
||||
Object item = stableAdapter.getItem(position);
|
||||
stableAdapter.setNotifyOnChange(false);
|
||||
stableAdapter.remove(item);
|
||||
stableAdapter.getObjects().remove(item);
|
||||
stableAdapter.getActiveObjects().remove(item);
|
||||
stableAdapter.refreshData();
|
||||
stableAdapter.notifyDataSetChanged();
|
||||
}
|
||||
cancelTimer();
|
||||
startTimer();
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onHidePopup() {
|
||||
MapActivity mapActivity = getMapActivity();
|
||||
if (mapActivity != null) {
|
||||
StableArrayAdapter stableAdapter = (StableArrayAdapter) listAdapter;
|
||||
stableAdapter.refreshData();
|
||||
applyPointsChanges();
|
||||
updateTitle();
|
||||
List<Object> activeObjects = stableAdapter.getActiveObjects();
|
||||
if (activeObjects.isEmpty() || isContainsOnlyStart(activeObjects)) {
|
||||
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
||||
mapActivity.getMyApplication().getTargetPointsHelper().removeAllWayPoints(false, true);
|
||||
mapActivity.getMapRouteInfoMenu().hide();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isContainsOnlyStart(List<Object> items) {
|
||||
if (items.size() == 1) {
|
||||
Object item = items.get(0);
|
||||
if (item instanceof LocationPointWrapper) {
|
||||
LocationPointWrapper w = (LocationPointWrapper) item;
|
||||
if (w.getPoint() instanceof TargetPoint) {
|
||||
return ((TargetPoint) w.getPoint()).start;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
});
|
||||
|
||||
|
@ -277,6 +228,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
AddPointBottomSheetDialog fragment = new AddPointBottomSheetDialog();
|
||||
fragment.setArguments(args);
|
||||
fragment.setUsedOnMap(true);
|
||||
fragment.setListener(WaypointsFragment.this);
|
||||
fragment.show(mapActivity.getSupportFragmentManager(), AddPointBottomSheetDialog.TAG);
|
||||
}
|
||||
}
|
||||
|
@ -364,10 +316,16 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
if (!wasDrawerDisabled) {
|
||||
mapActivity.enableDrawer();
|
||||
}
|
||||
updateControlsVisibility(true, routeInfoMenuState != -1);
|
||||
updateControlsVisibility(true, useRouteInfoMenu);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(@NonNull Bundle outState) {
|
||||
outState.putBoolean(USE_ROUTE_INFO_MENU_KEY, useRouteInfoMenu);
|
||||
super.onSaveInstanceState(outState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onScrollChanged(int scrollY, boolean firstScroll, boolean dragging) {
|
||||
|
||||
|
@ -385,8 +343,8 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
|
||||
@Override
|
||||
public void reloadAdapter() {
|
||||
if (listAdapter != null) {
|
||||
StableArrayAdapter stableAdapter = (StableArrayAdapter) listAdapter;
|
||||
StableArrayAdapter stableAdapter = listAdapter;
|
||||
if (stableAdapter != null) {
|
||||
reloadListAdapter(stableAdapter);
|
||||
setDynamicListItems(listView, stableAdapter);
|
||||
}
|
||||
|
@ -737,7 +695,7 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
cTimer.cancel();
|
||||
}
|
||||
|
||||
private static View updateWaypointItemView(final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
||||
private View updateWaypointItemView(final boolean edit, final List<LocationPointWrapper> deletedPoints,
|
||||
final MapActivity mapActivity, View v,
|
||||
final LocationPointWrapper point,
|
||||
final ArrayAdapter adapter, final boolean nightMode,
|
||||
|
@ -931,15 +889,15 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
}
|
||||
|
||||
public static boolean showInstance(FragmentManager fragmentManager) {
|
||||
return WaypointsFragment.showInstance(fragmentManager, -1);
|
||||
return WaypointsFragment.showInstance(fragmentManager, false);
|
||||
}
|
||||
|
||||
public static boolean showInstance(FragmentManager fragmentManager, int routeInfoState) {
|
||||
public static boolean showInstance(FragmentManager fragmentManager, boolean useRouteInfoMenu) {
|
||||
try {
|
||||
WaypointsFragment fragment = new WaypointsFragment();
|
||||
|
||||
Bundle args = new Bundle();
|
||||
args.putInt(ROUTE_INFO_STATE_KEY, routeInfoState);
|
||||
args.putBoolean(USE_ROUTE_INFO_MENU_KEY, useRouteInfoMenu);
|
||||
fragment.setArguments(args);
|
||||
|
||||
fragmentManager.beginTransaction()
|
||||
|
@ -958,12 +916,22 @@ public class WaypointsFragment extends BaseOsmAndFragment implements ObservableS
|
|||
MapActivity mapActivity = (MapActivity) getActivity();
|
||||
if (mapActivity != null) {
|
||||
mapActivity.getSupportFragmentManager().beginTransaction().remove(this).commitAllowingStateLoss();
|
||||
if (routeInfoMenuState != -1) {
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog(routeInfoMenuState);
|
||||
if (useRouteInfoMenu) {
|
||||
mapActivity.getMapLayers().getMapControlsLayer().showRouteInfoControlDialog();
|
||||
}
|
||||
}
|
||||
} catch (Exception e) {
|
||||
//
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSelectOnMap(AddPointBottomSheetDialog dialog) {
|
||||
MapActivity mapActivity = (MapActivity) getActivity();
|
||||
if (mapActivity != null) {
|
||||
mapActivity.getMapRouteInfoMenu().selectOnScreen(dialog.getPointType(), true);
|
||||
useRouteInfoMenu = false;
|
||||
dismiss();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -319,6 +319,10 @@ public class MapControlsLayer extends OsmandMapLayer {
|
|||
mapActivity.getMapActions().stopNavigationWithoutConfirm();
|
||||
}
|
||||
|
||||
public void showRouteInfoControlDialog() {
|
||||
mapRouteInfoMenu.showHideMenu();
|
||||
}
|
||||
|
||||
public void showRouteInfoControlDialog(int menuState) {
|
||||
mapRouteInfoMenu.showHideMenu(menuState);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue