mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-14 23:28:52 -04:00
- Add auto-correct support
- Fix F25 key when setting controls.
This commit is contained in:
parent
a47361cba0
commit
47f467e705
@ -46,23 +46,19 @@ public class TouchCharInput extends androidx.appcompat.widget.AppCompatEditText
|
|||||||
@Override
|
@Override
|
||||||
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
|
protected void onTextChanged(CharSequence text, int start, int lengthBefore, int lengthAfter) {
|
||||||
super.onTextChanged(text, start, lengthBefore, lengthAfter);
|
super.onTextChanged(text, start, lengthBefore, lengthAfter);
|
||||||
if(isDoingInternalChanges){
|
if(isDoingInternalChanges)return;
|
||||||
isDoingInternalChanges = false;
|
|
||||||
return;
|
for(int i=0; i< lengthBefore; ++i){
|
||||||
|
CallbackBridge.sendKeycode(LWJGLGLFWKeycode.GLFW_KEY_BACKSPACE, '\u0008', 0, 0, true);
|
||||||
}
|
}
|
||||||
if(lengthAfter < lengthBefore){
|
for(int i=start, count = 0; count < lengthAfter; ++i){
|
||||||
for(int i=0; i< lengthBefore-lengthAfter; ++i){
|
//I didn't know F25 existed before that. I just need a full fat keycode for mc 1.13+
|
||||||
CallbackBridge.sendKeycode(LWJGLGLFWKeycode.GLFW_KEY_BACKSPACE, '\u0008', 0, 0, true);
|
CallbackBridge.sendChar(text.charAt(i), 0);
|
||||||
}
|
++count;
|
||||||
}else{
|
|
||||||
for(int i=lengthBefore, index=lengthBefore+start; i < lengthAfter; ++i){
|
|
||||||
//I didn't know F25 existed before that. I just need a full fat keycode for mc 1.13+
|
|
||||||
CallbackBridge.sendKeycode(LWJGLGLFWKeycode.GLFW_KEY_F25, text.charAt(index), 0, 0, true);
|
|
||||||
index ++;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
clear();
|
//Reset the keyboard state
|
||||||
|
if(text.length() < 1) clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -88,10 +84,6 @@ public class TouchCharInput extends androidx.appcompat.widget.AppCompatEditText
|
|||||||
return super.onKeyPreIme(keyCode, event);
|
return super.onKeyPreIme(keyCode, event);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
|
||||||
public void setSelection(int index) {
|
|
||||||
super.setSelection(5);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Toggle on and off the soft keyboard, depending of the state
|
* Toggle on and off the soft keyboard, depending of the state
|
||||||
@ -125,8 +117,9 @@ public class TouchCharInput extends androidx.appcompat.widget.AppCompatEditText
|
|||||||
isDoingInternalChanges = true;
|
isDoingInternalChanges = true;
|
||||||
//Braille space, doesn't trigger keyboard auto-complete
|
//Braille space, doesn't trigger keyboard auto-complete
|
||||||
//replacing directly the text without though setText avoids notifying changes
|
//replacing directly the text without though setText avoids notifying changes
|
||||||
getText().replace(0, getText().length(),"\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800\u2800");
|
setText(" ");
|
||||||
setSelection(5);
|
setSelection(getText().length());
|
||||||
|
isDoingInternalChanges = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -159,7 +152,6 @@ public class TouchCharInput extends androidx.appcompat.widget.AppCompatEditText
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* This function deals with anything that has to be executed when the constructor is called
|
* This function deals with anything that has to be executed when the constructor is called
|
||||||
*/
|
*/
|
||||||
|
@ -79,6 +79,11 @@ public class CallbackBridge {
|
|||||||
// sendData(JRE_TYPE_KEYCODE_CONTROL, keycode, Character.toString(keychar), Boolean.toString(isDown), modifiers);
|
// sendData(JRE_TYPE_KEYCODE_CONTROL, keycode, Character.toString(keychar), Boolean.toString(isDown), modifiers);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static void sendChar(char keychar, int modifiers){
|
||||||
|
nativeSendCharMods(keychar,modifiers);
|
||||||
|
nativeSendChar(keychar);
|
||||||
|
}
|
||||||
|
|
||||||
public static void sendMouseKeycode(int button, int modifiers, boolean isDown) {
|
public static void sendMouseKeycode(int button, int modifiers, boolean isDown) {
|
||||||
DEBUG_STRING.append("MouseKey=").append(button).append(", down=").append(isDown).append("\n");
|
DEBUG_STRING.append("MouseKey=").append(button).append(", down=").append(isDown).append("\n");
|
||||||
// if (isGrabbing()) DEBUG_STRING.append("MouseGrabStrace: " + android.util.Log.getStackTraceString(new Throwable()) + "\n");
|
// if (isGrabbing()) DEBUG_STRING.append("MouseGrabStrace: " + android.util.Log.getStackTraceString(new Throwable()) + "\n");
|
||||||
|
@ -53,8 +53,8 @@
|
|||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:background="@android:color/darker_gray"
|
android:background="@android:color/darker_gray"
|
||||||
android:ems="10"
|
android:ems="10"
|
||||||
android:imeOptions="flagNoFullscreen|flagNoExtractUi|flagNoPersonalizedLearning|actionSend"
|
android:imeOptions="flagNoFullscreen|flagNoExtractUi|flagNoPersonalizedLearning|actionDone"
|
||||||
android:inputType="textVisiblePassword"
|
android:inputType="textFilter|textImeMultiLine|textAutoComplete|textAutoCorrect"
|
||||||
tools:ignore="TouchTargetSizeCheck" />
|
tools:ignore="TouchTargetSizeCheck" />
|
||||||
|
|
||||||
</net.kdt.pojavlaunch.customcontrols.ControlLayout>
|
</net.kdt.pojavlaunch.customcontrols.ControlLayout>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user