Skip to content

This app uses the MVVM architecture to display the current weather for the city that you have specified. It also displays a five-day forecast.

Notifications You must be signed in to change notification settings

johnjeremih/WeatherMVVM

Repository files navigation

WeatherMVVM

=====================

This app uses the MVVM pattern

These are the APIs that this project includes

Screenshots

image

image

Implementation

Data layer

The database is created using Room and has two entities: City and Forecast. Room generates the corresponding SQLite table at runtime.

Presentation layer

The app has a Main Activity and two Fragments.

  • The fist fragment displays the a list of cities where the user can add them on the searchBar using the Google API.
  • The second fragment displays a city and the forecast for the next five days.

The Activity works with a ViewModel to do the following:

  • subscribe to the emissions of the user name and update the UI every time there is a new City emitted
  • notify the ViewModel when the "Update" button is pressed and pass a City with update values.

The ViewModel gets the source from the Repository class

Room guarantees that the observable query will be triggered on a background thread.

This project shows how to use view bindings in an activity and in fragments. InflateFragment uses the inflate() API and BindFragment shows the less common bind() API.

API KEYS

The app won't run unless you add the Google Key And RapidKey

image

image

image

Releases

No releases published

Packages

No packages published

Languages