Fixes: Display Starting point always. Show sort and switch start/destination changes immediately. Added Starting point icon. Other small issues.
This commit is contained in:
parent
2e3c0e3f19
commit
f12ae8c1b0
8 changed files with 153 additions and 90 deletions
|
@ -229,6 +229,18 @@ public class TargetPointsHelper {
|
||||||
return intermediatePointsLatLon;
|
return intermediatePointsLatLon;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public List<TargetPoint> getAllPoints() {
|
||||||
|
List<TargetPoint> res = new ArrayList<TargetPoint>();
|
||||||
|
if(pointToStart != null) {
|
||||||
|
res.add(pointToStart);
|
||||||
|
}
|
||||||
|
res.addAll(this.intermediatePoints);
|
||||||
|
if(pointToNavigate != null) {
|
||||||
|
res.add(pointToNavigate);
|
||||||
|
}
|
||||||
|
return res;
|
||||||
|
}
|
||||||
|
|
||||||
public List<TargetPoint> getIntermediatePointsWithTarget() {
|
public List<TargetPoint> getIntermediatePointsWithTarget() {
|
||||||
List<TargetPoint> res = new ArrayList<TargetPoint>();
|
List<TargetPoint> res = new ArrayList<TargetPoint>();
|
||||||
res.addAll(this.intermediatePoints);
|
res.addAll(this.intermediatePoints);
|
||||||
|
|
|
@ -54,7 +54,7 @@ import net.osmand.plus.dialogs.ConfigureMapMenu;
|
||||||
import net.osmand.plus.download.DownloadActivity;
|
import net.osmand.plus.download.DownloadActivity;
|
||||||
import net.osmand.plus.helpers.AndroidUiHelper;
|
import net.osmand.plus.helpers.AndroidUiHelper;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper;
|
import net.osmand.plus.helpers.WaypointDialogHelper;
|
||||||
import net.osmand.plus.helpers.WaypointDialogHelper.PointDeleteCallback;
|
import net.osmand.plus.helpers.WaypointDialogHelper.WaypointDialogHelperCallbacks;
|
||||||
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
import net.osmand.plus.helpers.WaypointHelper.LocationPointWrapper;
|
||||||
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu;
|
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu;
|
||||||
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu.LocalRoutingParameter;
|
import net.osmand.plus.mapcontextmenu.other.RoutePreferencesMenu.LocalRoutingParameter;
|
||||||
|
@ -81,7 +81,7 @@ import static android.util.TypedValue.COMPLEX_UNIT_DIP;
|
||||||
/**
|
/**
|
||||||
*/
|
*/
|
||||||
public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicListViewCallbacks,
|
public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicListViewCallbacks,
|
||||||
IRouteInformationListener, PointDeleteCallback {
|
IRouteInformationListener, WaypointDialogHelperCallbacks {
|
||||||
private static final org.apache.commons.logging.Log LOG =
|
private static final org.apache.commons.logging.Log LOG =
|
||||||
PlatformUtil.getLog(DashboardOnMap.class);
|
PlatformUtil.getLog(DashboardOnMap.class);
|
||||||
private static final String TAG = "DashboardOnMap";
|
private static final String TAG = "DashboardOnMap";
|
||||||
|
@ -179,7 +179,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
public void createDashboardView() {
|
public void createDashboardView() {
|
||||||
baseColor = mapActivity.getResources().getColor(R.color.osmand_orange) & 0x00ffffff;
|
baseColor = mapActivity.getResources().getColor(R.color.osmand_orange) & 0x00ffffff;
|
||||||
waypointDialogHelper = new WaypointDialogHelper(mapActivity);
|
waypointDialogHelper = new WaypointDialogHelper(mapActivity);
|
||||||
waypointDialogHelper.setPointDeleteCallback(this);
|
waypointDialogHelper.setWaypointDialogHelperCallbacks(this);
|
||||||
landscape = !AndroidUiHelper.isOrientationPortrait(mapActivity);
|
landscape = !AndroidUiHelper.isOrientationPortrait(mapActivity);
|
||||||
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
|
dashboardView = (FrameLayout) mapActivity.findViewById(R.id.dashboard);
|
||||||
final View.OnClickListener listener = new View.OnClickListener() {
|
final View.OnClickListener listener = new View.OnClickListener() {
|
||||||
|
@ -1212,16 +1212,7 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
|
public void newRouteIsCalculated(boolean newRoute, ValueHolder<Boolean> showToast) {
|
||||||
if ((DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType)
|
reloadAdapter();
|
||||||
&& listAdapter != null && listAdapter instanceof StableArrayAdapter) {
|
|
||||||
StableArrayAdapter stableAdapter = (StableArrayAdapter) listAdapter;
|
|
||||||
waypointDialogHelper.reloadListAdapter(stableAdapter);
|
|
||||||
if (listView instanceof DynamicListView) {
|
|
||||||
DynamicListView dynamicListView = (DynamicListView) listView;
|
|
||||||
dynamicListView.setItemsList(stableAdapter.getObjects());
|
|
||||||
dynamicListView.setActiveItemsList(stableAdapter.getActiveObjects());
|
|
||||||
}
|
|
||||||
}
|
|
||||||
showToast.value = false;
|
showToast.value = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1236,6 +1227,20 @@ public class DashboardOnMap implements ObservableScrollViewCallbacks, DynamicLis
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void reloadAdapter() {
|
||||||
|
if ((DashboardType.WAYPOINTS == visibleType || DashboardType.WAYPOINTS_FLAT == visibleType)
|
||||||
|
&& listAdapter != null && listAdapter instanceof StableArrayAdapter) {
|
||||||
|
StableArrayAdapter stableAdapter = (StableArrayAdapter) listAdapter;
|
||||||
|
waypointDialogHelper.reloadListAdapter(stableAdapter);
|
||||||
|
if (listView instanceof DynamicListView) {
|
||||||
|
DynamicListView dynamicListView = (DynamicListView) listView;
|
||||||
|
dynamicListView.setItemsList(stableAdapter.getObjects());
|
||||||
|
dynamicListView.setActiveItemsList(stableAdapter.getActiveObjects());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void deleteWaypoint(int position) {
|
public void deleteWaypoint(int position) {
|
||||||
if (swipeDismissListener != null) {
|
if (swipeDismissListener != null) {
|
||||||
|
|
|
@ -55,12 +55,13 @@ public class WaypointDialogHelper {
|
||||||
private MapActivity mapActivity;
|
private MapActivity mapActivity;
|
||||||
private OsmandApplication app;
|
private OsmandApplication app;
|
||||||
private WaypointHelper waypointHelper;
|
private WaypointHelper waypointHelper;
|
||||||
private PointDeleteCallback dCallback;
|
private WaypointDialogHelperCallbacks helperCallbacks;
|
||||||
|
|
||||||
private boolean flat;
|
private boolean flat;
|
||||||
private List<LocationPointWrapper> deletedPoints;
|
private List<LocationPointWrapper> deletedPoints;
|
||||||
|
|
||||||
public interface PointDeleteCallback {
|
public interface WaypointDialogHelperCallbacks {
|
||||||
|
void reloadAdapter();
|
||||||
void deleteWaypoint(int position);
|
void deleteWaypoint(int position);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -72,8 +73,8 @@ public class WaypointDialogHelper {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setPointDeleteCallback(PointDeleteCallback callback) {
|
public void setWaypointDialogHelperCallbacks(WaypointDialogHelperCallbacks callbacks) {
|
||||||
this.dCallback = callback;
|
this.helperCallbacks = callbacks;
|
||||||
}
|
}
|
||||||
|
|
||||||
public WaypointDialogHelper(MapActivity mapActivity) {
|
public WaypointDialogHelper(MapActivity mapActivity) {
|
||||||
|
@ -354,7 +355,11 @@ public class WaypointDialogHelper {
|
||||||
= new GeocodingLookupService.AddressLookupRequest(t.point, new GeocodingLookupService.OnAddressLookupResult() {
|
= new GeocodingLookupService.AddressLookupRequest(t.point, new GeocodingLookupService.OnAddressLookupResult() {
|
||||||
@Override
|
@Override
|
||||||
public void geocodingDone(String address) {
|
public void geocodingDone(String address) {
|
||||||
reloadListAdapter(listAdapter);
|
if (helperCallbacks != null) {
|
||||||
|
helperCallbacks.reloadAdapter();
|
||||||
|
} else {
|
||||||
|
reloadListAdapter(listAdapter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}, null);
|
}, null);
|
||||||
app.getGeocodingLookupService().lookupAddress(lookupRequest);
|
app.getGeocodingLookupService().lookupAddress(lookupRequest);
|
||||||
|
@ -395,46 +400,58 @@ public class WaypointDialogHelper {
|
||||||
more.setOnClickListener(new View.OnClickListener() {
|
more.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View view) {
|
public void onClick(View view) {
|
||||||
|
boolean hasActivePoints = false;
|
||||||
|
if (adapter instanceof StableArrayAdapter) {
|
||||||
|
hasActivePoints = ((StableArrayAdapter) adapter).getActiveObjects().size() > 0;
|
||||||
|
}
|
||||||
|
|
||||||
final PopupMenu optionsMenu = new PopupMenu(ctx, more);
|
final PopupMenu optionsMenu = new PopupMenu(ctx, more);
|
||||||
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
DirectionsDialogs.setupPopUpMenuIcon(optionsMenu);
|
||||||
MenuItem item;
|
MenuItem item;
|
||||||
item = optionsMenu.getMenu().add(
|
if (hasActivePoints) {
|
||||||
R.string.intermediate_items_sort_by_distance).setIcon(app.getIconsCache().
|
item = optionsMenu.getMenu().add(
|
||||||
getContentIcon(R.drawable.ic_sort_waypoint_dark));
|
R.string.intermediate_items_sort_by_distance).setIcon(app.getIconsCache().
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
getContentIcon(R.drawable.ic_sort_waypoint_dark));
|
||||||
@Override
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
@Override
|
||||||
// sort door-to-door
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
sortAllTargets(app, ctx);
|
// sort door-to-door
|
||||||
return true;
|
sortAllTargets(app, ctx, helper);
|
||||||
}
|
return true;
|
||||||
});
|
|
||||||
item = optionsMenu.getMenu().add(
|
|
||||||
R.string.switch_start_finish).setIcon(app.getIconsCache().
|
|
||||||
getContentIcon(R.drawable.ic_action_undo_dark));
|
|
||||||
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
|
||||||
@Override
|
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
|
||||||
// switch start & finish
|
|
||||||
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
|
||||||
TargetPoint start = targetPointsHelper.getPointToStart();
|
|
||||||
TargetPoint finish = targetPointsHelper.getPointToNavigate();
|
|
||||||
targetPointsHelper.setStartPoint(new LatLon(finish.getLatitude(),
|
|
||||||
finish.getLongitude()), false, finish.getPointDescription(ctx));
|
|
||||||
if (start == null) {
|
|
||||||
Location loc = app.getLocationProvider().getLastKnownLocation();
|
|
||||||
if (loc != null) {
|
|
||||||
targetPointsHelper.navigateToPoint(new LatLon(loc.getLatitude(),
|
|
||||||
loc.getLongitude()), true, -1);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
targetPointsHelper.navigateToPoint(new LatLon(start.getLatitude(),
|
|
||||||
start.getLongitude()), true, -1, start.getPointDescription(ctx));
|
|
||||||
}
|
}
|
||||||
return true;
|
});
|
||||||
}
|
item = optionsMenu.getMenu().add(
|
||||||
});
|
R.string.switch_start_finish).setIcon(app.getIconsCache().
|
||||||
optionsMenu.show();
|
getContentIcon(R.drawable.ic_action_undo_dark));
|
||||||
|
item.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
|
||||||
|
@Override
|
||||||
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
|
// switch start & finish
|
||||||
|
TargetPointsHelper targetPointsHelper = app.getTargetPointsHelper();
|
||||||
|
TargetPoint start = targetPointsHelper.getPointToStart();
|
||||||
|
TargetPoint finish = targetPointsHelper.getPointToNavigate();
|
||||||
|
targetPointsHelper.setStartPoint(new LatLon(finish.getLatitude(),
|
||||||
|
finish.getLongitude()), false, finish.getPointDescription(ctx));
|
||||||
|
if (start == null) {
|
||||||
|
Location loc = app.getLocationProvider().getLastKnownLocation();
|
||||||
|
if (loc != null) {
|
||||||
|
targetPointsHelper.navigateToPoint(new LatLon(loc.getLatitude(),
|
||||||
|
loc.getLongitude()), true, -1);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
targetPointsHelper.navigateToPoint(new LatLon(start.getLatitude(),
|
||||||
|
start.getLongitude()), true, -1, start.getPointDescription(ctx));
|
||||||
|
}
|
||||||
|
if (helper.helperCallbacks != null) {
|
||||||
|
helper.helperCallbacks.reloadAdapter();
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
if (optionsMenu.getMenu().size() > 0) {
|
||||||
|
optionsMenu.show();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
@ -489,8 +506,8 @@ public class WaypointDialogHelper {
|
||||||
LocationPointWrapper point = (LocationPointWrapper) item;
|
LocationPointWrapper point = (LocationPointWrapper) item;
|
||||||
if (point.type == WaypointHelper.TARGETS && adapter instanceof StableArrayAdapter) {
|
if (point.type == WaypointHelper.TARGETS && adapter instanceof StableArrayAdapter) {
|
||||||
StableArrayAdapter stableAdapter = (StableArrayAdapter) adapter;
|
StableArrayAdapter stableAdapter = (StableArrayAdapter) adapter;
|
||||||
if (helper != null && helper.dCallback != null && needCallback) {
|
if (helper != null && helper.helperCallbacks != null && needCallback) {
|
||||||
helper.dCallback.deleteWaypoint(stableAdapter.getPosition(item));
|
helper.helperCallbacks.deleteWaypoint(stableAdapter.getPosition(item));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ArrayList<LocationPointWrapper> arr = new ArrayList<>();
|
ArrayList<LocationPointWrapper> arr = new ArrayList<>();
|
||||||
|
@ -633,7 +650,11 @@ public class WaypointDialogHelper {
|
||||||
|
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
running[0] = -1;
|
running[0] = -1;
|
||||||
reloadListAdapter(listAdapter);
|
if (helperCallbacks != null) {
|
||||||
|
helperCallbacks.reloadAdapter();
|
||||||
|
} else {
|
||||||
|
reloadListAdapter(listAdapter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.execute((Void) null);
|
}.execute((Void) null);
|
||||||
}
|
}
|
||||||
|
@ -696,7 +717,11 @@ public class WaypointDialogHelper {
|
||||||
|
|
||||||
protected void onPostExecute(Void result) {
|
protected void onPostExecute(Void result) {
|
||||||
running[0] = -1;
|
running[0] = -1;
|
||||||
reloadListAdapter(listAdapter);
|
if (helperCallbacks != null) {
|
||||||
|
helperCallbacks.reloadAdapter();
|
||||||
|
} else {
|
||||||
|
reloadListAdapter(listAdapter);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}.execute((Void) null);
|
}.execute((Void) null);
|
||||||
}
|
}
|
||||||
|
@ -750,7 +775,7 @@ public class WaypointDialogHelper {
|
||||||
points.add(true);
|
points.add(true);
|
||||||
}
|
}
|
||||||
points.add(i);
|
points.add(i);
|
||||||
if (i == WaypointHelper.TARGETS && rc) {
|
if (i == WaypointHelper.TARGETS) {
|
||||||
TargetPoint start = app.getTargetPointsHelper().getPointToStart();
|
TargetPoint start = app.getTargetPointsHelper().getPointToStart();
|
||||||
if (start == null) {
|
if (start == null) {
|
||||||
LatLon latLon;
|
LatLon latLon;
|
||||||
|
@ -837,7 +862,8 @@ public class WaypointDialogHelper {
|
||||||
*/
|
*/
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void sortAllTargets(final OsmandApplication app, final Activity activity) {
|
public static void sortAllTargets(final OsmandApplication app, final Activity activity,
|
||||||
|
final WaypointDialogHelper helper) {
|
||||||
|
|
||||||
new AsyncTask<Void, Void, int[]>() {
|
new AsyncTask<Void, Void, int[]>() {
|
||||||
|
|
||||||
|
@ -917,6 +943,9 @@ public class WaypointDialogHelper {
|
||||||
if (!eq) {
|
if (!eq) {
|
||||||
targets.reorderAllTargetPoints(intermediates, true);
|
targets.reorderAllTargetPoints(intermediates, true);
|
||||||
}
|
}
|
||||||
|
if (helper.helperCallbacks != null) {
|
||||||
|
helper.helperCallbacks.reloadAdapter();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}.execute();
|
}.execute();
|
||||||
|
|
|
@ -686,7 +686,7 @@ public class WaypointHelper {
|
||||||
ApplicationMode appMode = app.getSettings().getApplicationMode();
|
ApplicationMode appMode = app.getSettings().getApplicationMode();
|
||||||
return uiCtx.getResources().getDrawable(appMode.getResourceLocationDay());
|
return uiCtx.getResources().getDrawable(appMode.getResourceLocationDay());
|
||||||
} else {
|
} else {
|
||||||
return iconsCache.getContentIcon(R.drawable.ic_action_marker_dark, !nightMode);
|
return iconsCache.getIcon(R.drawable.list_startpoint, 0, 0f);
|
||||||
}
|
}
|
||||||
} else if (((TargetPoint) point).intermediate) {
|
} else if (((TargetPoint) point).intermediate) {
|
||||||
if (!nightMode) {
|
if (!nightMode) {
|
||||||
|
|
|
@ -418,7 +418,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
hide();
|
hide();
|
||||||
final TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
final TargetPointsHelper targets = mapActivity.getMyApplication().getTargetPointsHelper();
|
||||||
if (targets.getIntermediatePoints().isEmpty()) {
|
if (targets.getIntermediatePoints().isEmpty()) {
|
||||||
targets.navigateToPoint(latLon, true, -1, pointDescription);
|
targets.navigateToPoint(latLon, true, -1, getPointDescriptionForTarget());
|
||||||
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
||||||
} else {
|
} else {
|
||||||
Builder bld = new AlertDialog.Builder(mapActivity);
|
Builder bld = new AlertDialog.Builder(mapActivity);
|
||||||
|
@ -439,10 +439,10 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
if (defaultVls[0] == 0) {
|
if (defaultVls[0] == 0) {
|
||||||
targets.removeAllWayPoints(false);
|
targets.removeAllWayPoints(false);
|
||||||
targets.navigateToPoint(latLon, true, -1, pointDescription);
|
targets.navigateToPoint(latLon, true, -1, getPointDescriptionForTarget());
|
||||||
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
||||||
} else {
|
} else {
|
||||||
targets.navigateToPoint(latLon, true, -1, pointDescription);
|
targets.navigateToPoint(latLon, true, -1, getPointDescriptionForTarget());
|
||||||
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
mapActivity.getMapActions().enterRoutePlanningModeGivenGpx(null, null, null, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -457,7 +457,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
mapActivity.getMapActions().editWaypoints();
|
mapActivity.getMapActions().editWaypoints();
|
||||||
} else {
|
} else {
|
||||||
mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(),
|
mapActivity.getMapActions().addAsTarget(latLon.getLatitude(), latLon.getLongitude(),
|
||||||
pointDescription);
|
getPointDescriptionForTarget());
|
||||||
}
|
}
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
@ -518,7 +518,7 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
public void addAsLastIntermediate() {
|
public void addAsLastIntermediate() {
|
||||||
mapActivity.getMyApplication().getTargetPointsHelper().navigateToPoint(latLon,
|
mapActivity.getMyApplication().getTargetPointsHelper().navigateToPoint(latLon,
|
||||||
true, mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size(),
|
true, mapActivity.getMyApplication().getTargetPointsHelper().getIntermediatePoints().size(),
|
||||||
pointDescription);
|
getPointDescriptionForTarget());
|
||||||
close();
|
close();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -562,6 +562,15 @@ public class MapContextMenu extends MenuTitleController implements StateChangedL
|
||||||
return GpxUiHelper.selectSingleGPXFile(mapActivity, true, callbackWithObject);
|
return GpxUiHelper.selectSingleGPXFile(mapActivity, true, callbackWithObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private PointDescription getPointDescriptionForTarget() {
|
||||||
|
if (pointDescription.isLocation()
|
||||||
|
&& pointDescription.getName().equals(PointDescription.getAddressNotFoundStr(mapActivity))) {
|
||||||
|
return new PointDescription(PointDescription.POINT_TYPE_LOCATION, "");
|
||||||
|
} else {
|
||||||
|
return pointDescription;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public void setBaseFragmentVisibility(boolean visible) {
|
public void setBaseFragmentVisibility(boolean visible) {
|
||||||
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
WeakReference<MapContextMenuFragment> fragmentRef = findMenuFragment();
|
||||||
if (fragmentRef != null) {
|
if (fragmentRef != null) {
|
||||||
|
|
|
@ -24,27 +24,29 @@ public class TargetPointMenuController extends MenuController {
|
||||||
final int intermediatePointsCount = targetPointsHelper.getIntermediatePoints().size();
|
final int intermediatePointsCount = targetPointsHelper.getIntermediatePoints().size();
|
||||||
RoutingHelper routingHelper = getMapActivity().getMyApplication().getRoutingHelper();
|
RoutingHelper routingHelper = getMapActivity().getMyApplication().getRoutingHelper();
|
||||||
final boolean nav = routingHelper.isRoutePlanningMode() || routingHelper.isFollowingMode();
|
final boolean nav = routingHelper.isRoutePlanningMode() || routingHelper.isFollowingMode();
|
||||||
leftTitleButtonController = new TitleButtonController() {
|
if (!targetPoint.start) {
|
||||||
@Override
|
leftTitleButtonController = new TitleButtonController() {
|
||||||
public void buttonPressed() {
|
@Override
|
||||||
TargetPoint tp = getTargetPoint();
|
public void buttonPressed() {
|
||||||
if(tp.intermediate) {
|
TargetPoint tp = getTargetPoint();
|
||||||
targetPointsHelper.removeWayPoint(true, tp.index);
|
if (tp.intermediate) {
|
||||||
} else {
|
targetPointsHelper.removeWayPoint(true, tp.index);
|
||||||
targetPointsHelper.removeWayPoint(true, -1);
|
} else {
|
||||||
}
|
targetPointsHelper.removeWayPoint(true, -1);
|
||||||
getMapActivity().getContextMenu().close();
|
}
|
||||||
if (nav && intermediatePointsCount == 0) {
|
getMapActivity().getContextMenu().close();
|
||||||
getMapActivity().getMapActions().stopNavigationWithoutConfirm();
|
if (nav && intermediatePointsCount == 0) {
|
||||||
|
getMapActivity().getMapActions().stopNavigationWithoutConfirm();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
};
|
||||||
|
if (nav && intermediatePointsCount == 0) {
|
||||||
|
leftTitleButtonController.caption = getMapActivity().getString(R.string.cancel_navigation);
|
||||||
|
leftTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark;
|
||||||
|
} else {
|
||||||
|
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_remove);
|
||||||
|
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
||||||
}
|
}
|
||||||
};
|
|
||||||
if (nav && intermediatePointsCount == 0) {
|
|
||||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.cancel_navigation);
|
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_remove_dark;
|
|
||||||
} else {
|
|
||||||
leftTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_remove);
|
|
||||||
leftTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -76,7 +78,9 @@ public class TargetPointMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Drawable getLeftIcon() {
|
public Drawable getLeftIcon() {
|
||||||
if (!targetPoint.intermediate) {
|
if (targetPoint.start) {
|
||||||
|
return getIconOrig(R.drawable.list_startpoint);
|
||||||
|
} else if (!targetPoint.intermediate) {
|
||||||
if (isLight()) {
|
if (isLight()) {
|
||||||
return getIconOrig(R.drawable.widget_target_day);
|
return getIconOrig(R.drawable.widget_target_day);
|
||||||
} else {
|
} else {
|
||||||
|
@ -93,7 +97,11 @@ public class TargetPointMenuController extends MenuController {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getTypeStr() {
|
public String getTypeStr() {
|
||||||
return targetPoint.getPointDescription(getMapActivity()).getTypeName();
|
if (targetPoint.start) {
|
||||||
|
return getMapActivity().getString(R.string.starting_point);
|
||||||
|
} else {
|
||||||
|
return targetPoint.getPointDescription(getMapActivity()).getTypeName();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -340,7 +340,7 @@ public class MapRouteInfoMenu implements IRouteInformationListener {
|
||||||
ApplicationMode appMode = mapActivity.getMyApplication().getSettings().getApplicationMode();
|
ApplicationMode appMode = mapActivity.getMyApplication().getSettings().getApplicationMode();
|
||||||
fromIcon.setImageDrawable(mapActivity.getResources().getDrawable(appMode.getResourceLocationDay()));
|
fromIcon.setImageDrawable(mapActivity.getResources().getDrawable(appMode.getResourceLocationDay()));
|
||||||
} else {
|
} else {
|
||||||
fromIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_marker_dark, isLight()));
|
fromIcon.setImageDrawable(mapActivity.getMyApplication().getIconsCache().getIcon(R.drawable.list_startpoint, 0, 0f));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -60,7 +60,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
||||||
textPaint.setTextSize(sp * 18);
|
textPaint.setTextSize(sp * 18);
|
||||||
textPaint.setTextAlign(Align.CENTER);
|
textPaint.setTextAlign(Align.CENTER);
|
||||||
textPaint.setAntiAlias(true);
|
textPaint.setAntiAlias(true);
|
||||||
startPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_intermediate_point);
|
startPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_start_point);
|
||||||
targetPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_target_point);
|
targetPoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_target_point);
|
||||||
intermediatePoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_intermediate_point);
|
intermediatePoint = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_intermediate_point);
|
||||||
arrowToDestination = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_arrow_to_destination);
|
arrowToDestination = BitmapFactory.decodeResource(view.getResources(), R.drawable.map_arrow_to_destination);
|
||||||
|
@ -175,7 +175,7 @@ public class PointNavigationLayer extends OsmandMapLayer implements IContextMenu
|
||||||
@Override
|
@Override
|
||||||
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
public void collectObjectsFromPoint(PointF point, RotatedTileBox tileBox, List<Object> o) {
|
||||||
TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper();
|
TargetPointsHelper tg = map.getMyApplication().getTargetPointsHelper();
|
||||||
List<TargetPoint> intermediatePoints = tg.getIntermediatePointsWithTarget();
|
List<TargetPoint> intermediatePoints = tg.getAllPoints();
|
||||||
int r = getRadiusPoi(tileBox);
|
int r = getRadiusPoi(tileBox);
|
||||||
for (int i = 0; i < intermediatePoints.size(); i++) {
|
for (int i = 0; i < intermediatePoints.size(); i++) {
|
||||||
TargetPoint tp = intermediatePoints.get(i);
|
TargetPoint tp = intermediatePoints.get(i);
|
||||||
|
|
Loading…
Reference in a new issue