mirror of
https://github.com/2009scape/2009Scape-mobile.git
synced 2025-12-19 13:00:12 -07:00
Revamp the special key system to match v2 spirit:
- Fix special keys triggerring up to 16 times ! - Fix special keys not being properly toggleable - Moved special key handling into the ControlButton. - Removed the need for a listener. - Toggling the mouse doesn't affect the button text anymore.
This commit is contained in:
parent
28fa92f1cb
commit
c435db640a
8 changed files with 94 additions and 179 deletions
|
|
@ -32,7 +32,7 @@ import org.lwjgl.glfw.*;
|
|||
|
||||
public class BaseMainActivity extends LoggableActivity {
|
||||
public static volatile ClipboardManager GLOBAL_CLIPBOARD;
|
||||
public TouchCharInput touchCharInput;
|
||||
public static TouchCharInput touchCharInput;
|
||||
|
||||
volatile public static boolean isInputStackCall;
|
||||
|
||||
|
|
@ -84,8 +84,8 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
|
||||
public boolean hiddenTextIgnoreUpdate = true;
|
||||
|
||||
private boolean isVirtualMouseEnabled;
|
||||
private LinearLayout touchPad;
|
||||
private static boolean isVirtualMouseEnabled;
|
||||
private static LinearLayout touchPad;
|
||||
private ImageView mousePointer;
|
||||
private MinecraftAccount mProfile;
|
||||
|
||||
|
|
@ -867,12 +867,14 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
this.mousePointer.setY(y);
|
||||
}
|
||||
|
||||
public void toggleMouse(View view) {
|
||||
public static void toggleMouse(Context ctx) {
|
||||
if (CallbackBridge.isGrabbing()) return;
|
||||
|
||||
isVirtualMouseEnabled = !isVirtualMouseEnabled;
|
||||
touchPad.setVisibility(isVirtualMouseEnabled ? View.VISIBLE : View.GONE);
|
||||
((Button) view).setText(isVirtualMouseEnabled ? R.string.control_mouseon: R.string.control_mouseoff);
|
||||
Toast.makeText(ctx,
|
||||
isVirtualMouseEnabled ? R.string.control_mouseon : R.string.control_mouseoff,
|
||||
Toast.LENGTH_SHORT).show();
|
||||
}
|
||||
|
||||
public static void dialogForceClose(Context ctx) {
|
||||
|
|
@ -895,6 +897,12 @@ public class BaseMainActivity extends LoggableActivity {
|
|||
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_ESCAPE);
|
||||
}
|
||||
|
||||
public static void switchKeyboardState() {
|
||||
if(touchCharInput != null) touchCharInput.switchKeyboardState();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected void setRightOverride(boolean val) {
|
||||
this.rightOverride = val;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue