mirror of
https://github.com/apache/cordova-android.git
synced 2025-01-18 14:32:53 +08:00
Fix plumbing of key events to instance webview
This commit is contained in:
parent
c66135d4de
commit
857d841adb
@ -19,7 +19,6 @@
|
||||
|
||||
package org.apache.cordova;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Locale;
|
||||
|
||||
@ -60,9 +59,6 @@ public class AndroidCordovaWebView extends CordovaWebView {
|
||||
public static final String TAG = "CordovaWebView";
|
||||
public static final String CORDOVA_VERSION = "3.6.0-dev";
|
||||
|
||||
private ArrayList<Integer> keyDownCodes = new ArrayList<Integer>();
|
||||
private ArrayList<Integer> keyUpCodes = new ArrayList<Integer>();
|
||||
|
||||
private boolean paused;
|
||||
|
||||
private BroadcastReceiver receiver;
|
||||
@ -550,24 +546,13 @@ public class AndroidCordovaWebView extends CordovaWebView {
|
||||
@Override
|
||||
public void bindButton(String button, boolean override) {
|
||||
if (button.compareTo("volumeup")==0) {
|
||||
keyDownCodes.add(KeyEvent.KEYCODE_VOLUME_UP);
|
||||
webview.bindButton(KeyEvent.KEYCODE_VOLUME_UP, true);
|
||||
}
|
||||
else if (button.compareTo("volumedown")==0) {
|
||||
keyDownCodes.add(KeyEvent.KEYCODE_VOLUME_DOWN);
|
||||
webview.bindButton(KeyEvent.KEYCODE_VOLUME_DOWN, true);
|
||||
}
|
||||
}
|
||||
|
||||
private void bindButton(int keyCode, boolean keyDown, boolean override) {
|
||||
if(keyDown)
|
||||
{
|
||||
keyDownCodes.add(keyCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyUpCodes.add(keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isBackButtonBound()
|
||||
{
|
||||
|
@ -337,6 +337,20 @@ public class AndroidWebView extends WebView {
|
||||
return false;
|
||||
}
|
||||
|
||||
/*
|
||||
* Add a key code to either the keyUp or keyDown handler lists.
|
||||
*/
|
||||
void bindButton(int keyCode, boolean keyDown) {
|
||||
if(keyDown)
|
||||
{
|
||||
keyDownCodes.add(keyCode);
|
||||
}
|
||||
else
|
||||
{
|
||||
keyUpCodes.add(keyCode);
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* onKeyDown
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user