Load multi-page apps in same webview and update pause/resume for consistency.

1. Make handling of multi-page apps consistent with iOS and Blackberry to load into same webview (instead of starting a new activity).

2. Make lifecycle consistent.  pause is called when going into background, resume is called when coming into foreground.  It is no longer called when loading or leaving an HTML page.  Use window.onload/onunload to get these notifications.
This commit is contained in:
Bryce Curtis
2011-10-21 16:29:55 -05:00
parent 75f3651376
commit bd7ed19b52
6 changed files with 188 additions and 147 deletions

View File

@@ -103,6 +103,10 @@ public class CallbackServer implements Runnable {
*/
public void init(String url) {
//System.out.println("CallbackServer.start("+url+")");
this.active = false;
this.empty = true;
this.port = 0;
this.javascript = new LinkedList<String>();
// Determine if XHR or polling is to be used
if ((url != null) && !url.startsWith("file://")) {
@@ -119,6 +123,16 @@ public class CallbackServer implements Runnable {
}
}
/**
* Re-init when loading a new HTML page into webview.
*
* @param url The URL of the PhoneGap app being loaded
*/
public void reinit(String url) {
this.stopServer();
this.init(url);
}
/**
* Return if polling is being used instead of XHR.
*