mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-11 13:45:48 -04:00
Fix double letters on MC 1.9 and above
This commit is contained in:
parent
5932f03a03
commit
7e98ecfd41
@ -7,7 +7,7 @@ import org.lwjgl.input.*;
|
|||||||
import org.lwjgl.opengl.*;
|
import org.lwjgl.opengl.*;
|
||||||
|
|
||||||
public class AndroidLWJGLKeycode {
|
public class AndroidLWJGLKeycode {
|
||||||
// public static boolean isSendChar;
|
public static boolean isBackspaceAfterChar;
|
||||||
private static final Map<Integer, Integer> androidToLwjglMap;
|
private static final Map<Integer, Integer> androidToLwjglMap;
|
||||||
static {
|
static {
|
||||||
androidToLwjglMap = new ArrayMap<Integer, Integer>();
|
androidToLwjglMap = new ArrayMap<Integer, Integer>();
|
||||||
@ -119,14 +119,7 @@ public class AndroidLWJGLKeycode {
|
|||||||
|
|
||||||
public static void execKey(MainActivity mainActivity, KeyEvent keyEvent, int i, boolean isDown) {
|
public static void execKey(MainActivity mainActivity, KeyEvent keyEvent, int i, boolean isDown) {
|
||||||
try {
|
try {
|
||||||
// Old method works without dead chars:
|
|
||||||
/*
|
|
||||||
if (isDown) {
|
|
||||||
mainActivity.sendKeyPress((char) keyEvent.getUnicodeChar());
|
|
||||||
}
|
|
||||||
*/
|
|
||||||
System.out.println("Sending key as char: " + ((char) keyEvent.getUnicodeChar()));
|
System.out.println("Sending key as char: " + ((char) keyEvent.getUnicodeChar()));
|
||||||
// if (isSendChar)
|
|
||||||
mainActivity.sendKeyPress(0, (char) keyEvent.getUnicodeChar(), isDown);
|
mainActivity.sendKeyPress(0, (char) keyEvent.getUnicodeChar(), isDown);
|
||||||
} catch (Throwable th) {
|
} catch (Throwable th) {
|
||||||
th.printStackTrace();
|
th.printStackTrace();
|
||||||
@ -137,6 +130,10 @@ public class AndroidLWJGLKeycode {
|
|||||||
mainActivity.sendKeyPress(perKey.getValue(), isDown);
|
mainActivity.sendKeyPress(perKey.getValue(), isDown);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (isBackspaceAfterChar) {
|
||||||
|
mainActivity.sendKeyPress(Keyboard.KEY_BACK, isDown);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -744,7 +744,7 @@ public class MCLauncherActivity extends AppCompatActivity
|
|||||||
jvmArgs.add("-Xmx1G");
|
jvmArgs.add("-Xmx1G");
|
||||||
*/
|
*/
|
||||||
Intent mainIntent = new Intent(MCLauncherActivity.this, MainActivity.class);
|
Intent mainIntent = new Intent(MCLauncherActivity.this, MainActivity.class);
|
||||||
mainIntent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
|
// mainIntent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
|
||||||
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
|
||||||
mainIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
mainIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);
|
||||||
if (PojavPreferenceActivity.PREF_FREEFORM) {
|
if (PojavPreferenceActivity.PREF_FREEFORM) {
|
||||||
|
@ -258,7 +258,7 @@ public class MainActivity extends Activity implements OnTouchListener
|
|||||||
|
|
||||||
this.drawerLayout.closeDrawers();
|
this.drawerLayout.closeDrawers();
|
||||||
|
|
||||||
// AndroidLWJGLKeycode.isSendChar = mVersionInfo.minimumLauncherVersion < 18;
|
AndroidLWJGLKeycode.isBackspaceAfterChar = mVersionInfo.minimumLauncherVersion >= 18;
|
||||||
|
|
||||||
placeMouseAt(AndroidDisplay.windowWidth / 2, AndroidDisplay.windowHeight / 2);
|
placeMouseAt(AndroidDisplay.windowWidth / 2, AndroidDisplay.windowHeight / 2);
|
||||||
new Thread(new Runnable(){
|
new Thread(new Runnable(){
|
||||||
|
Loading…
x
Reference in New Issue
Block a user