Add ConnectivityMonitor, Robolectric, Snackbar
Created by: lispyclouds
Changed:
- Add a connectivity monitor which notifies subscribers of network change
- Add Robolectric framework to ease out Unit Tests
- Add Snackbar to display semi-important notices
- Add tests
This can be used as follows:
- In any Fragment, inject as follows:
@Inject lateinit var connectivityMonitor: ConnectivityMonitor
- Register callbacks (for example showing snackbars) as follows:
connectivityMonitor.subscribe { connected ->
if (connected) {
showSnackMessage("Network Connected.", Snackbar.LENGTH_SHORT)
} else {
showSnackMessage("Network Disconnected!", Snackbar.LENGTH_SHORT)
}
}