[android] Add manage route functionality #10151
No reviewers
Labels
No labels
Accessibility
Accessibility
Address
Address
Android
Android
Android Auto
Android Auto
Android Automotive (AAOS)
Android Automotive (AAOS)
API
API
AppGallery
AppGallery
AppStore
AppStore
Battery and Performance
Battery and Performance
Blocker
Blocker
Bookmarks and Tracks
Bookmarks and Tracks
Borders
Borders
Bug
Bug
Build
Build
CarPlay
CarPlay
Classificator
Classificator
Community
Community
Core
Core
CrashReports
CrashReports
Cycling
Cycling
Desktop
Desktop
DevEx
DevEx
DevOps
DevOps
dev_sandbox
dev_sandbox
Directions
Directions
Documentation
Documentation
Downloader
Downloader
Drape
Drape
Driving
Driving
Duplicate
Duplicate
Editor
Editor
Elevation
Elevation
Enhancement
Enhancement
Epic
Epic
External Map Datasets
External Map Datasets
F-Droid
F-Droid
Fonts
Fonts
Frequently User Reported
Frequently User Reported
Fund
Fund
Generator
Generator
Good first issue
Good first issue
Google Play
Google Play
GPS
GPS
GSoC
GSoC
iCloud
iCloud
Icons
Icons
iOS
iOS
Legal
Legal
Linux Desktop
Linux Desktop
Linux packaging
Linux packaging
Linux Phone
Linux Phone
Mac OS
Mac OS
Map Data
Map Data
Metro
Metro
Navigation
Navigation
Need Feedback
Need Feedback
Night Mode
Night Mode
NLnet 2024-06-281
NLnet 2024-06-281
No Feature Parity
No Feature Parity
Opening Hours
Opening Hours
Outdoors
Outdoors
POI Info
POI Info
Privacy
Privacy
Public Transport
Public Transport
Raw Idea
Raw Idea
Refactoring
Refactoring
Regional
Regional
Regression
Regression
Releases
Releases
RoboTest
RoboTest
Route Planning
Route Planning
Routing
Routing
Ruler
Ruler
Search
Search
Security
Security
Styles
Styles
Tests
Tests
Track Recording
Track Recording
Translations
Translations
TTS
TTS
UI
UI
UX
UX
Walk Navigation
Walk Navigation
Watches
Watches
Web
Web
Wikipedia
Wikipedia
Windows
Windows
Won't fix
Won't fix
World Map
World Map
No milestone
No project
No assignees
4 participants
Due date
No due date set.
Dependencies
No dependencies set.
Reference: organicmaps/organicmaps-tmp#10151
Loading…
Add table
Reference in a new issue
No description provided.
Delete branch "manage_route"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
This PR adds the "manage route" functionality in Android that enables the re-arranging of routes.
The fell-and-look and functionality is similar to the implementation that is already working in iOS.
Some screenshots:
LGTM!
There are some minor things.
crosshair button
here its obvious a my location item is present as we just added it
so call
mManageRouteListener.showMyLocationIcon()
directlynit:
the type could be easily derived from the position
so storing it looks redundant?
but probably requires some refactoring of the existing code?
@ -0,0 +74,4 @@
case RoutePointInfo.ROUTE_MARK_INTERMEDIATE: // Intermediate stop.
TypedArray iconArray = mContext.getResources().obtainTypedArray(R.array.route_stop_icons);
iconId = iconArray.getResourceId(mRoutePoints.get(position).mIntermediateIndex,
what would happen if there are more than 20 points?
prob it should default to a generic stop icon?
@ -0,0 +184,4 @@
0, true, true, false, myLocation.getLat(),
myLocation.getLon()));
// Update data.
its better to avoid too obvious comments :)
It'd be better to fetch a fresh location here as it could've moved since the dialog was created.
Its fine to do in a separate PR.
also better to check for location availability right here;
ideally the icon would update if location availability changes, but we can live with a simpler flow for now
@ -0,0 +145,4 @@
Framework.addRoutePoint(newRoutePoints.get(pos));
// Intermediate route points are added sorted by distance.
// We have to make sure that they follow the requested order.
So the core optimizes the points order by default and here we re-arrange the points again to force the core to a wanted order.
This logic is strange :)
Wouldn't it be better to just disable the core optimization while adding points?
@ -0,0 +74,4 @@
case RoutePointInfo.ROUTE_MARK_INTERMEDIATE: // Intermediate stop.
TypedArray iconArray = mContext.getResources().obtainTypedArray(R.array.route_stop_icons);
iconId = iconArray.getResourceId(mRoutePoints.get(position).mIntermediateIndex,
Yes, we already have this default/generic stop icon
, with id
R.drawable.route_point_20
, which was also taken from map icons placed here:data/styles/default/light/symbols/route-point-xx.svg
But the code is wrong and it sets as default route point 1. I will change the code to set the default one:
I've removed the
mMyLocation
class variable and included the fetching of a fresh location:Done:
Yes, we can leave leave this for later...
@ -0,0 +145,4 @@
Framework.addRoutePoint(newRoutePoints.get(pos));
// Intermediate route points are added sorted by distance.
// We have to make sure that they follow the requested order.
Yes, the logic here is a little bit tricky.
The best would be indeed to have a core function for adding points that does not optimize distances. I dug into the core code and I did not found it direct to have this non-optimizing function, so I decided to implement that trick of later rearranging of the intermediate points.
I could have a second look at the core code to see if we can implements that non-optimizing add stop function.
Modified!
@ -0,0 +184,4 @@
0, true, true, false, myLocation.getLat(),
myLocation.getLon()));
// Update data.
Comments removed...
Modified!!
Route point type is later used by
Framework.addRoutePoint()
, so that's the reason to store it.@ -0,0 +145,4 @@
Framework.addRoutePoint(newRoutePoints.get(pos));
// Intermediate route points are added sorted by distance.
// We have to make sure that they follow the requested order.
And AFAIK the iOS version doesn't optimize the points at all? So there should be some option in the core already.
Modified!!
@ -0,0 +145,4 @@
Framework.addRoutePoint(newRoutePoints.get(pos));
// Intermediate route points are added sorted by distance.
// We have to make sure that they follow the requested order.
I will take a look at the iOS code, to see how it's handled there...
@ -0,0 +145,4 @@
Framework.addRoutePoint(newRoutePoints.get(pos));
// Intermediate route points are added sorted by distance.
// We have to make sure that they follow the requested order.
@pastk: I've reviewed the core code and found that the native function
RoutingManager::AddRoutePoint()
makes a call to the functionReorderIntermediatePoints()
.I've launched PR 10412 to make optional this auto-reordering of intermediate stops, so we can remove this ugly extra-code.