mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-14 23:28:52 -04:00
Clean up code a bit.
This commit is contained in:
parent
4ccfe06263
commit
08aa9fa96c
@ -4,7 +4,9 @@ import android.os.Build;
|
||||
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
/**
|
||||
* This class aims at providing a simple and easy way to deal with the device architecture.
|
||||
*/
|
||||
public class Architecture {
|
||||
public static int UNSUPPORTED_ARCH = -1;
|
||||
public static int ARCH_ARM64 = 0x1;
|
||||
@ -30,7 +32,8 @@ public class Architecture {
|
||||
}
|
||||
|
||||
/**
|
||||
* Tells the device supported architecture
|
||||
* Tells the device supported architecture.
|
||||
* Since mips(/64) has been phased out long ago, is isn't checked here.
|
||||
*
|
||||
* @return ARCH_ARM || ARCH_ARM64 || ARCH_X86 || ARCH_86_64
|
||||
*/
|
||||
|
@ -315,7 +315,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
});
|
||||
|
||||
|
||||
minecraftGLView.setFocusable(true);
|
||||
|
||||
glTouchListener = new OnTouchListener(){
|
||||
private boolean isTouchInHotbar = false;
|
||||
/*
|
||||
@ -325,7 +325,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
private boolean shouldBeDown = false;
|
||||
/*
|
||||
* When the android system has fingers really near to each other, it tends to
|
||||
* either swap or remove a pointer.
|
||||
* either swap or remove a pointer !
|
||||
* This variable is here to mitigate the issue.
|
||||
*/
|
||||
private int lastPointerCount = 0;
|
||||
@ -636,12 +636,6 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
|
||||
}
|
||||
|
||||
boolean isKeyboard(KeyEvent evt) {
|
||||
System.out.println("Event:" +evt);
|
||||
return EfficientAndroidLWJGLKeycode.containsKey(evt.getKeyCode());
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public boolean dispatchKeyEvent(KeyEvent event) {
|
||||
/*
|
||||
@ -917,29 +911,6 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
public static void sendKeyPress(int keyCode, char keyChar, int scancode, int modifiers, boolean status) {
|
||||
CallbackBridge.sendKeycode(keyCode, keyChar, scancode, modifiers, status);
|
||||
}
|
||||
public static boolean doesObjectContainField(Class objectClass, String fieldName) {
|
||||
for (Field field : objectClass.getFields()) {
|
||||
if (field.getName().equals(fieldName)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
public void sendKeyPress(char keyChar) {
|
||||
if(doesObjectContainField(KeyEvent.class,"KEYCODE_" + Character.toUpperCase(keyChar))) {
|
||||
try {
|
||||
int keyCode = KeyEvent.class.getField("KEYCODE_" + Character.toUpperCase(keyChar)).getInt(null);
|
||||
sendKeyPress(EfficientAndroidLWJGLKeycode.getValue(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(EfficientAndroidLWJGLKeycode.getValue(keyCode), keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
} catch (IllegalAccessException | NoSuchFieldException e) {
|
||||
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
sendKeyPress(0, keyChar, 0, CallbackBridge.getCurrentMods(), true);
|
||||
sendKeyPress(0, keyChar, 0, CallbackBridge.getCurrentMods(), false);
|
||||
}
|
||||
|
||||
public static void sendKeyPress(int keyCode) {
|
||||
sendKeyPress(keyCode, CallbackBridge.getCurrentMods(), true);
|
||||
|
@ -16,6 +16,4 @@ public class MinecraftGLView extends TextureView
|
||||
//since it forces android to used the background color of the view/layout behind it.
|
||||
setOpaque(false);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user