Added #882 - Weather feature overlay #1174
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Added #882.
Design
I talked to Mr. Aaron to pick out the design and icons we'd use. We focused on different weather states and I picked up the icons from https://www.amcharts.com/free-animated-svg-weather-icons/. I got 'fog' and 'wind' icons from Google Material Design. To make sure we covered everything, I checked the weather states listed here and the credit of all of the icons used added to the about.
Edge cases
Also, I have added an
option
to change the temperature unit, automatically, and by default the unit will be picked up using the user device's local country setting then he can change the unit from the setting toCelsius
orFahrenheit
Also, i have made sure that all icons are supported & suitable for the
Dark mode
Logic
I have used
OBA Weather API
to get the weather when we are in a valid region.But how we will know that we are in a valid region?
There was an interface in
BaseMapFragment
that was responsible for notifying the user about when he will be out of range, I implemented an interfaceonValidRegion
inHomeActivity
that will callback to us fromBaseMapFragment
and tell us if are in a valid region or not, to get the weather and manage the weather view as well.But what if we are already in a valid region ?
There is a method called
showStops
inBaseMapFragment
, that will work if we are in a valid region so I will also callback toHomeActivity
to notify we are in a valid region toShow the weather
I observed that
showStops
is a real-time function that will be invoked a lot of times so I have made sure to call theOBA Weather API
only when weChange the region
orgoing from invalid region to valid region
to avoid multiple calls.Tests
I have written a
IO Test
test for checking that we have for eachRegion id
aWeather Response
Video showing trying different test cases.
Video : Click here
I'm looking for your feedback and I will be happy to listen to it
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 anythingIf 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)