Vehicles locations#81
Conversation
|
/gemini review |
There was a problem hiding this comment.
Code Review
This pull request introduces a significant new feature: displaying real-time vehicle locations on the map. The changes are extensive, touching the database schema, data loading logic, and multiple UI screens to support this functionality. A notable part of this PR is also a good refactoring of map camera change listeners to use modern, non-deprecated APIs.
Overall, the implementation is solid and well-integrated into the existing architecture. I've identified a critical issue regarding preference loading that could lead to race conditions, a high-severity bug due to a copy-paste error, and a minor code duplication. Addressing these points will improve the robustness and maintainability of the new feature.
|
/gemini review |
There was a problem hiding this comment.
Pull request overview
This pull request implements vehicle location tracking features, allowing the display of real-time vehicle positions on maps in both Route Direction and POI screens. The implementation includes vehicle map markers with countdown timers, automatic refresh mechanisms, and integration with GTFS-RT vehicle position data providers.
Changes:
- Added vehicle location data provider infrastructure and repository layers
- Implemented vehicle location map markers with dynamic countdown timers
- Integrated vehicle location refresh logic in RDS route direction and POI screens
Reviewed changes
Copilot reviewed 67 out of 147 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| app-android/src/main/java/org/mtransit/android/ui/view/map/VehicleLocationExt.kt | Vehicle location extension functions for map markers and position updates |
| app-android/src/main/java/org/mtransit/android/ui/view/MapViewController.java | Updated map controller to support vehicle location markers |
| app-android/src/main/java/org/mtransit/android/datasource/DataSourcesDatabase.kt | Added database migration for vehicle location provider properties |
| app-android/src/main/java/org/mtransit/android/data/VehicleLocationProviderProperties.kt | New data class for vehicle location provider properties |
| app-android/src/main/java/org/mtransit/android/ui/rds/route/direction/RDSDirectionStopsViewModel.kt | Added vehicle location refresh logic and data loading |
| app-android/src/main/java/org/mtransit/android/ui/fragment/POIViewModel.kt | Integrated vehicle location support in POI screen |
| app-android/src/main/res/values/strings_schedule.xml | Added short time format strings for countdown display |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
There was a problem hiding this comment.
Code Review
This pull request introduces significant changes related to vehicle location tracking and map functionality, along with general code improvements and bug fixes. The core new feature is the integration of vehicle location providers, including a new Room entity (VehicleLocationProviderProperties), DAO, and database migration (version 5 to 6). This functionality is guarded by a new feature flag F_CONSUME_VEHICLE_LOCATION. The DataSourceManager, DataSourceRequestManager, DataSourcesCache, DataSourcesInMemoryCache, and DataSourcesReader have all been updated to support fetching, caching, and managing these new vehicle location providers. Map-related fragments (POIFragment, RDSDirectionStopsFragment, MapFragment, AgencyPOIsFragment) and their ViewModels (POIViewModel, RDSRouteViewModel, RDSDirectionStopsViewModel, AgencyTypeViewModel, AgencyPOIsViewModel) have been extensively refactored to display vehicle locations on the map, handle map camera positions, and manage refresh intervals using RemoteConfigProvider. The MapViewController and its related classes (ExtendedGoogleMap, IMarker, MarkerAnimator, MarkerManager, ClusteringStrategy) have been updated to support vehicle location markers, including custom icons, rotation, and dynamic updates. Deprecated onCameraChange methods have been replaced with onCameraIdle and onCameraChanged for better map event handling. Additionally, the DefaultPreferenceRepository and LocalPreferenceRepository now use properly managed ExecutorService instances, and MTFragmentX has a DeprecatedCall suppression at the class level. Minor refactorings include removing unused imports, simplifying null checks, and improving UI logic for two-pane layouts.
Tasks:
Tasks all modules with GTFS-RT:
gtfs_real_time_agency_vehicle_positions_urltogtfs_real_time_values.xmlgtfs_real_time_agency_vehicle_positions_url_cachedwhen necessary + update encrypted files #ChronoTasks
commons:shared-modules/app-android/src/main/MTAndroidManifest.xml.MT.sh> addmeta-dataifgtfs_real_time_agency_vehicle_positions_urlis present?: