cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [02/16] android commit: Let subclasses override focus behavior
Date Tue, 22 Oct 2013 19:20:00 GMT
Let subclasses override focus behavior

Signed-off-by: Joe Bowser <bowserj@apache.org>
(cherry picked from commit 55865a4f1dcd0f24df5292e3621b77080939e6e1)


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

Branch: refs/heads/2.9.x
Commit: 4be84fbf124639525f4d1308e29619e28096e620
Parents: e9b46e5
Author: denis <denis.vergnes@orange.com>
Authored: Mon Jul 1 16:28:22 2013 +0800
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Oct 22 15:04:52 2013 -0400

----------------------------------------------------------------------
 .../src/org/apache/cordova/CordovaWebView.java  | 21 +++++++++++++++-----
 1 file changed, 16 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-android/blob/4be84fbf/framework/src/org/apache/cordova/CordovaWebView.java
----------------------------------------------------------------------
diff --git a/framework/src/org/apache/cordova/CordovaWebView.java b/framework/src/org/apache/cordova/CordovaWebView.java
index 278bfa4..648b1f8 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -228,9 +228,10 @@ public class CordovaWebView extends WebView {
     private void setup() {
         this.setInitialScale(0);
         this.setVerticalScrollBarEnabled(false);
-        this.requestFocusFromTouch();
-
-        // Enable JavaScript
+        if (shouldRequestFocusOnInit()) {
+			this.requestFocusFromTouch();
+		}
+		// Enable JavaScript
         WebSettings settings = this.getSettings();
         settings.setJavaScriptEnabled(true);
         settings.setJavaScriptCanOpenWindowsAutomatically(true);
@@ -308,8 +309,18 @@ public class CordovaWebView extends WebView {
         exposedJsApi = new ExposedJsApi(pluginManager, jsMessageQueue);
         exposeJsInterface();
     }
-    
-    private void updateUserAgentString() {
+
+	/**
+	 * Override this method to decide wether or not you need to request the
+	 * focus when your application start
+	 * 
+	 * @return
+	 */
+    protected boolean shouldRequestFocusOnInit() {
+		return true;
+	}
+
+	private void updateUserAgentString() {
         this.getSettings().getUserAgentString();
     }
 


Mime
View raw message