cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bows...@apache.org
Subject android commit: Let subclasses override focus behavior
Date Tue, 09 Jul 2013 23:04:04 GMT
Updated Branches:
  refs/heads/master ff27ad332 -> 55865a4f1


Let subclasses override focus behavior

Signed-off-by: Joe Bowser <bowserj@apache.org>


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

Branch: refs/heads/master
Commit: 55865a4f1dcd0f24df5292e3621b77080939e6e1
Parents: ff27ad3
Author: denis <denis.vergnes@orange.com>
Authored: Mon Jul 1 16:28:22 2013 +0800
Committer: Joe Bowser <bowserj@apache.org>
Committed: Tue Jul 9 15:45:41 2013 -0700

----------------------------------------------------------------------
 .../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/55865a4f/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 c2b60ef..96f7ac5 100755
--- a/framework/src/org/apache/cordova/CordovaWebView.java
+++ b/framework/src/org/apache/cordova/CordovaWebView.java
@@ -227,9 +227,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);
@@ -307,8 +308,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