forked from github/cordova-android
Address TODO: Move requestFocusFromTouch() to CordovaActivity rather than AndroidWebView
This commit is contained in:
parent
fb0987b824
commit
804dcac12f
@ -163,16 +163,6 @@ public class AndroidWebView extends WebView implements CordovaWebView {
|
|||||||
private void initWebViewSettings() {
|
private void initWebViewSettings() {
|
||||||
this.setInitialScale(0);
|
this.setInitialScale(0);
|
||||||
this.setVerticalScrollBarEnabled(false);
|
this.setVerticalScrollBarEnabled(false);
|
||||||
// TODO: The Activity is the one that should call requestFocus().
|
|
||||||
if (shouldRequestFocusOnInit()) {
|
|
||||||
this.requestFocusFromTouch();
|
|
||||||
}
|
|
||||||
this.setInitialScale(0);
|
|
||||||
this.setVerticalScrollBarEnabled(false);
|
|
||||||
if (shouldRequestFocusOnInit()) {
|
|
||||||
this.requestFocusFromTouch();
|
|
||||||
}
|
|
||||||
// Enable JavaScript
|
|
||||||
final WebSettings settings = this.getSettings();
|
final WebSettings settings = this.getSettings();
|
||||||
settings.setJavaScriptEnabled(true);
|
settings.setJavaScriptEnabled(true);
|
||||||
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
settings.setJavaScriptCanOpenWindowsAutomatically(true);
|
||||||
@ -267,16 +257,6 @@ public class AndroidWebView extends WebView implements CordovaWebView {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* Override this method to decide whether or not you need to request the
|
|
||||||
* focus when your application start
|
|
||||||
*
|
|
||||||
* @return true unless this method is overriden to return a different value
|
|
||||||
*/
|
|
||||||
protected boolean shouldRequestFocusOnInit() {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void exposeJsInterface() {
|
private void exposeJsInterface() {
|
||||||
if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
|
if ((Build.VERSION.SDK_INT < Build.VERSION_CODES.JELLY_BEAN_MR1)) {
|
||||||
Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
|
Log.i(TAG, "Disabled addJavascriptInterface() bridge since Android version is old.");
|
||||||
|
@ -147,6 +147,8 @@ public class CordovaActivity extends Activity {
|
|||||||
if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
|
if ("media".equals(volumePref.toLowerCase(Locale.ENGLISH))) {
|
||||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
appView.getView().requestFocusFromTouch();
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressWarnings("deprecation")
|
@SuppressWarnings("deprecation")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user