mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-19 21:10:11 -07:00
Clean up, keyboard is faster now
This commit is contained in:
parent
22b3583ae1
commit
153e991806
3 changed files with 49 additions and 54 deletions
|
|
@ -624,8 +624,10 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
return true;
|
||||
}
|
||||
|
||||
if(isKeyboard(event)) {
|
||||
EfficientAndroidLWJGLKeycode.execKey(event,event.getKeyCode(),event.getAction() == KeyEvent.ACTION_DOWN);
|
||||
int index = EfficientAndroidLWJGLKeycode.getIndexByKey(event.getKeyCode());
|
||||
if(index >= 0) {
|
||||
Toast.makeText(this,"THIS IS A KEYBOARD EVENT !", Toast.LENGTH_SHORT).show();
|
||||
EfficientAndroidLWJGLKeycode.execKey(event, index);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
|
@ -734,7 +736,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
private void dialogSendCustomKey() {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
|
||||
dialog.setTitle(R.string.control_customkey);
|
||||
dialog.setItems(EfficientAndroidLWJGLKeycode.generateKeyName(), (dInterface, position) -> EfficientAndroidLWJGLKeycode.execKeyIndex(BaseMainActivity.this, position));
|
||||
dialog.setItems(EfficientAndroidLWJGLKeycode.generateKeyName(), (dInterface, position) -> EfficientAndroidLWJGLKeycode.execKeyIndex(position));
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
|
|
@ -878,8 +880,8 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
if(doesObjectContainField(KeyEvent.class,"KEYCODE_" + Character.toUpperCase(keyChar))) {
|
||||
try {
|
||||
int keyCode = KeyEvent.class.getField("KEYCODE_" + Character.toUpperCase(keyChar)).getInt(null);
|
||||
sendKeyPress(EfficientAndroidLWJGLKeycode.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(EfficientAndroidLWJGLKeycode.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
sendKeyPress(EfficientAndroidLWJGLKeycode.getValue(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(EfficientAndroidLWJGLKeycode.getValue(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
|
||||
}
|
||||
|
|
@ -890,7 +892,7 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
sendKeyPress(0, keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
}
|
||||
|
||||
public void sendKeyPress(int keyCode) {
|
||||
public static void sendKeyPress(int keyCode) {
|
||||
sendKeyPress(keyCode, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(keyCode, CallbackBridge.getCurrentMods(), false);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue