[Input pipe] Use EditText to handle input events, with support input unicodes

This commit is contained in:
khanhduytran0 2020-11-27 06:22:20 +07:00
parent cc47a72bc2
commit ae50740ff4
10 changed files with 251 additions and 712 deletions

View file

@ -63,13 +63,6 @@
android:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize|keyboard|navigation"/>
<activity
android:launchMode="standard"
android:multiprocess="true"
android:screenOrientation="sensorLandscape"
android:name=".CustomCtrlMainActivity"
android:configChanges="keyboardHidden|orientation|screenSize|keyboard|navigation"/>
<activity
android:screenOrientation="sensorLandscape"
android:name=".prefs.LauncherPreferenceActivity"

View file

@ -172,16 +172,18 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
errorAt = null;
*/
int errorAt = 0;
try {
properties.insertDynamicPos(editDynamicX.getText().toString());
errorAt = 1;
properties.insertDynamicPos(editDynamicY.getText().toString());
} catch (Throwable th) {
(errorAt == 0 ? editDynamicX : editDynamicY)
.setError(th.getMessage());
return;
if (properties.isDynamicBtn) {
int errorAt = 0;
try {
properties.insertDynamicPos(editDynamicX.getText().toString());
errorAt = 1;
properties.insertDynamicPos(editDynamicY.getText().toString());
} catch (Throwable th) {
(errorAt == 0 ? editDynamicX : editDynamicY)
.setError(th.getMessage());
return;
}
}
if (spinnerKeycode.getSelectedItemPosition() < specialArr.length) {

View file

@ -168,14 +168,14 @@ public class AndroidLWJGLKeycode {
return androidKeyNameArray;
}
public static void execKey(BaseMainActivity mainActivity, KeyEvent keyEvent, int i, boolean isDown) {
public static void execKey(KeyEvent keyEvent, int i, boolean isDown) {
for (Map.Entry<Integer, Integer> perKey : androidToLwjglMap.entrySet()) {
if (i == 1 && (keyEvent.getSource() == InputDevice.SOURCE_MOUSE)) {
// Right mouse detection
mainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, true);
mainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, false);
BaseMainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
// BaseMainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, false);
} else if (perKey.getKey() == i) {
mainActivity.sendKeyPress(perKey.getValue(), keyEvent.getModifiers(), isDown);
BaseMainActivity.sendKeyPress(perKey.getValue(), keyEvent.getModifiers(), isDown);
}
}
@ -196,14 +196,14 @@ public class AndroidLWJGLKeycode {
try {
if ((int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && !CallbackBridge.isGrabbing()) {
mainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()), (char) keyEvent.getUnicodeChar(), keyEvent.getScanCode(), mods, isDown);
BaseMainActivity.sendKeyPress(androidToLwjglMap.get(keyEvent.getKeyCode()), (char) keyEvent.getUnicodeChar(), keyEvent.getScanCode(), mods, isDown);
}
} catch (Throwable th) {
th.printStackTrace();
}
if (isBackspaceAfterChar && (int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && !CallbackBridge.isGrabbing() && i != KeyEvent.KEYCODE_DEL) {
mainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_BACKSPACE, 0, isDown);
BaseMainActivity.sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_BACKSPACE, 0, isDown);
}
}

View file

@ -73,6 +73,8 @@ public class BaseMainActivity extends LoggableActivity {
private DrawerLayout drawerLayout;
private NavigationView navDrawer;
private CapturedEditText mKeyHandlerView;
private LinearLayout contentLog;
private TextView textLog;
@ -196,6 +198,11 @@ public class BaseMainActivity extends LoggableActivity {
// toggleGui(null);
this.drawerLayout.closeDrawers();
mKeyHandlerView = findViewById(R.id.main_key_handler);
mKeyHandlerView.setFocusable(true);
mKeyHandlerView.setFocusableInTouchMode(true);
mKeyHandlerView.requestFocus();
AndroidLWJGLKeycode.isBackspaceAfterChar = true; // mVersionInfo.minimumLauncherVersion >= 18;
placeMouseAt(CallbackBridge.windowWidth / 2, CallbackBridge.windowHeight / 2);
@ -712,50 +719,6 @@ public class BaseMainActivity extends LoggableActivity {
e.printStackTrace();
Tools.showError(this, e, true);
}
// Mirror video of OpenGL view.
/*
new Thread(new Runnable(){
@Override
public void run()
{
try {
while (true) {
if (bit == null) continue;
runOnUiThread(new Runnable(){
@Override
public void run()
{
fillCanvasGL();
mirrorView.setImageBitmap(bit);
}
});
// ~33fps render
Thread.sleep(30);
}
} catch (Throwable th) {
th.printStackTrace();
}
}
}).start();
*/
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event)
{
AndroidLWJGLKeycode.execKey(this, event, keyCode, false);
return super.onKeyUp(keyCode, event);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event)
{
AndroidLWJGLKeycode.execKey(this, event, keyCode, true);
return super.onKeyDown(keyCode, event);
}
//private Dialog menuDial;
@ -1042,8 +1005,10 @@ public class BaseMainActivity extends LoggableActivity {
public void onBackPressed() {
// Prevent back
// Catch back as Esc keycode at another place
}
// sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_ESCAPE);
}
public void hideKeyboard() {
try {
getWindow().setSoftInputMode(WindowManager.LayoutParams.SOFT_INPUT_STATE_ALWAYS_HIDDEN);
@ -1086,8 +1051,8 @@ public class BaseMainActivity extends LoggableActivity {
sendKeyPress(keyCode, 0, false);
}
private boolean isLeftMouseDown, isRightMouseDown;
public void sendMouseButton(int button, boolean status) {
private static boolean isLeftMouseDown, isRightMouseDown;
public static void sendMouseButton(int button, boolean status) {
// TODO implement this method!!!
// CallbackBridge.setMouseButtonInGrabMode((byte) button, status ? (byte) 1 : (byte) 0);
// or

View file

@ -0,0 +1,29 @@
package net.kdt.pojavlaunch;
import android.content.*;
import android.util.*;
import android.widget.*;
import android.view.*;
public class CapturedEditText extends EditText
{
public CapturedEditText(Context ctx) {
this(ctx, null);
}
public CapturedEditText(Context ctx, AttributeSet attrs) {
super(ctx, attrs);
}
@Override
public boolean onKeyDown(int keyCode, KeyEvent event) {
AndroidLWJGLKeycode.execKey(event, keyCode, true);
return true;
}
@Override
public boolean onKeyUp(int keyCode, KeyEvent event) {
AndroidLWJGLKeycode.execKey(event, keyCode, false);
return true;
}
}

View file

@ -1,113 +0,0 @@
package net.kdt.pojavlaunch;
import android.os.*;
import android.view.*;
import android.view.View.*;
import android.widget.*;
import net.kdt.pojavlaunch.customcontrols.*;
import net.kdt.pojavlaunch.prefs.*;
import org.lwjgl.glfw.*;
import java.io.*;
import com.google.gson.*;
public class CustomCtrlMainActivity extends BaseMainActivity {
private ControlLayout mControlLayout;
private View.OnClickListener mClickListener;
private View.OnTouchListener mTouchListener;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initLayout(R.layout.main_with_customctrl);
mClickListener = new View.OnClickListener(){
@Override
public void onClick(View view) {
if (view instanceof ControlButton) {
ControlButton button = (ControlButton) view;
switch (button.getProperties().keycode) {
case ControlData.SPECIALBTN_KEYBOARD:
showKeyboard();
break;
case ControlData.SPECIALBTN_TOGGLECTRL:
mControlLayout.toggleControlVisible();
break;
case ControlData.SPECIALBTN_VIRTUALMOUSE:
toggleMouse(button);
break;
}
}
}
};
mTouchListener = new View.OnTouchListener(){
@Override
public boolean onTouch(View view, MotionEvent e) {
boolean isDown;
switch (e.getActionMasked()) {
case MotionEvent.ACTION_DOWN: // 0
case MotionEvent.ACTION_POINTER_DOWN: // 5
isDown = true;
break;
case MotionEvent.ACTION_UP: // 1
case MotionEvent.ACTION_CANCEL: // 3
case MotionEvent.ACTION_POINTER_UP: // 6
isDown = false;
break;
default:
return false;
}
if (view instanceof ControlButton) {
ControlButton button = (ControlButton) view;
switch (button.getProperties().keycode) {
case ControlData.SPECIALBTN_MOUSEPRI:
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown);
break;
case ControlData.SPECIALBTN_MOUSEMID:
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_MIDDLE, isDown);
break;
case ControlData.SPECIALBTN_MOUSESEC:
if (CallbackBridge.isGrabbing()) {
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
} else {
CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown ? 1 : 0, CallbackBridge.mouseX, CallbackBridge.mouseY);
setRightOverride(isDown);
}
break;
}
}
return false;
}
};
ControlData[] specialButtons = ControlData.getSpecialButtons();
specialButtons[0].specialButtonListener
= specialButtons[1].specialButtonListener
= specialButtons[4].specialButtonListener
= mClickListener;
specialButtons[2].specialButtonListener
= specialButtons[3].specialButtonListener
= specialButtons[5].specialButtonListener
= mTouchListener;
mControlLayout = findViewById(R.id.main_control_layout);
mControlLayout.setModifiable(false);
try {
mControlLayout.loadLayout(LauncherPreferences.PREF_DEFAULTCTRL_PATH);
} catch (Throwable th) {
Tools.showError(this, th);
}
// toggleGui(null);
mControlLayout.toggleControlVisible();
}
}

View file

@ -7,131 +7,107 @@ import android.widget.*;
import net.kdt.pojavlaunch.customcontrols.*;
import net.kdt.pojavlaunch.prefs.*;
import org.lwjgl.glfw.*;
import java.io.*;
import com.google.gson.*;
public class MainActivity extends BaseMainActivity implements OnClickListener, OnTouchListener {
private Button upButton,
downButton, leftButton,
rightButton, jumpButton,
primaryButton, secondaryButton,
debugButton, shiftButton,
keyboardButton, inventoryButton,
talkButton, thirdPersonButton,
zoomButton, listPlayersButton,
toggleControlButton;
private Button[] controlButtons;
public class MainActivity extends BaseMainActivity {
private ControlLayout mControlLayout;
private View.OnClickListener mClickListener;
private View.OnTouchListener mTouchListener;
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
initLayout(R.layout.main);
this.upButton = findButton(R.id.control_up);
this.downButton = findButton(R.id.control_down);
this.leftButton = findButton(R.id.control_left);
this.rightButton = findButton(R.id.control_right);
this.jumpButton = findButton(R.id.control_jump);
this.primaryButton = findButton(R.id.control_primary);
this.secondaryButton = findButton(R.id.control_secondary);
this.debugButton = findButton(R.id.control_debug);
this.shiftButton = findButton(R.id.control_shift);
this.keyboardButton = findButton(R.id.control_keyboard);
this.inventoryButton = findButton(R.id.control_inventory);
this.talkButton = findButton(R.id.control_talk);
this.thirdPersonButton = findButton(R.id.control_thirdperson);
this.zoomButton = findButton(R.id.control_zoom);
this.listPlayersButton = findButton(R.id.control_listplayers);
this.toggleControlButton = findButton(R.id.control_togglecontrol);
this.controlButtons = new Button[]{
upButton, downButton, leftButton, rightButton,
jumpButton, primaryButton, secondaryButton,
debugButton, shiftButton, keyboardButton,
inventoryButton, talkButton, thirdPersonButton,
listPlayersButton
initLayout(R.layout.main_with_customctrl);
mClickListener = new View.OnClickListener(){
@Override
public void onClick(View view) {
if (view instanceof ControlButton) {
ControlButton button = (ControlButton) view;
switch (button.getProperties().keycode) {
case ControlData.SPECIALBTN_KEYBOARD:
showKeyboard();
break;
case ControlData.SPECIALBTN_TOGGLECTRL:
mControlLayout.toggleControlVisible();
break;
case ControlData.SPECIALBTN_VIRTUALMOUSE:
toggleMouse(button);
break;
}
}
}
};
this.toggleControlButton.setOnClickListener(this);
this.zoomButton.setVisibility(mVersionInfo.optifineLib == null ? View.GONE : View.VISIBLE);
mTouchListener = new View.OnTouchListener(){
@Override
public boolean onTouch(View view, MotionEvent e) {
boolean isDown;
switch (e.getActionMasked()) {
case MotionEvent.ACTION_DOWN: // 0
case MotionEvent.ACTION_POINTER_DOWN: // 5
isDown = true;
break;
case MotionEvent.ACTION_UP: // 1
case MotionEvent.ACTION_CANCEL: // 3
case MotionEvent.ACTION_POINTER_UP: // 6
isDown = false;
break;
default:
return false;
}
if (view instanceof ControlButton) {
ControlButton button = (ControlButton) view;
switch (button.getProperties().keycode) {
case ControlData.SPECIALBTN_MOUSEPRI:
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown);
break;
case ControlData.SPECIALBTN_MOUSEMID:
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_MIDDLE, isDown);
break;
case ControlData.SPECIALBTN_MOUSESEC:
if (CallbackBridge.isGrabbing()) {
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
} else {
CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown ? 1 : 0, CallbackBridge.mouseX, CallbackBridge.mouseY);
setRightOverride(isDown);
}
break;
}
}
return false;
}
};
ControlData[] specialButtons = ControlData.getSpecialButtons();
specialButtons[0].specialButtonListener
= specialButtons[1].specialButtonListener
= specialButtons[4].specialButtonListener
= mClickListener;
specialButtons[2].specialButtonListener
= specialButtons[3].specialButtonListener
= specialButtons[5].specialButtonListener
= mTouchListener;
mControlLayout = findViewById(R.id.main_control_layout);
mControlLayout.setModifiable(false);
try {
mControlLayout.loadLayout(LauncherPreferences.PREF_DEFAULTCTRL_PATH);
} catch (Throwable th) {
Tools.showError(this, th);
}
// toggleGui(null);
onClick(toggleControlButton);
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.control_togglecontrol: {
/*
switch(overlayView.getVisibility()){
case View.VISIBLE: overlayView.setVisibility(View.GONE);
break;
case View.GONE: overlayView.setVisibility(View.VISIBLE);
}
*/
for (Button button : controlButtons) {
button.setVisibility(button.getVisibility() == View.GONE ? View.VISIBLE : View.GONE);
}
zoomButton.setVisibility((zoomButton.getVisibility() == View.GONE && mVersionInfo.optifineLib != null) ? View.VISIBLE : View.GONE);
}
}
}
public boolean onTouch(View v, MotionEvent e) {
boolean isDown;
switch (e.getActionMasked()) {
case MotionEvent.ACTION_DOWN: // 0
case MotionEvent.ACTION_POINTER_DOWN: // 5
isDown = true;
break;
case MotionEvent.ACTION_UP: // 1
case MotionEvent.ACTION_CANCEL: // 3
case MotionEvent.ACTION_POINTER_UP: // 6
isDown = false;
break;
default:
return false;
}
switch (v.getId()) {
case R.id.control_up: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_W, 0, isDown); break;
case R.id.control_left: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_A, 0, isDown); break;
case R.id.control_down: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_S, 0, isDown); break;
case R.id.control_right: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_D, 0, isDown); break;
case R.id.control_jump: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_SPACE, 0, isDown); break;
case R.id.control_primary: sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown); break;
case R.id.control_secondary:
if (CallbackBridge.isGrabbing()) {
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
} else {
/*
if (!isDown) {
CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, CallbackBridge.mouseX, CallbackBridge.mouseY);
}
*/
CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown ? 1 : 0, CallbackBridge.mouseX, CallbackBridge.mouseY);
setRightOverride(isDown);
} break;
case R.id.control_debug: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_F3, 0, isDown); break;
case R.id.control_shift: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_LEFT_SHIFT, 0, isDown); break;
case R.id.control_inventory: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_E, 0, isDown); break;
case R.id.control_talk: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_T, 0, isDown); break;
case R.id.control_keyboard: showKeyboard(); break;
case R.id.control_thirdperson: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_F5, 0, isDown); break;
case R.id.control_zoom: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_C, 0, isDown); break;
case R.id.control_listplayers: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_TAB, 0, isDown); break;
}
return false;
}
private Button findButton(int id) {
Button button = (Button) findViewById(id);
button.setOnTouchListener(this);
button.setFocusable(false);
button.setFocusableInTouchMode(false);
return button;
mControlLayout.toggleControlVisible();
}
}

View file

@ -229,7 +229,7 @@ public class MinecraftDownloaderTask extends AsyncTask<String, String, Throwable
jvmArgs.add("-Xms128M");
jvmArgs.add("-Xmx1G");
*/
Intent mainIntent = new Intent(mActivity, CustomCtrlMainActivity.class /* MainActivity.class */);
Intent mainIntent = new Intent(mActivity, MainActivity.class /* MainActivity.class */);
// mainIntent.addFlags(Intent.FLAG_ACTIVITY_LAUNCH_ADJACENT);
mainIntent.addFlags(Intent.FLAG_ACTIVITY_NEW_DOCUMENT);
mainIntent.addFlags(Intent.FLAG_ACTIVITY_MULTIPLE_TASK);

View file

@ -1,318 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_alignParentRight="true"
android:id="@+id/main_drawer_options"
android:keepScreenOn="true">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/main_log_behind_GL"
android:maxLines="100"/>
<net.kdt.pojavlaunch.MinecraftGLView
android:id="@+id/main_game_render_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:id="@+id/main_touchpad"
android:visibility="gone">
<ImageView
android:layout_height="27dp"
android:layout_width="18dp"
android:src="@drawable/mouse_pointer"
android:id="@+id/main_mouse_pointer"/>
</LinearLayout>
<Button
android:id="@+id/control_debug"
android:background="@drawable/control_button"
android:layout_width="wrap_content"
android:layout_height="30.0dip"
android:layout_marginLeft="2.0dip"
android:layout_marginTop="2.0dip"
android:text="@string/control_debug"
android:layout_alignParentLeft="true"
android:layout_alignParentTop="true"
android:layout_marginRight="2dp"/>
<Button
android:id="@+id/control_talk"
android:background="@drawable/control_button"
android:layout_width="wrap_content"
android:layout_height="30.0dip"
android:layout_marginTop="2.0dip"
android:layout_marginRight="2.0dip"
android:text="@string/control_chat"
android:layout_toRightOf="@id/control_debug"
android:layout_alignParentTop="true"/>
<Button
android:id="@+id/control_keyboard"
android:background="@drawable/control_button"
android:layout_width="wrap_content"
android:layout_height="30.0dip"
android:layout_marginTop="2.0dip"
android:layout_marginRight="2.0dip"
android:text="@string/control_keyboard"
android:layout_toRightOf="@id/control_talk"
android:layout_alignParentTop="true"/>
<Button
android:id="@+id/control_thirdperson"
android:background="@drawable/control_button"
android:layout_width="wrap_content"
android:layout_height="30.0dip"
android:layout_marginLeft="2.0dip"
android:layout_marginTop="2.0dip"
android:layout_marginRight="2.0dip"
android:text="@string/control_thirdperson"
android:layout_below="@id/control_debug"
android:layout_alignParentLeft="true"/>
<Button
android:background="@drawable/control_button"
android:layout_width="wrap_content"
android:layout_height="30.0dip"
android:layout_marginTop="2.0dip"
android:layout_marginRight="2.0dip"
android:text="@string/control_zoom"
android:layout_below="@id/control_talk"
android:layout_toRightOf="@id/control_thirdperson"
android:id="@+id/control_zoom"/>
<Button
android:background="@drawable/control_button"
android:layout_width="wrap_content"
android:layout_height="30.0dip"
android:layout_marginTop="2.0dip"
android:layout_marginRight="2.0dip"
android:text="@string/control_listplayers"
android:layout_toRightOf="@id/control_keyboard"
android:id="@+id/control_listplayers"/>
<Button
android:textSize="32.0sp"
android:id="@+id/control_down"
android:background="@drawable/control_button"
android:layout_width="50.0dip"
android:layout_height="50.0dip"
android:layout_marginLeft="68.0dip"
android:layout_marginBottom="14.0dip"
android:text="@string/control_down"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
<Button
android:textSize="32.0sp"
android:id="@+id/control_up"
android:background="@drawable/control_button"
android:layout_width="50.0dip"
android:layout_height="50.0dip"
android:layout_marginLeft="68.0dip"
android:layout_marginBottom="122.0dip"
android:text="@string/control_up"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
<Button
android:textSize="32.0sp"
android:id="@+id/control_left"
android:background="@drawable/control_button"
android:layout_width="50.0dip"
android:layout_height="50.0dip"
android:layout_marginLeft="14.0dip"
android:layout_marginBottom="68.0dip"
android:text="@string/control_left"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
<Button
android:textSize="32.0sp"
android:id="@+id/control_right"
android:background="@drawable/control_button"
android:layout_width="50.0dip"
android:layout_height="50.0dip"
android:layout_marginLeft="122.0dip"
android:layout_marginBottom="68.0dip"
android:text="@string/control_right"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
<Button
android:id="@+id/control_jump"
android:background="@drawable/control_button"
android:layout_width="50.0dip"
android:layout_height="50.0dip"
android:layout_marginRight="68.0dip"
android:layout_marginBottom="68.0dip"
android:text="@string/control_jump"
android:layout_alignParentBottom="true"
android:layout_alignParentRight="true"/>
<Button
android:textSize="16.0sp"
android:id="@+id/control_primary"
android:background="@drawable/control_button"
android:layout_width="50.0dip"
android:layout_height="50.0dip"
android:layout_marginLeft="14.0dip"
android:layout_marginBottom="122.0dip"
android:text="@string/control_primary"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
<Button
android:textSize="16.0sp"
android:id="@+id/control_secondary"
android:background="@drawable/control_button"
android:layout_width="50.0dip"
android:layout_height="50.0dip"
android:layout_marginLeft="122.0dip"
android:layout_marginBottom="122.0dip"
android:text="@string/control_secondary"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
<Button
android:textSize="20.0sp"
android:id="@+id/control_shift"
android:background="@drawable/control_button"
android:layout_width="50.0dip"
android:layout_height="50.0dip"
android:layout_marginLeft="68.0dip"
android:layout_marginBottom="68.0dip"
android:text="@string/control_shift"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
<Button
android:textSize="16.0sp"
android:id="@+id/control_inventory"
android:background="@drawable/control_button"
android:layout_width="50.0dip"
android:layout_height="50.0dip"
android:layout_marginLeft="122.0dip"
android:layout_marginBottom="14.0dip"
android:text="@string/control_inventory"
android:layout_alignParentLeft="true"
android:layout_alignParentBottom="true"/>
<Button
android:layout_height="30dp"
android:layout_width="wrap_content"
android:text="@string/control_mouseoff"
android:layout_below="@id/control_debug"
android:layout_alignParentRight="true"
android:background="@drawable/control_button"
android:layout_marginRight="2dp"
android:layout_marginTop="2dp"
android:onClick="toggleMouse"
android:layout_alignParentTop="true"
android:id="@+id/control_mouse_toggle"/>
<Button
android:background="@drawable/control_button"
android:layout_width="50dp"
android:layout_height="50dp"
android:text="@string/control_toggle"
android:layout_marginBottom="14dp"
android:layout_marginLeft="14dp"
android:layout_gravity="bottom"
android:layout_alignParentBottom="true"
android:id="@+id/control_togglecontrol"/>
</RelativeLayout>
<LinearLayout
android:id="@+id/content_log_layout"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:visibility="gone"
android:orientation="vertical">
<RelativeLayout
android:layout_height="84px"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:background="#555555">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/control_viewout"
android:paddingLeft="30px"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_centerVertical="true"/>
<ImageView
android:layout_height="84px"
android:layout_width="84px"
android:src="@android:drawable/ic_delete"
android:onClick="closeLogOutput"
android:layout_alignParentRight="true"
android:id="@+id/content_log_close_button"/>
<ToggleButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toLeftOf="@id/content_log_close_button"
android:id="@+id/content_log_toggle_log"/>
</RelativeLayout>
<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/content_log_scroll"
android:alpha="0.8"
android:background="#000000">
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textIsSelectable="true"/>
</ScrollView>
</LinearLayout>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="PointerCapture debug"
android:id="@+id/content_text_debug"
android:visibility="gone"/>
</FrameLayout>
<android.support.design.widget.NavigationView
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:fitsSystemWindows="false"
app:menu="@menu/menu_runopt"
android:id="@+id/main_navigation_view"/>
</android.support.v4.widget.DrawerLayout>

View file

@ -1,114 +1,119 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v4.widget.DrawerLayout
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_alignParentRight="true"
android:id="@+id/main_drawer_options"
android:keepScreenOn="true">
xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:layout_alignParentRight="true"
android:id="@+id/main_drawer_options"
android:keepScreenOn="true">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<FrameLayout
android:id="@+id/content_frame"
android:layout_width="match_parent"
android:layout_height="match_parent">
<net.kdt.pojavlaunch.customcontrols.ControlLayout
android:id="@+id/main_control_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<net.kdt.pojavlaunch.customcontrols.ControlLayout
android:id="@+id/main_control_layout"
android:layout_width="match_parent"
android:layout_height="match_parent">
<net.kdt.pojavlaunch.MinecraftGLView
android:id="@+id/main_game_render_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<net.kdt.pojavlanch.CapturedEditText
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/main_key_handler"/>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:id="@+id/main_touchpad"
android:visibility="gone">
<net.kdt.pojavlaunch.MinecraftGLView
android:id="@+id/main_game_render_view"
android:layout_width="fill_parent"
android:layout_height="fill_parent"/>
<ImageView
android:layout_height="27dp"
android:layout_width="18dp"
android:src="@drawable/mouse_pointer"
android:id="@+id/main_mouse_pointer"/>
<LinearLayout
android:layout_height="match_parent"
android:layout_width="match_parent"
android:orientation="vertical"
android:id="@+id/main_touchpad"
android:visibility="gone">
</LinearLayout>
</net.kdt.pojavlaunch.customcontrols.ControlLayout>
<LinearLayout
android:id="@+id/content_log_layout"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:visibility="gone"
android:orientation="vertical">
<ImageView
android:layout_height="27dp"
android:layout_width="18dp"
android:src="@drawable/mouse_pointer"
android:id="@+id/main_mouse_pointer"/>
<RelativeLayout
android:layout_height="84px"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:background="#555555">
</LinearLayout>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/control_viewout"
android:paddingLeft="30px"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_centerVertical="true"/>
</net.kdt.pojavlaunch.customcontrols.ControlLayout>
<ImageView
android:layout_height="84px"
android:layout_width="84px"
android:src="@android:drawable/ic_delete"
android:onClick="closeLogOutput"
android:layout_alignParentRight="true"
android:id="@+id/content_log_close_button"/>
<LinearLayout
android:id="@+id/content_log_layout"
android:layout_height="match_parent"
android:layout_width="match_parent"
android:visibility="gone"
android:orientation="vertical">
<ToggleButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toLeftOf="@id/content_log_close_button"
android:id="@+id/content_log_toggle_log"/>
<RelativeLayout
android:layout_height="84px"
android:layout_width="match_parent"
android:gravity="center_vertical"
android:background="#555555">
</RelativeLayout>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="@string/control_viewout"
android:paddingLeft="30px"
android:textAppearance="?android:attr/textAppearanceMedium"
android:layout_centerVertical="true"/>
<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/content_log_scroll"
android:alpha="0.8"
android:background="#000000">
<ImageView
android:layout_height="84px"
android:layout_width="84px"
android:src="@android:drawable/ic_delete"
android:onClick="closeLogOutput"
android:layout_alignParentRight="true"
android:id="@+id/content_log_close_button"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textIsSelectable="true"/>
<ToggleButton
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:layout_toLeftOf="@id/content_log_close_button"
android:id="@+id/content_log_toggle_log"/>
</ScrollView>
</RelativeLayout>
</LinearLayout>
<ScrollView
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/content_log_scroll"
android:alpha="0.8"
android:background="#000000">
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="PointerCapture debug"
android:id="@+id/content_text_debug"
android:visibility="gone"/>
<TextView
android:layout_height="wrap_content"
android:layout_width="match_parent"
android:textIsSelectable="true"/>
</FrameLayout>
</ScrollView>
<android.support.design.widget.NavigationView
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:fitsSystemWindows="false"
app:menu="@menu/menu_runopt"
android:id="@+id/main_navigation_view"/>
</LinearLayout>
<TextView
android:layout_height="wrap_content"
android:layout_width="wrap_content"
android:text="PointerCapture debug"
android:id="@+id/content_text_debug"
android:visibility="gone"/>
</FrameLayout>
<android.support.design.widget.NavigationView
android:layout_width="200dp"
android:layout_height="match_parent"
android:layout_gravity="right"
android:fitsSystemWindows="false"
app:menu="@menu/menu_runopt"
android:id="@+id/main_navigation_view"/>
</android.support.v4.widget.DrawerLayout>