Improve offline detection. (#13250)

- Move offline/online detection to entry-point so as we dont depend
  on the connector being loaded if we are disconnected.
- Configure polling when we are offline, using vaadin Heartbeat if
  possible otherwise we use a timer to request Touchkit servlet.
- Listen for HTML-5 online/offline events
- Listen for Phonegap (Cordova) events and notify cordova when the
  app has been loaded (after downloading app cache stuff)
- Exported some of JS methods to force offline/online from the
  console: tkGoOffline() tkGoOnline() tkServerDown() tkServerUp()
- Many hacks in order to fix buggy androd html5 onLine flag when
  the app runs in webview.

Change-Id: I7e034251eaa2b87795bfda6828767d6289310312