mirror of
https://github.com/apache/cordova-android.git
synced 2025-02-12 10:42:58 +08:00
Let subclasses override focus behavior
Signed-off-by: Joe Bowser <bowserj@apache.org>
(cherry picked from commit 55865a4f1d
)
This commit is contained in:
parent
e9b46e5cf6
commit
4be84fbf12
@ -228,9 +228,10 @@ public class CordovaWebView extends WebView {
|
|||||||
private void setup() {
|
private void setup() {
|
||||||
this.setInitialScale(0);
|
this.setInitialScale(0);
|
||||||
this.setVerticalScrollBarEnabled(false);
|
this.setVerticalScrollBarEnabled(false);
|
||||||
this.requestFocusFromTouch();
|
if (shouldRequestFocusOnInit()) {
|
||||||
|
this.requestFocusFromTouch();
|
||||||
// Enable JavaScript
|
}
|
||||||
|
// Enable JavaScript
|
||||||
WebSettings settings = this.getSettings();
|
WebSettings settings = this.getSettings();
|
||||||
settings.setJavaScriptEnabled(true);
|
settings.setJavaScriptEnabled(true);
|
||||||
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||||
@ -308,8 +309,18 @@ public class CordovaWebView extends WebView {
|
|||||||
exposedJsApi = new ExposedJsApi(pluginManager, jsMessageQueue);
|
exposedJsApi = new ExposedJsApi(pluginManager, jsMessageQueue);
|
||||||
exposeJsInterface();
|
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();
|
this.getSettings().getUserAgentString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user