Skip to content
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

Fixed #851 - added filter by arrivals/departures option to ArrivalsListFragment #1290

Open
wants to merge 10 commits into
base: main
Choose a base branch
from

Conversation

viditpawar0
Copy link
Contributor

@viditpawar0 viditpawar0 commented Dec 26, 2024

Please make sure these boxes are checked before submitting your pull request - thanks!

  • Apply the AndroidStyle.xml style template to your code in Android Studio.

  • Run the unit tests with gradlew connectedObaGoogleDebugAndroidTest to make sure you didn't break anything

  • If you have multiple commits please combine them into one commit by squashing them for the initial submission of the pull request. When addressing comments on a pull request, please push a new commit per comment when possible (reviewers will squash and merge using GitHub merge tool)

Fixed #851

Screenshot:
Screenshot_20241226_221623_OneBusAway

@amrhossamdev
Copy link
Member

Hi @viditpawar0, thanks for your contribution! Could you please rebase it against the main branch?

@viditpawar0
Copy link
Contributor Author

@amrhossamdev Sure. But the branch is up to date with the main branch.

@amrhossamdev
Copy link
Member

@viditpawar0 These commits are already part of the main branch but are being shown again because your branch's history diverged from main before those commits were merged.

Rebase Your Branch on main To clean up the commit history, and always start a new branch from main. Before starting new work, ensure your branch is up-to-date. Start with a fresh branch each time to avoid inheriting old commits.

@amrhossamdev amrhossamdev self-requested a review December 28, 2024 08:41
Copy link
Member

@amrhossamdev amrhossamdev left a comment

Choose a reason for hiding this comment

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

Overall, it looks great! However, could you please include more information in the PR regarding your approach and logic? This will help me understand better.

@@ -41,5 +42,9 @@ public void setTripsForStop(ContentQueryMap tripsForStop) {
notifyDataSetChanged();
}

abstract public void setData(ObaArrivalInfo[] arrivals, ArrayList<String> routesFilter, long currentTime);
abstract public void setData(ObaArrivalInfo[] arrivals, ArrayList<String> routesFilter, long currentTime, ArrivalFilter arrivalFilter);
public void setData(ObaArrivalInfo[] arrivals, ArrayList<String> routesFilter, long currentTime) {
Copy link
Member

Choose a reason for hiding this comment

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

spaces

@@ -227,4 +227,10 @@
<item>@string/trip_plan_arriving</item>
</string-array>

<string-array name="stop_info_arrival_filter_options">
Copy link
Member

Choose a reason for hiding this comment

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

We are using localization to support multiple languages so make sure to translate those strings to all supported languages

@@ -1280,4 +1280,5 @@
<string name="display_test_wide_alerts_for_regions">Display test-wide alerts for regions</string>
<string name="do_you_want_to_plan_the_trip_now">Do you want to plan the trip now?</string>
<string name="plan_trip">Plan Trip?</string>
<string name="stop_info_option_filter_arrivals_departures">Filter arrivals/departures</string>
Copy link
Member

Choose a reason for hiding this comment

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

Translate that to multiple languages

@@ -106,6 +146,15 @@ private static boolean shouldAddEta(ArrivalInfo info) {
return false;
}

private static boolean shouldAddArrivalFilter(ArrivalInfo info, @NonNull ArrivalFilter arrivalFilter) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please write comments explaining this function?

this.arrayResourceIndex = arrayResourceIndex;
}

public String getOptionString(Resources appResources) {
Copy link
Member

Choose a reason for hiding this comment

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

not used ?

@@ -61,7 +64,7 @@ public static ArrayList<ArrivalInfo> convertObaArrivalInfo(Context context,
if (filter.contains(arrival.getRouteId())) {
ArrivalInfo info = new ArrivalInfo(context, arrival, ms,
includeArrivalDepartureInStatusLabel);
if (shouldAddEta(info)) {
if (shouldAddEta(info) && shouldAddArrivalFilter(info, arrivalFilter)) {
Copy link
Member

Choose a reason for hiding this comment

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

Could you please explain your logic here ?

@@ -71,7 +74,7 @@ public static ArrayList<ArrivalInfo> convertObaArrivalInfo(Context context,
for (ObaArrivalInfo obaArrivalInfo : arrivalInfo) {
ArrivalInfo info = new ArrivalInfo(context, obaArrivalInfo, ms,
includeArrivalDepartureInStatusLabel);
if (shouldAddEta(info)) {
if (shouldAddEta(info) && shouldAddArrivalFilter(info, arrivalFilter)) {
Copy link
Member

Choose a reason for hiding this comment

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

and here can you explain the logic

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.

Allow filtering by arrivals or departures at a stop
3 participants