mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2025-09-17 00:29:50 -04:00
Changes
- Removed unused class ShellProcessOperation.java - Correctly implemented touching 2 fingers for scrolling.
This commit is contained in:
parent
2a8569146c
commit
df41a166bc
@ -407,7 +407,6 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
} else {
|
||||
switch (e.getActionMasked()) {
|
||||
case MotionEvent.ACTION_DOWN: // 0
|
||||
case MotionEvent.ACTION_POINTER_DOWN: // 5
|
||||
CallbackBridge.sendPrepareGrabInitialPos();
|
||||
|
||||
isTouchInHotbar = hudKeyHandled != -1;
|
||||
@ -439,7 +438,6 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_UP: // 1
|
||||
case MotionEvent.ACTION_POINTER_UP: // 6
|
||||
case MotionEvent.ACTION_CANCEL: // 3
|
||||
if (!isTouchInHotbar) {
|
||||
CallbackBridge.mouseX = mouse_x;
|
||||
@ -459,7 +457,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
if (isTouchInHotbar && Math.abs(hotbarX - mouse_x) < fingerStillThreshold && Math.abs(hotbarY - mouse_y) < fingerStillThreshold) {
|
||||
sendKeyPress(hudKeyHandled, 0, false);
|
||||
} else if (!triggeredLeftMouseButton && Math.abs(initialX - mouse_x) < fingerStillThreshold && Math.abs(initialY - mouse_y) < fingerStillThreshold) {
|
||||
if(!LauncherPreferences.PREF_DISABLE_GESTURES) {
|
||||
if (!LauncherPreferences.PREF_DISABLE_GESTURES) {
|
||||
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, true);
|
||||
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, false);
|
||||
}
|
||||
@ -477,35 +475,25 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
}
|
||||
|
||||
break;
|
||||
/*
|
||||
|
||||
case MotionEvent.ACTION_POINTER_DOWN: // 5
|
||||
CallbackBridge.sendScroll(x - scrollInitialX, y - scrollInitialY);
|
||||
scrollInitialX = x;
|
||||
scrollInitialY = y;
|
||||
scrollInitialX = CallbackBridge.mouseX;
|
||||
scrollInitialY = CallbackBridge.mouseY;
|
||||
break;
|
||||
|
||||
case MotionEvent.ACTION_POINTER_UP: // 6
|
||||
scrollInitialX = x;
|
||||
scrollInitialY = y;
|
||||
break;
|
||||
*/
|
||||
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (!isTouchInHotbar) {
|
||||
if (!CallbackBridge.isGrabbing() && e.getPointerCount() == 2 && !LauncherPreferences.PREF_DISABLE_GESTURES) {
|
||||
CallbackBridge.sendScroll(CallbackBridge.mouseX - scrollInitialX, CallbackBridge.mouseY - scrollInitialY);
|
||||
scrollInitialX = CallbackBridge.mouseX;
|
||||
scrollInitialY = CallbackBridge.mouseY;
|
||||
} else if (!isTouchInHotbar) {
|
||||
CallbackBridge.mouseX = mouse_x;
|
||||
CallbackBridge.mouseY = mouse_y;
|
||||
|
||||
CallbackBridge.sendCursorPos(mouse_x, mouse_y);
|
||||
|
||||
if (!CallbackBridge.isGrabbing()) {
|
||||
/*
|
||||
CallbackBridge.sendMouseKeycode(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT, 0, isLeftMouseDown);
|
||||
CallbackBridge.sendMouseKeycode(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, 0, isRightMouseDown);
|
||||
*/
|
||||
|
||||
// CallbackBridge.sendScroll(mouse_x - scrollInitialX, mouse_y - scrollInitialY);
|
||||
scrollInitialX = mouse_x;
|
||||
scrollInitialY = mouse_y;
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
@ -1,85 +0,0 @@
|
||||
package net.kdt.pojavlaunch;
|
||||
|
||||
import java.io.*;
|
||||
import android.app.*;
|
||||
|
||||
public class ShellProcessOperation
|
||||
{
|
||||
private OnPrintListener listener;
|
||||
private Process process;
|
||||
|
||||
public ShellProcessOperation(OnPrintListener listener) throws IOException {
|
||||
this.listener = listener;
|
||||
process = Runtime.getRuntime().exec("/system/bin/sh");
|
||||
}
|
||||
|
||||
public ShellProcessOperation(OnPrintListener listener, String command) throws IOException {
|
||||
this.listener = listener;
|
||||
process = Runtime.getRuntime().exec(
|
||||
command
|
||||
); //"/system/bin/sh -c \"" + command + "\"");
|
||||
}
|
||||
|
||||
public void writeToProcess(String[] cmdArr) throws IOException {
|
||||
StringBuilder sb = new StringBuilder();
|
||||
for (String cmd : cmdArr) {sb.append(cmd + " ");}
|
||||
writeToProcess(sb.toString());
|
||||
}
|
||||
|
||||
public void writeToProcess(String cmd) throws IOException {
|
||||
// listener.onPrintLine(" > " + cmd + "\n");
|
||||
|
||||
DataOutputStream os = new DataOutputStream(process.getOutputStream());
|
||||
os.writeBytes(cmd + "\n");
|
||||
os.flush();
|
||||
}
|
||||
|
||||
public void initInputStream(Activity ctx) {
|
||||
ctx.runOnUiThread(new Runnable(){
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
printStream(process.getInputStream());
|
||||
printStream(process.getErrorStream());
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public int exitCode() {
|
||||
return process.exitValue();
|
||||
}
|
||||
|
||||
public int waitFor() throws InterruptedException {
|
||||
return process.waitFor();
|
||||
}
|
||||
|
||||
public int exit() throws InterruptedException, IOException {
|
||||
writeToProcess("exit");
|
||||
return waitFor();
|
||||
}
|
||||
|
||||
private void printStream(final InputStream stream) {
|
||||
new Thread(new Runnable(){
|
||||
|
||||
@Override
|
||||
public void run()
|
||||
{
|
||||
try {
|
||||
BufferedReader buffStream = new BufferedReader(new InputStreamReader(stream));
|
||||
String line = null;
|
||||
while ((line = buffStream.readLine()) != null) {
|
||||
listener.onPrintLine(line + "\n");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
listener.onPrintLine("PrintStream error: " + e.getMessage() + "\n");
|
||||
}
|
||||
}
|
||||
}).start();
|
||||
}
|
||||
|
||||
public static interface OnPrintListener {
|
||||
public void onPrintLine(String text);
|
||||
}
|
||||
}
|
@ -214,7 +214,7 @@ public class JREUtils
|
||||
LD_LIBRARY_PATH = ldLibraryPath.toString();
|
||||
}
|
||||
|
||||
public static void setJavaEnvironment(LoggableActivity ctx, @Nullable ShellProcessOperation shell) throws Throwable {
|
||||
public static void setJavaEnvironment(LoggableActivity ctx) throws Throwable {
|
||||
Map<String, String> envMap = new ArrayMap<>();
|
||||
envMap.put("JAVA_HOME", Tools.DIR_HOME_JRE);
|
||||
envMap.put("HOME", Tools.DIR_GAME_NEW);
|
||||
@ -261,15 +261,7 @@ public class JREUtils
|
||||
}
|
||||
}
|
||||
for (Map.Entry<String, String> env : envMap.entrySet()) {
|
||||
try {
|
||||
if (shell == null) {
|
||||
Os.setenv(env.getKey(), env.getValue(), true);
|
||||
} else {
|
||||
shell.writeToProcess("export " + env.getKey() + "=" + env.getValue());
|
||||
}
|
||||
} catch (Throwable th) {
|
||||
ctx.appendlnToLog(Log.getStackTraceString(th));
|
||||
}
|
||||
Os.setenv(env.getKey(), env.getValue(), true);
|
||||
}
|
||||
|
||||
if (shell == null) {
|
||||
@ -312,7 +304,7 @@ public class JREUtils
|
||||
ctx.appendlnToLog("Executing JVM: \"" + sbJavaArgs.toString() + "\"");
|
||||
*/
|
||||
|
||||
setJavaEnvironment(ctx, null);
|
||||
setJavaEnvironment(ctx);
|
||||
initJavaRuntime();
|
||||
chdir(Tools.DIR_GAME_NEW);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user