You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2012/03/09 21:36:52 UTC

[4/5] android commit: cordova.require("cordova") is pretty funny. wish i didnt write it

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


Project: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/commit/4b05ead3
Tree: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/tree/4b05ead3
Diff: http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/diff/4b05ead3

Branch: refs/heads/master
Commit: 4b05ead3ac768447c114bfa96c88112c50a07eac
Parents: b429286
Author: Fil Maj <ma...@gmail.com>
Authored: Fri Mar 9 11:27:56 2012 -0800
Committer: Fil Maj <ma...@gmail.com>
Committed: Fri Mar 9 11:27:56 2012 -0800

----------------------------------------------------------------------
 framework/src/org/apache/cordova/DroidGap.java     |    6 +++---
 .../cordova/LinearLayoutSoftKeyboardDetect.java    |    4 ++--
 .../src/org/apache/cordova/api/PluginResult.java   |    4 ++--
 3 files changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/4b05ead3/framework/src/org/apache/cordova/DroidGap.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/DroidGap.java b/framework/src/org/apache/cordova/DroidGap.java
index 9df68cd..8513eea 100755
--- a/framework/src/org/apache/cordova/DroidGap.java
+++ b/framework/src/org/apache/cordova/DroidGap.java
@@ -1068,7 +1068,7 @@ public class DroidGap extends Activity implements CordovaInterface {
 
             // If back key is bound, then send event to JavaScript
             if (this.bound) {
-                this.appView.loadUrl("javascript:cordova.require('cordova').fireDocumentEvent('backbutton');");
+                this.appView.loadUrl("javascript:cordova.fireDocumentEvent('backbutton');");
                 return true;
             }
 
@@ -1090,13 +1090,13 @@ public class DroidGap extends Activity implements CordovaInterface {
 
         // If menu key
         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);
         }
 
         // If search key
         else if (keyCode == KeyEvent.KEYCODE_SEARCH) {
-            this.appView.loadUrl("javascript:cordova.require('cordova').fireDocumentEvent('searchbutton');");
+            this.appView.loadUrl("javascript:cordova.fireDocumentEvent('searchbutton');");
             return true;
         }
 

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/4b05ead3/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java b/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java
index 6a18c9a..a024b23 100755
--- a/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java
+++ b/framework/src/org/apache/cordova/LinearLayoutSoftKeyboardDetect.java
@@ -87,13 +87,13 @@ public class LinearLayoutSoftKeyboardDetect extends LinearLayout {
         // gone away.
         else if (height > oldHeight) {
             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 
         // been displayed.
         else if (height < oldHeight) {
             if(app != null)
-                app.sendJavascript("cordova.require('cordova').fireDocumentEvent('showkeyboard');");
+                app.sendJavascript("cordova.fireDocumentEvent('showkeyboard');");
         }
 
         // Update the old height for the next event

http://git-wip-us.apache.org/repos/asf/incubator-cordova-android/blob/4b05ead3/framework/src/org/apache/cordova/api/PluginResult.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/api/PluginResult.java b/framework/src/org/apache/cordova/api/PluginResult.java
index 35c91ec..c3ef6d6 100755
--- a/framework/src/org/apache/cordova/api/PluginResult.java
+++ b/framework/src/org/apache/cordova/api/PluginResult.java
@@ -84,11 +84,11 @@ public class PluginResult {
 	}
 	
 	public String toSuccessCallbackString(String callbackId) {
-		return "cordova.require('cordova').callbackSuccess('"+callbackId+"',"+this.getJSONString()+");";
+		return "cordova.callbackSuccess('"+callbackId+"',"+this.getJSONString()+");";
 	}
 	
 	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[] {