You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
API version info: Compile SDK Version: 28; Min SDK Version: 19; Target SDK Version: 28
Auto-generated the Java classes needed to capture response (GeoJSON) from USGS endpoint using jsonschema2pojo
API Endpoint
For the sake of simplicity and since USGS endpoint does not provide a mechanism to filter the results to a shorter list, I'm fetching 30 day records of Significant Earthquakes
That said, I could have fetched either the Magnitude 1.0 and above or All Earthquakes while displaying a progress spinner/bar and cached the records locally or in-memory for subsequent display and to prevent more network calls
App Notes
Built the app using the Model-View-Pattern (MVP) pattern where the View (Activity) communicates with the Presenter only for handling user interactions as well as for communicating with the model to fetch the data from the APIs
The Retrofit client UsgsRestClient is part of the Model (of MVP pattern) since it calls the API endpoint(s)
This Retrofit client implements a callback for success and failure scenarios
The objects in the Model are just POJOs and do not participate in massaging the data for presentation in the UI, that responsibility is handled by the Adapter
To maintain the position for when the user returns from detail view, I leveraged the Activity lifecycle methods, onPause() and onResume to persist the row item user selected and hence to return the user to that same position, if the user chose not to hide that row item
At the moment, the show/hide functionality is a WIP and so,
show all doesn't refresh with displaying the hidden item(s)
if the user decides to display all (including hidden) row items, then the user can't go back to the hidden row items
Also, the user has to manually disable the display all switch in order to leverage the hide row item capability
Tested the app on Pixel 2 (running OS 9)
Pending (develop branch) tasks
Convert to PURE MVP where Activity passes the type of radio button clicked to Presenter
Ensure unit tests can be written for Presenter
About
A simple MVP app that displays most recent Earthquakes across the world