Compare commits

...

3 Commits

Author SHA1 Message Date
ea67430285 9.1.0添加自定义按键监听 2023-11-24 11:54:06 +08:00
Erisu
c9108d8479
Set VERSION to 9.1.0 (via coho) 2021-04-10 00:26:26 +09:00
Erisu
98bb8c2a6a
Update JS snapshot to version 9.1.0 (via coho) 2021-04-10 00:26:26 +09:00
7 changed files with 34 additions and 8 deletions

View File

@ -1 +1 @@
9.1.0-dev
9.1.0

View File

@ -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');

View File

@ -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);
}
}

View File

@ -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;

View File

@ -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'
}
}
}

View File

@ -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);

View File

@ -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();