forked from github/cordova-android
Compare commits
3 Commits
Author | SHA1 | Date | |
---|---|---|---|
ea67430285 | |||
![]() |
c9108d8479 | ||
![]() |
98bb8c2a6a |
2
bin/templates/cordova/Api.js
vendored
2
bin/templates/cordova/Api.js
vendored
@ -24,7 +24,7 @@
|
||||
* This workflow would not have the `package.json` file.
|
||||
*/
|
||||
// Coho updates this line
|
||||
const VERSION = '9.1.0-dev';
|
||||
const VERSION = '9.1.0';
|
||||
|
||||
var path = require('path');
|
||||
|
||||
|
@ -22,8 +22,12 @@ package __ID__;
|
||||
import android.os.Bundle;
|
||||
import org.apache.cordova.*;
|
||||
|
||||
import android.view.KeyEvent;
|
||||
|
||||
public class __ACTIVITY__ extends CordovaActivity
|
||||
{
|
||||
private static final int[] SCAN_KEYCODE = {520, 521, 522, 523};
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState)
|
||||
{
|
||||
@ -38,4 +42,19 @@ public class __ACTIVITY__ extends CordovaActivity
|
||||
// Set by <content src="index.html" /> in config.xml
|
||||
loadUrl(launchUrl);
|
||||
}
|
||||
@Override
|
||||
public boolean onKeyUp(int keyCode, KeyEvent event) {
|
||||
if (keyCode >= SCAN_KEYCODE[0] && keyCode <= SCAN_KEYCODE[SCAN_KEYCODE.length - 1]) {
|
||||
}
|
||||
loadUrl("javascript:cordova.fireWindowEvent('native.onKeyUp',{keycode:"+keyCode+"})");
|
||||
return super.onKeyUp(keyCode, event);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onKeyDown(int keyCode, KeyEvent event) {
|
||||
if (keyCode >= SCAN_KEYCODE[0] && keyCode <= SCAN_KEYCODE[SCAN_KEYCODE.length - 1]) {
|
||||
}
|
||||
loadUrl("javascript:cordova.fireWindowEvent('native.onKeyDown',{keycode:"+keyCode+"})");
|
||||
return super.onKeyDown(keyCode, event);
|
||||
}
|
||||
}
|
||||
|
4
bin/templates/project/assets/www/cordova.js
vendored
4
bin/templates/project/assets/www/cordova.js
vendored
@ -1,5 +1,5 @@
|
||||
// Platform: android
|
||||
// 538a985db128858c0a0eb4dd40fb9c8e5433fc94
|
||||
// cordova-js rel/6.0.0-10-g07379820
|
||||
/*
|
||||
Licensed to the Apache Software Foundation (ASF) under one
|
||||
or more contributor license agreements. See the NOTICE file
|
||||
@ -19,7 +19,7 @@
|
||||
under the License.
|
||||
*/
|
||||
;(function() {
|
||||
var PLATFORM_VERSION_BUILD_LABEL = '9.1.0-dev';
|
||||
var PLATFORM_VERSION_BUILD_LABEL = '9.1.0';
|
||||
// file: src/scripts/require.js
|
||||
var require;
|
||||
var define;
|
||||
|
@ -51,7 +51,7 @@ apply plugin: 'com.github.dcendents.android-maven'
|
||||
apply plugin: 'com.jfrog.bintray'
|
||||
|
||||
group = 'org.apache.cordova'
|
||||
version = '9.1.0-dev'
|
||||
version = '9.1.0'
|
||||
|
||||
android {
|
||||
compileSdkVersion cdvCompileSdkVersion
|
||||
@ -142,9 +142,9 @@ bintray {
|
||||
licenses = ['Apache-2.0']
|
||||
labels = ['android', 'cordova', 'phonegap']
|
||||
version {
|
||||
name = '9.1.0-dev'
|
||||
name = '9.1.0'
|
||||
released = new Date()
|
||||
vcsTag = '9.1.0-dev'
|
||||
vcsTag = '9.1.0'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -31,7 +31,7 @@ import android.webkit.WebChromeClient.CustomViewCallback;
|
||||
* are not expected to implement it.
|
||||
*/
|
||||
public interface CordovaWebView {
|
||||
public static final String CORDOVA_VERSION = "9.1.0-dev";
|
||||
public static final String CORDOVA_VERSION = "9.1.0";
|
||||
|
||||
void init(CordovaInterface cordova, List<PluginEntry> pluginEntries, CordovaPreferences preferences);
|
||||
|
||||
|
@ -79,6 +79,13 @@ public class SystemWebView extends WebView implements CordovaWebViewEngine.Engin
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
if(event.getKeyCode()>=520 && event.getKeyCode() <=523){
|
||||
if (event.getAction() == KeyEvent.ACTION_UP) {
|
||||
loadUrl("javascript:cordova.fireWindowEvent('native.onKeyUp',{keycode:"+event.getKeyCode()+"})");
|
||||
} else if(event.getAction() == KeyEvent.ACTION_DOWN){
|
||||
loadUrl("javascript:cordova.fireWindowEvent('native.onKeyDown',{keycode:"+event.getKeyCode()+"})");
|
||||
}
|
||||
}
|
||||
Boolean ret = parentEngine.client.onDispatchKeyEvent(event);
|
||||
if (ret != null) {
|
||||
return ret.booleanValue();
|
||||
|
Loading…
Reference in New Issue
Block a user