ANDROID: Remove keyUp and keyDown overrides from EditSurfaceView
They were causing some nasty loops with certain keys and are largely redundant since we already had a events manager for keys
This commit is contained in:
parent
fc5e0c8b98
commit
a8fd0dc67b
3 changed files with 16 additions and 60 deletions
|
@ -36,52 +36,6 @@ public class EditableSurfaceView extends SurfaceView {
|
||||||
_context = context;
|
_context = context;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onKeyDown(int keyCode, final KeyEvent event) {
|
|
||||||
Log.d(ScummVM.LOG_TAG, "onKeyDown - EditableSurface!!!"); // Called
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK ) {
|
|
||||||
|
|
||||||
if (ScummVMActivity.keyboardWithoutTextInputShown ) {
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
|
|
||||||
// Don't handle these
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Let our event manager handle it (ScummVMEventsBase class)
|
|
||||||
return super.dispatchKeyEvent(event);
|
|
||||||
//return false;
|
|
||||||
|
|
||||||
// This did not work
|
|
||||||
//return super.onKeyDown(keyCode, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public boolean onKeyUp(int keyCode, final KeyEvent event) {
|
|
||||||
Log.d(ScummVM.LOG_TAG, "onKeyUp - EditableSurface!!!");
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_BACK ) {
|
|
||||||
|
|
||||||
if (ScummVMActivity.keyboardWithoutTextInputShown ) {
|
|
||||||
// Hide keyboard (the argument here (0) does not matter)
|
|
||||||
((ScummVMActivity) _context).showScreenKeyboardWithoutTextInputField(0);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (keyCode == KeyEvent.KEYCODE_VOLUME_DOWN || keyCode == KeyEvent.KEYCODE_VOLUME_UP) {
|
|
||||||
// Don't handle these
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
// Let our event manager handle it (ScummVMEventsBase class)
|
|
||||||
return super.dispatchKeyEvent(event);
|
|
||||||
//return false;
|
|
||||||
|
|
||||||
// This did not work
|
|
||||||
//return super.onKeyUp(keyCode, event);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean onCheckIsTextEditor() {
|
public boolean onCheckIsTextEditor() {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -201,9 +201,9 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
|
||||||
|
|
||||||
if (key > 100000) {
|
if (key > 100000) {
|
||||||
key -= 100000;
|
key -= 100000;
|
||||||
_main_surface.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
|
_main_surface.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||||
}
|
}
|
||||||
_main_surface.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
|
_main_surface.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, key));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onRelease(int key) {
|
public void onRelease(int key) {
|
||||||
|
@ -216,20 +216,22 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
|
||||||
|
|
||||||
if (key == CustomKeyboard.KEYCODE_SHIFT) {
|
if (key == CustomKeyboard.KEYCODE_SHIFT) {
|
||||||
builtinKeyboard.shift = ! builtinKeyboard.shift;
|
builtinKeyboard.shift = ! builtinKeyboard.shift;
|
||||||
if (builtinKeyboard.shift && !builtinKeyboard.alt)
|
if (builtinKeyboard.shift && !builtinKeyboard.alt) {
|
||||||
_main_surface.onKeyDown(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
|
_main_surface.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||||
else
|
} else {
|
||||||
_main_surface.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
_main_surface.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||||
|
}
|
||||||
builtinKeyboard.ChangeKeyboard();
|
builtinKeyboard.ChangeKeyboard();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (key == CustomKeyboard.KEYCODE_ALT) {
|
if (key == CustomKeyboard.KEYCODE_ALT) {
|
||||||
builtinKeyboard.alt = ! builtinKeyboard.alt;
|
builtinKeyboard.alt = ! builtinKeyboard.alt;
|
||||||
if (builtinKeyboard.alt)
|
if (builtinKeyboard.alt) {
|
||||||
_main_surface.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
_main_surface.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||||
else
|
} else {
|
||||||
builtinKeyboard.shift = false;
|
builtinKeyboard.shift = false;
|
||||||
|
}
|
||||||
builtinKeyboard.ChangeKeyboard();
|
builtinKeyboard.ChangeKeyboard();
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -242,10 +244,10 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
|
||||||
if (k.sticky && key == k.codes[0]) {
|
if (k.sticky && key == k.codes[0]) {
|
||||||
if (k.on) {
|
if (k.on) {
|
||||||
builtinKeyboard.stickyKeys.add(key);
|
builtinKeyboard.stickyKeys.add(key);
|
||||||
_main_surface.onKeyDown(key, new KeyEvent(KeyEvent.ACTION_DOWN, key));
|
_main_surface.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_DOWN, key));
|
||||||
} else {
|
} else {
|
||||||
builtinKeyboard.stickyKeys.remove(key);
|
builtinKeyboard.stickyKeys.remove(key);
|
||||||
_main_surface.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
|
_main_surface.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, key));
|
||||||
}
|
}
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
@ -257,10 +259,10 @@ public class ScummVMActivity extends Activity implements OnKeyboardVisibilityLis
|
||||||
shifted = true;
|
shifted = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
_main_surface.onKeyUp(key, new KeyEvent(KeyEvent.ACTION_UP, key));
|
_main_surface.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, key));
|
||||||
|
|
||||||
if (shifted) {
|
if (shifted) {
|
||||||
_main_surface.onKeyUp(KeyEvent.KEYCODE_SHIFT_LEFT, new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
_main_surface.dispatchKeyEvent(new KeyEvent(KeyEvent.ACTION_UP, KeyEvent.KEYCODE_SHIFT_LEFT));
|
||||||
builtinKeyboard.stickyKeys.remove(KeyEvent.KEYCODE_SHIFT_LEFT);
|
builtinKeyboard.stickyKeys.remove(KeyEvent.KEYCODE_SHIFT_LEFT);
|
||||||
for (CustomKeyboard.CustomKey k: builtinKeyboard.getKeyboard().getKeys())
|
for (CustomKeyboard.CustomKey k: builtinKeyboard.getKeyboard().getKeys())
|
||||||
{
|
{
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class ScummVMEventsBase implements
|
||||||
// OnKeyListener
|
// OnKeyListener
|
||||||
@Override
|
@Override
|
||||||
final public boolean onKey(View v, int keyCode, KeyEvent e) {
|
final public boolean onKey(View v, int keyCode, KeyEvent e) {
|
||||||
//Log.d(ScummVM.LOG_TAG, "SCUMMV-EVENTS-BASE - onKEY");
|
// Log.d(ScummVM.LOG_TAG, "SCUMMV-EVENTS-BASE - onKEY:::" + keyCode); // Called
|
||||||
final int action = e.getAction();
|
final int action = e.getAction();
|
||||||
|
|
||||||
if (e.getUnicodeChar() == (int)EditableAccommodatingLatinIMETypeNullIssues.ONE_UNPROCESSED_CHARACTER.charAt(0)) {
|
if (e.getUnicodeChar() == (int)EditableAccommodatingLatinIMETypeNullIssues.ONE_UNPROCESSED_CHARACTER.charAt(0)) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue