mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 00:29:50 -04:00
Transition to the efficient keycode converter.
This commit is contained in:
parent
bf2670aa89
commit
f7ef779d05
@ -607,7 +607,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
|
||||
boolean isKeyboard(KeyEvent evt) {
|
||||
System.out.println("Event:" +evt);
|
||||
return AndroidLWJGLKeycode.androidToLwjglMap.containsKey(evt.getKeyCode());
|
||||
return EfficientAndroidLWJGLKeycode.containsKey(evt.getKeyCode());
|
||||
}
|
||||
|
||||
|
||||
@ -625,7 +625,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
}
|
||||
|
||||
if(isKeyboard(event)) {
|
||||
AndroidLWJGLKeycode.execKey(event,event.getKeyCode(),event.getAction() == KeyEvent.ACTION_DOWN);
|
||||
EfficientAndroidLWJGLKeycode.execKey(event,event.getKeyCode(),event.getAction() == KeyEvent.ACTION_DOWN);
|
||||
return true;
|
||||
}
|
||||
|
||||
@ -734,7 +734,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
private void dialogSendCustomKey() {
|
||||
AlertDialog.Builder dialog = new AlertDialog.Builder(this);
|
||||
dialog.setTitle(R.string.control_customkey);
|
||||
dialog.setItems(AndroidLWJGLKeycode.generateKeyName(), (dInterface, position) -> AndroidLWJGLKeycode.execKeyIndex(BaseMainActivity.this, position));
|
||||
dialog.setItems(EfficientAndroidLWJGLKeycode.generateKeyName(), (dInterface, position) -> EfficientAndroidLWJGLKeycode.execKeyIndex(BaseMainActivity.this, position));
|
||||
dialog.show();
|
||||
}
|
||||
|
||||
@ -878,8 +878,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(AndroidLWJGLKeycode.androidToLwjglMap.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(AndroidLWJGLKeycode.androidToLwjglMap.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
sendKeyPress(EfficientAndroidLWJGLKeycode.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(EfficientAndroidLWJGLKeycode.get(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import android.widget.TextView;
|
||||
|
||||
import androidx.appcompat.app.AlertDialog;
|
||||
|
||||
import net.kdt.pojavlaunch.AndroidLWJGLKeycode;
|
||||
import net.kdt.pojavlaunch.EfficientAndroidLWJGLKeycode;
|
||||
import net.kdt.pojavlaunch.R;
|
||||
import net.kdt.pojavlaunch.customcontrols.buttons.ControlButton;
|
||||
import net.kdt.pojavlaunch.customcontrols.ControlData;
|
||||
@ -163,7 +163,7 @@ public class EditControlButtonPopup {
|
||||
specialArr[i] = "SPECIAL_" + oldSpecialArr[specialArr.length - i - 1];
|
||||
}
|
||||
adapter.addAll(specialArr);
|
||||
adapter.addAll(AndroidLWJGLKeycode.generateKeyName());
|
||||
adapter.addAll(EfficientAndroidLWJGLKeycode.generateKeyName());
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_list_item_single_choice);
|
||||
|
||||
for (Spinner spinner : spinnersKeycode) {
|
||||
@ -175,7 +175,6 @@ public class EditControlButtonPopup {
|
||||
buttonStrokeColor.setOnClickListener(view -> ActionPopupWindow.showColorPicker(ctx, "Edit stroke color", false, ((ColorDrawable) buttonStrokeColor.getBackground()).getColor(), buttonStrokeColor));
|
||||
|
||||
|
||||
|
||||
//Set dialog buttons behavior
|
||||
setupDialogButtons();
|
||||
|
||||
@ -235,7 +234,7 @@ public class EditControlButtonPopup {
|
||||
if (properties.keycodes[i] < 0) {
|
||||
spinnersKeycode[i].setSelection(properties.keycodes[i] + specialArr.length);
|
||||
} else {
|
||||
spinnersKeycode[i].setSelection(AndroidLWJGLKeycode.getIndexByLWJGLKey(properties.keycodes[i]) + specialArr.length);
|
||||
spinnersKeycode[i].setSelection(EfficientAndroidLWJGLKeycode.getIndexByLWJGLKey(properties.keycodes[i]) + specialArr.length);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -273,7 +272,7 @@ public class EditControlButtonPopup {
|
||||
if (spinnersKeycode[i].getSelectedItemPosition() < specialArr.length) {
|
||||
properties.keycodes[i] = spinnersKeycode[i].getSelectedItemPosition() - specialArr.length;
|
||||
} else {
|
||||
properties.keycodes[i] = AndroidLWJGLKeycode.getKeyByIndex(spinnersKeycode[i].getSelectedItemPosition() - specialArr.length);
|
||||
properties.keycodes[i] = EfficientAndroidLWJGLKeycode.getKeyByIndex(spinnersKeycode[i].getSelectedItemPosition() - specialArr.length);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user