mirror of
https://github.com/apache/cordova-android.git
synced 2026-02-21 00:02:46 +08:00
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:
@@ -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.
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user