[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:name=".MainActivity"
android:configChanges="keyboardHidden|orientation|screenSize|keyboard|navigation"/> 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 <activity
android:screenOrientation="sensorLandscape" android:screenOrientation="sensorLandscape"
android:name=".prefs.LauncherPreferenceActivity" android:name=".prefs.LauncherPreferenceActivity"

View file

@ -172,6 +172,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
errorAt = null; errorAt = null;
*/ */
if (properties.isDynamicBtn) {
int errorAt = 0; int errorAt = 0;
try { try {
properties.insertDynamicPos(editDynamicX.getText().toString()); properties.insertDynamicPos(editDynamicX.getText().toString());
@ -183,6 +184,7 @@ public class ActionPopupWindow extends PinnedPopupWindow implements OnClickListe
return; return;
} }
}
if (spinnerKeycode.getSelectedItemPosition() < specialArr.length) { if (spinnerKeycode.getSelectedItemPosition() < specialArr.length) {
properties.keycode = spinnerKeycode.getSelectedItemPosition() - specialArr.length; properties.keycode = spinnerKeycode.getSelectedItemPosition() - specialArr.length;

View file

@ -168,14 +168,14 @@ public class AndroidLWJGLKeycode {
return androidKeyNameArray; 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()) { for (Map.Entry<Integer, Integer> perKey : androidToLwjglMap.entrySet()) {
if (i == 1 && (keyEvent.getSource() == InputDevice.SOURCE_MOUSE)) { if (i == 1 && (keyEvent.getSource() == InputDevice.SOURCE_MOUSE)) {
// Right mouse detection // Right mouse detection
mainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, true); BaseMainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
mainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, false); // BaseMainActivity.sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, false);
} else if (perKey.getKey() == i) { } 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 { try {
if ((int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && !CallbackBridge.isGrabbing()) { 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) { } catch (Throwable th) {
th.printStackTrace(); th.printStackTrace();
} }
if (isBackspaceAfterChar && (int) keyEvent.getDisplayLabel() != KeyEvent.KEYCODE_UNKNOWN && !CallbackBridge.isGrabbing() && i != KeyEvent.KEYCODE_DEL) { 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

@ -74,6 +74,8 @@ public class BaseMainActivity extends LoggableActivity {
private DrawerLayout drawerLayout; private DrawerLayout drawerLayout;
private NavigationView navDrawer; private NavigationView navDrawer;
private CapturedEditText mKeyHandlerView;
private LinearLayout contentLog; private LinearLayout contentLog;
private TextView textLog; private TextView textLog;
private ScrollView contentScroll; private ScrollView contentScroll;
@ -196,6 +198,11 @@ public class BaseMainActivity extends LoggableActivity {
// toggleGui(null); // toggleGui(null);
this.drawerLayout.closeDrawers(); this.drawerLayout.closeDrawers();
mKeyHandlerView = findViewById(R.id.main_key_handler);
mKeyHandlerView.setFocusable(true);
mKeyHandlerView.setFocusableInTouchMode(true);
mKeyHandlerView.requestFocus();
AndroidLWJGLKeycode.isBackspaceAfterChar = true; // mVersionInfo.minimumLauncherVersion >= 18; AndroidLWJGLKeycode.isBackspaceAfterChar = true; // mVersionInfo.minimumLauncherVersion >= 18;
placeMouseAt(CallbackBridge.windowWidth / 2, CallbackBridge.windowHeight / 2); placeMouseAt(CallbackBridge.windowWidth / 2, CallbackBridge.windowHeight / 2);
@ -712,50 +719,6 @@ public class BaseMainActivity extends LoggableActivity {
e.printStackTrace(); e.printStackTrace();
Tools.showError(this, e, true); 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; //private Dialog menuDial;
@ -1042,6 +1005,8 @@ public class BaseMainActivity extends LoggableActivity {
public void onBackPressed() { public void onBackPressed() {
// Prevent back // Prevent back
// Catch back as Esc keycode at another place // Catch back as Esc keycode at another place
// sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_ESCAPE);
} }
public void hideKeyboard() { public void hideKeyboard() {
@ -1086,8 +1051,8 @@ public class BaseMainActivity extends LoggableActivity {
sendKeyPress(keyCode, 0, false); sendKeyPress(keyCode, 0, false);
} }
private boolean isLeftMouseDown, isRightMouseDown; private static boolean isLeftMouseDown, isRightMouseDown;
public void sendMouseButton(int button, boolean status) { public static void sendMouseButton(int button, boolean status) {
// TODO implement this method!!! // TODO implement this method!!!
// CallbackBridge.setMouseButtonInGrabMode((byte) button, status ? (byte) 1 : (byte) 0); // CallbackBridge.setMouseButtonInGrabMode((byte) button, status ? (byte) 1 : (byte) 0);
// or // 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,77 +7,45 @@ import android.widget.*;
import net.kdt.pojavlaunch.customcontrols.*; import net.kdt.pojavlaunch.customcontrols.*;
import net.kdt.pojavlaunch.prefs.*; import net.kdt.pojavlaunch.prefs.*;
import org.lwjgl.glfw.*; import org.lwjgl.glfw.*;
import java.io.*;
import com.google.gson.*;
public class MainActivity extends BaseMainActivity implements OnClickListener, OnTouchListener { public class MainActivity extends BaseMainActivity {
private Button upButton, private ControlLayout mControlLayout;
downButton, leftButton,
rightButton, jumpButton,
primaryButton, secondaryButton,
debugButton, shiftButton,
keyboardButton, inventoryButton,
talkButton, thirdPersonButton,
zoomButton, listPlayersButton,
toggleControlButton;
private Button[] controlButtons; private View.OnClickListener mClickListener;
private View.OnTouchListener mTouchListener;
@Override @Override
public void onCreate(Bundle savedInstanceState) { public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState); super.onCreate(savedInstanceState);
initLayout(R.layout.main); initLayout(R.layout.main_with_customctrl);
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
};
this.toggleControlButton.setOnClickListener(this);
this.zoomButton.setVisibility(mVersionInfo.optifineLib == null ? View.GONE : View.VISIBLE);
// toggleGui(null);
onClick(toggleControlButton);
}
mClickListener = new View.OnClickListener(){
@Override @Override
public void onClick(View view) { public void onClick(View view) {
switch (view.getId()) { if (view instanceof ControlButton) {
case R.id.control_togglecontrol: { ControlButton button = (ControlButton) view;
/* switch (button.getProperties().keycode) {
switch(overlayView.getVisibility()){ case ControlData.SPECIALBTN_KEYBOARD:
case View.VISIBLE: overlayView.setVisibility(View.GONE); showKeyboard();
break; break;
case View.GONE: overlayView.setVisibility(View.VISIBLE);
}
*/
for (Button button : controlButtons) { case ControlData.SPECIALBTN_TOGGLECTRL:
button.setVisibility(button.getVisibility() == View.GONE ? View.VISIBLE : View.GONE); mControlLayout.toggleControlVisible();
} break;
zoomButton.setVisibility((zoomButton.getVisibility() == View.GONE && mVersionInfo.optifineLib != null) ? View.VISIBLE : View.GONE); case ControlData.SPECIALBTN_VIRTUALMOUSE:
toggleMouse(button);
break;
} }
} }
} }
};
public boolean onTouch(View v, MotionEvent e) { mTouchListener = new View.OnTouchListener(){
@Override
public boolean onTouch(View view, MotionEvent e) {
boolean isDown; boolean isDown;
switch (e.getActionMasked()) { switch (e.getActionMasked()) {
case MotionEvent.ACTION_DOWN: // 0 case MotionEvent.ACTION_DOWN: // 0
@ -93,45 +61,53 @@ public class MainActivity extends BaseMainActivity implements OnClickListener, O
return false; return false;
} }
switch (v.getId()) { if (view instanceof ControlButton) {
case R.id.control_up: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_W, 0, isDown); break; ControlButton button = (ControlButton) view;
case R.id.control_left: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_A, 0, isDown); break; switch (button.getProperties().keycode) {
case R.id.control_down: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_S, 0, isDown); break; case ControlData.SPECIALBTN_MOUSEPRI:
case R.id.control_right: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_D, 0, isDown); break; sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown);
case R.id.control_jump: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_SPACE, 0, isDown); break; break;
case R.id.control_primary: sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, isDown); break;
case R.id.control_secondary: case ControlData.SPECIALBTN_MOUSEMID:
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_MIDDLE, isDown);
break;
case ControlData.SPECIALBTN_MOUSESEC:
if (CallbackBridge.isGrabbing()) { if (CallbackBridge.isGrabbing()) {
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown); sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown);
} else { } 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); CallbackBridge.putMouseEventWithCoords(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, isDown ? 1 : 0, CallbackBridge.mouseX, CallbackBridge.mouseY);
setRightOverride(isDown); setRightOverride(isDown);
} break; }
case R.id.control_debug: sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_F3, 0, isDown); break; 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; return false;
} }
};
private Button findButton(int id) { ControlData[] specialButtons = ControlData.getSpecialButtons();
Button button = (Button) findViewById(id); specialButtons[0].specialButtonListener
button.setOnTouchListener(this); = specialButtons[1].specialButtonListener
button.setFocusable(false); = specialButtons[4].specialButtonListener
button.setFocusableInTouchMode(false); = mClickListener;
return button;
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

@ -229,7 +229,7 @@ public class MinecraftDownloaderTask extends AsyncTask<String, String, Throwable
jvmArgs.add("-Xms128M"); jvmArgs.add("-Xms128M");
jvmArgs.add("-Xmx1G"); 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_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);

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

@ -18,6 +18,11 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
<net.kdt.pojavlanch.CapturedEditText
android:layout_height="match_parent"
android:layout_width="match_parent"
android:id="@+id/main_key_handler"/>
<net.kdt.pojavlaunch.MinecraftGLView <net.kdt.pojavlaunch.MinecraftGLView
android:id="@+id/main_game_render_view" android:id="@+id/main_game_render_view"
android:layout_width="fill_parent" android:layout_width="fill_parent"