-
Notifications
You must be signed in to change notification settings - Fork 347
Add information about the number of cars on Link Light Rail trains #1346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds a badge next to Link Light Rail arrival times that displays the number of cars on the arriving train.
- Introduces a new TextView (carCount) in the arrivals list adapter to display the car count.
- Implements a new method getNumCars() in ObaArrivalInfo to derive and format the number of cars from the vehicle ID.
Reviewed Changes
Copilot reviewed 2 out of 3 changed files in this pull request and generated no comments.
| File | Description |
|---|---|
| onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListAdapterStyleA.java | Adds UI elements and logic for displaying the car count badge. |
| onebusaway-android/src/main/java/org/onebusaway/android/io/elements/ObaArrivalInfo.java | Implements logic to extract the number of cars from the vehicle ID. |
Files not reviewed (1)
- onebusaway-android/src/main/res/layout/arrivals_list_item.xml: Language not supported
Comments suppressed due to low confidence (1)
onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListAdapterStyleA.java:145
- Verify that carCount's background is always an instance of GradientDrawable to prevent a potential ClassCastException. Consider checking with 'instanceof' before casting or ensuring the drawable resource always returns a GradientDrawable.
((GradientDrawable) carCount.getBackground()).setColor(color);
amrhossamdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done, @millanp... I was testing it with a large font. Can you figure out how to make that responsive 🤔
|
Thanks for getting back so quickly! I just made the "4 car" badge much smaller, and this seems to get rid of the problem with large font size (?) I thought a bit about making it responsive, but I'm not sure if it's worth the effort, given that most of the existing UI elements are not responsive and given that statically shrinking it seems to solve the problem. Let me know your thoughts. |
|
This is cool! Note that this probably won't work outside of Seattle (and maybe just Link Light Rail) because the vehicle ID format isn't standardized. |
|
Interesting, I didn't know that this wasn't standardized! This vehicle ID format has been stable for quite some time for the link light rail, and I haven't seen it in any other transit systems or routes. Do you think this is a blocker for displaying this info on the app? |
That's up to @amrhossamdev 🙂 |
|
My case for including this is that it works right now across all transit systems and routes: it either displays an accurate car count, or it doesn't display anything. The format of vehicle IDs has been stable for a long time, certainly for over a year. If something breaks it is easy to turn this feature off, and the worst that can happen is briefly displaying an inaccurate car count. Thanks again for looking at this! |
|
Do you guarantee that it won’t show up if we don’t have a stable vehicle ID, or will it cause a problem? 🤔 @millanp if the vehicle id == null or there is no car number, it will be gone right? |
|
For responsive, I think it's looking great now well done @millanp 👏 |
amrhossamdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done @millanp 👏 please check my comments.
onebusaway-android/src/main/java/org/onebusaway/android/io/elements/ObaArrivalInfo.java
Outdated
Show resolved
Hide resolved
onebusaway-android/src/main/java/org/onebusaway/android/io/elements/ObaArrivalInfo.java
Outdated
Show resolved
Hide resolved
onebusaway-android/src/main/java/org/onebusaway/android/ui/ArrivalsListAdapterStyleA.java
Outdated
Show resolved
Hide resolved
|
Thanks for your participation, @barbeau! Could you elaborate more on the different formats of vehicle IDs? Are you suggesting that we need to find a way to parse each format differently based on the region? 🤔 Thanks! |
AFAIK there is typically no defined format, assuming these come from GTFS Realtime data sources. IDs could be |
|
Another option is I could explicitly turn this off for everything but the link light rail |
|
@millanp Looks good to me! Would love to hear your thoughts as well, @aaronbrethorst. |
|
Forgot to say this earlier, but one thing I find cool is that no other app gives this information! This would be useful data available only on OneBusAway. |
|
I agree with @amrhossamdev's feedback, and I like your approach, @millanp, regarding "Another option is I could explicitly turn this off for everything but the link light rail". I'd like to see the following changes before merging:
thanks! |
|
Rather than relying on parsing an ID whose format is not included in any specification and may change at any time, I might recommend using the experimental GTFS-RT VehiclePosition's Sound Transit publishes its light rail GTFS RT VehiclePosition feed via the Puget Sound region's OneBusAway server, which does not support the A way forward for this feature is to add support to the server's OBA APIs to include the |
|
@johnhelmuth-st If the OBA REST API server added support for ingesting and publishing this data, would ST update their deployed OBA server version to include that? |
|
I am checking with the vendor that supports the OBA service for us. |
|
@aaronbrethorst We will get the code deployed to pass through the |
|
@millanp any updates? |
|
Should I proceed with Aaron's idea of activating the feature only for region 40? |
|
@aaronbrethorst Hi, Aaron. Can we have your opinion on that? |
|
Yeah, go for it. |
|
Sorry for the delay here! I addressed the code review comments and restricted the feature to the Puget Sound region. I couldn't find an easy way to extract the agency ID from the arrival info, but hopefully this is OK. Let me know if there are more issues. |
amrhossamdev
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well done @millanp 👏 please look at my comments before merging.
|
I don't think I can merge it myself, but I'm not sure. Also @aaronbrethorst @amrhossamdev do you think we can get this out to the Play Store soon? I'm excited to see it in the wild! |
|
@millanp it will be uploaded to the beta channel soon 🚀 |


Adds a badge next to Link Light Rail arrival times indicating the number of cars on the arriving train. Looks like this: