Skip to content

Add ConnectivityMonitor, Robolectric, Snackbar

Sunil Mohan Adapa requested to merge lispyclouds:connectivity-monitor into master

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)
    }
}

Merge request reports

Loading