Skip to content

Latest commit

 

History

History
63 lines (42 loc) · 2.88 KB

README.md

File metadata and controls

63 lines (42 loc) · 2.88 KB

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