Skip to content

Vehicles locations#81

Merged
mmathieum merged 71 commits into
masterfrom
mm/vehicle
Jan 27, 2026
Merged

Vehicles locations#81
mmathieum merged 71 commits into
masterfrom
mm/vehicle

Conversation

@mmathieum

@mmathieum mmathieum commented Dec 2, 2025

Copy link
Copy Markdown
Member

Tasks:

  • vehicule locations in 2 screens:
    • Route direction screen
    • POI screen
  • vehicle map marker
    • vehicle type icon 🚌 🚆 🛥️ 🚇
    • countdown in marker info

Tasks all modules with GTFS-RT:

  • add gtfs_real_time_agency_vehicle_positions_url to gtfs_real_time_values.xml
    • add gtfs_real_time_agency_vehicle_positions_url_cached when necessary + update encrypted files #Chrono

Tasks commons:

  • shared-modules/app-android/src/main/MTAndroidManifest.xml.MT.sh > add meta-data if gtfs_real_time_agency_vehicle_positions_url is present?:
             <meta-data
                 android:name="@string/vehicle_location_provider"
                 android:value="@string/vehicle_location_provider" />
             <meta-data
                 android:name="@string/vehicle_location_provider_target"
                 android:value="@string/gtfs_real_time_for_poi_authority" />

@mmathieum mmathieum self-assigned this Dec 2, 2025
@mmathieum mmathieum linked an issue Dec 2, 2025 that may be closed by this pull request
4 tasks
@mmathieum

Copy link
Copy Markdown
Member Author

/gemini review

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread app-android/src/main/java/org/mtransit/android/datasource/DataSourcesReader.kt Outdated
@mmathieum mmathieum marked this pull request as ready for review January 19, 2026 21:21
@mmathieum

Copy link
Copy Markdown
Member Author

/gemini review

@mmathieum mmathieum requested a review from Copilot January 23, 2026 19:41

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread app-android/src/main/java/org/mtransit/android/util/UITimeUtils.java Outdated

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@mmathieum mmathieum merged commit 02d57db into master Jan 27, 2026
4 of 5 checks passed
@mmathieum mmathieum deleted the mm/vehicle branch January 27, 2026 13:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Real-time🛰️ vehicle locations/positions 🚌

2 participants