cordova.require("cordova") is pretty funny. wish i didnt write it

This commit is contained in:
Fil Maj 2012-03-09 11:27:56 -08:00
parent b4292868eb
commit 4b05ead3ac
3 changed files with 7 additions and 7 deletions

View File

@ -1068,7 +1068,7 @@ public class DroidGap extends Activity implements CordovaInterface {
// If back key is bound, then send event to JavaScript // If back key is bound, then send event to JavaScript
if (this.bound) { if (this.bound) {
this.appView.loadUrl("javascript:cordova.require('cordova').fireDocumentEvent('backbutton');"); this.appView.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
return true; return true;
} }
@ -1090,13 +1090,13 @@ public class DroidGap extends Activity implements CordovaInterface {
// If menu key // If menu key
else if (keyCode == KeyEvent.KEYCODE_MENU) { else if (keyCode == KeyEvent.KEYCODE_MENU) {
this.appView.loadUrl("javascript:cordova.require('cordova').fireDocumentEvent('menubutton');"); this.appView.loadUrl("javascript:cordova.fireDocumentEvent('menubutton');");
return super.onKeyDown(keyCode, event); return super.onKeyDown(keyCode, event);
} }
// If search key // If search key
else if (keyCode == KeyEvent.KEYCODE_SEARCH) { else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
this.appView.loadUrl("javascript:cordova.require('cordova').fireDocumentEvent('searchbutton');"); this.appView.loadUrl("javascript:cordova.fireDocumentEvent('searchbutton');");
return true; return true;
} }

View File

@ -87,13 +87,13 @@ public class LinearLayoutSoftKeyboardDetect extends LinearLayout {
// gone away. // gone away.
else if (height > oldHeight) { else if (height > oldHeight) {
if(app != null) if(app != null)
app.sendJavascript("cordova.require('cordova').fireDocumentEvent('hidekeyboard');"); app.sendJavascript("cordova.fireDocumentEvent('hidekeyboard');");
} }
// If the height as gotten smaller then we will assume the soft keyboard has // If the height as gotten smaller then we will assume the soft keyboard has
// been displayed. // been displayed.
else if (height < oldHeight) { else if (height < oldHeight) {
if(app != null) if(app != null)
app.sendJavascript("cordova.require('cordova').fireDocumentEvent('showkeyboard');"); app.sendJavascript("cordova.fireDocumentEvent('showkeyboard');");
} }
// Update the old height for the next event // Update the old height for the next event

View File

@ -84,11 +84,11 @@ public class PluginResult {
} }
public String toSuccessCallbackString(String callbackId) { public String toSuccessCallbackString(String callbackId) {
return "cordova.require('cordova').callbackSuccess('"+callbackId+"',"+this.getJSONString()+");"; return "cordova.callbackSuccess('"+callbackId+"',"+this.getJSONString()+");";
} }
public String toErrorCallbackString(String callbackId) { public String toErrorCallbackString(String callbackId) {
return "cordova.require('cordova').callbackError('"+callbackId+"', " + this.getJSONString()+ ");"; return "cordova.callbackError('"+callbackId+"', " + this.getJSONString()+ ");";
} }
public static String[] StatusMessages = new String[] { public static String[] StatusMessages = new String[] {