mirror of
https://github.com/apache/cordova-android.git
synced 2026-04-23 00:00:09 +08:00
Remove channel.js. Remove double call to nativeReady in DroidGap. Niceify CommandResult.java
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
package com.phonegap;
|
||||
package com.phonegap;
|
||||
/* License (MIT)
|
||||
* Copyright (c) 2008 Nitobi
|
||||
* website: http://phonegap.com
|
||||
@@ -160,11 +160,6 @@ public class DroidGap extends Activity {
|
||||
bindBrowser(appView);
|
||||
if(cupcakeStorage != null)
|
||||
cupcakeStorage.setStorage(appPackage);
|
||||
|
||||
// Try firing the onNativeReady event in JS. If it fails because the JS is
|
||||
// not loaded yet then just set a flag so that the onNativeReady can be fired
|
||||
// from the JS side when the JS gets to that code.
|
||||
appView.loadUrl("javascript:try{PhoneGap.onNativeReady.fire();}catch(e){_nativeReady = true;}");
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -442,7 +437,9 @@ public class DroidGap extends Activity {
|
||||
|
||||
public class GapViewClient extends WebViewClient {
|
||||
|
||||
DroidGap mCtx;
|
||||
// TODO: hide splash screen here
|
||||
|
||||
DroidGap mCtx;
|
||||
|
||||
/**
|
||||
* Constructor.
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
package com.phonegap.api;
|
||||
|
||||
import java.net.URLEncoder;
|
||||
import org.json.JSONObject;
|
||||
|
||||
public class CommandResult {
|
||||
private final int status;
|
||||
@@ -13,9 +13,14 @@ public class CommandResult {
|
||||
|
||||
public CommandResult(Status status, String message) {
|
||||
this.status = status.ordinal();
|
||||
this.message = message;
|
||||
this.message = "'" + message + "'";
|
||||
}
|
||||
|
||||
public CommandResult(Status status, JSONObject message) {
|
||||
this.status = status.ordinal();
|
||||
this.message = message.toString();
|
||||
}
|
||||
|
||||
public int getStatus() {
|
||||
return status;
|
||||
}
|
||||
@@ -25,7 +30,7 @@ public class CommandResult {
|
||||
}
|
||||
|
||||
public String getJSONString() {
|
||||
return "{ status: " + this.getStatus() + ", message: '" + URLEncoder.encode(this.getMessage()) + "' }";
|
||||
return "{ status: " + this.getStatus() + ", message: " + this.getMessage() + " }";
|
||||
}
|
||||
|
||||
public String toSuccessCallbackString(String callbackId) {
|
||||
|
||||
Reference in New Issue
Block a user