mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-26 20:33:07 +08:00
Working. Pushing the callback server change again.
This commit is contained in:
parent
e77f9bb8fc
commit
b99e9abb5f
@ -199,7 +199,7 @@ public class CordovaChromeClient extends WebChromeClient {
|
|||||||
|
|
||||||
// Polling for JavaScript messages
|
// Polling for JavaScript messages
|
||||||
else if (reqOk && defaultValue != null && defaultValue.equals("gap_poll:")) {
|
else if (reqOk && defaultValue != null && defaultValue.equals("gap_poll:")) {
|
||||||
String r = ctx.callbackServer.getJavascript();
|
String r = appView.callbackServer.getJavascript();
|
||||||
result.confirm(r);
|
result.confirm(r);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -207,16 +207,16 @@ public class CordovaChromeClient extends WebChromeClient {
|
|||||||
else if (reqOk && defaultValue != null && defaultValue.equals("gap_callbackServer:")) {
|
else if (reqOk && defaultValue != null && defaultValue.equals("gap_callbackServer:")) {
|
||||||
String r = "";
|
String r = "";
|
||||||
if (message.equals("usePolling")) {
|
if (message.equals("usePolling")) {
|
||||||
r = ""+ ctx.callbackServer.usePolling();
|
r = ""+ appView.callbackServer.usePolling();
|
||||||
}
|
}
|
||||||
else if (message.equals("restartServer")) {
|
else if (message.equals("restartServer")) {
|
||||||
ctx.callbackServer.restartServer();
|
appView.callbackServer.restartServer();
|
||||||
}
|
}
|
||||||
else if (message.equals("getPort")) {
|
else if (message.equals("getPort")) {
|
||||||
r = Integer.toString(ctx.callbackServer.getPort());
|
r = Integer.toString(appView.callbackServer.getPort());
|
||||||
}
|
}
|
||||||
else if (message.equals("getToken")) {
|
else if (message.equals("getToken")) {
|
||||||
r = ctx.callbackServer.getToken();
|
r = appView.callbackServer.getToken();
|
||||||
}
|
}
|
||||||
result.confirm(r);
|
result.confirm(r);
|
||||||
}
|
}
|
||||||
|
@ -30,6 +30,8 @@ public class CordovaWebView extends WebView {
|
|||||||
private ArrayList<Pattern> whiteList = new ArrayList<Pattern>();
|
private ArrayList<Pattern> whiteList = new ArrayList<Pattern>();
|
||||||
private HashMap<String, Boolean> whiteListCache = new HashMap<String,Boolean>();
|
private HashMap<String, Boolean> whiteListCache = new HashMap<String,Boolean>();
|
||||||
protected PluginManager pluginManager;
|
protected PluginManager pluginManager;
|
||||||
|
public CallbackServer callbackServer;
|
||||||
|
|
||||||
|
|
||||||
/** Actvities and other important classes **/
|
/** Actvities and other important classes **/
|
||||||
private Context mCtx;
|
private Context mCtx;
|
||||||
|
@ -253,8 +253,8 @@ public class CordovaWebViewClient extends WebViewClient {
|
|||||||
|
|
||||||
// Shutdown if blank loaded
|
// Shutdown if blank loaded
|
||||||
if (url.equals("about:blank")) {
|
if (url.equals("about:blank")) {
|
||||||
if (this.ctx.callbackServer != null) {
|
if (appView.callbackServer != null) {
|
||||||
this.ctx.callbackServer.destroy();
|
appView.callbackServer.destroy();
|
||||||
}
|
}
|
||||||
this.ctx.endActivity();
|
this.ctx.endActivity();
|
||||||
}
|
}
|
||||||
|
@ -155,7 +155,6 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
|
|
||||||
protected LinearLayout root;
|
protected LinearLayout root;
|
||||||
public boolean bound = false;
|
public boolean bound = false;
|
||||||
public CallbackServer callbackServer;
|
|
||||||
protected boolean cancelLoadUrl = false;
|
protected boolean cancelLoadUrl = false;
|
||||||
protected ProgressDialog spinnerDialog = null;
|
protected ProgressDialog spinnerDialog = null;
|
||||||
|
|
||||||
@ -379,12 +378,12 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
me.appView.clearHistory();
|
me.appView.clearHistory();
|
||||||
|
|
||||||
// Create callback server and plugin manager
|
// Create callback server and plugin manager
|
||||||
if (me.callbackServer == null) {
|
if (appView.callbackServer == null) {
|
||||||
me.callbackServer = new CallbackServer();
|
appView.callbackServer = new CallbackServer();
|
||||||
me.callbackServer.init(url);
|
appView.callbackServer.init(url);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
me.callbackServer.reinit(url);
|
appView.callbackServer.reinit(url);
|
||||||
}
|
}
|
||||||
appView.pluginManager.init();
|
appView.pluginManager.init();
|
||||||
|
|
||||||
@ -832,8 +831,8 @@ public class DroidGap extends Activity implements CordovaInterface {
|
|||||||
*/
|
*/
|
||||||
public void sendJavascript(String statement) {
|
public void sendJavascript(String statement) {
|
||||||
//We need to check for the null case on the Kindle Fire beacuse it changes the width and height on load
|
//We need to check for the null case on the Kindle Fire beacuse it changes the width and height on load
|
||||||
if(this.callbackServer != null)
|
if(this.appView.callbackServer != null)
|
||||||
this.callbackServer.sendJavascript(statement);
|
appView.callbackServer.sendJavascript(statement);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
Loading…
Reference in New Issue
Block a user