Use old way reader

This commit is contained in:
khanhduytran0 2020-09-26 20:35:22 +07:00
parent a125982d42
commit 20eafa0a64
2 changed files with 29 additions and 49 deletions

View File

@ -43,20 +43,20 @@ public class JREUtils
Log.i("jrelog-logcat","Starting logcat"); Log.i("jrelog-logcat","Starting logcat");
Process p = new ProcessBuilder().command("logcat", /* "-G", "1mb", */ "-v", "brief", "*:S").redirectErrorStream(true).start(); Process p = new ProcessBuilder().command("logcat", /* "-G", "1mb", */ "-v", "brief", "*:S").redirectErrorStream(true).start();
// idk which better, but 512bytes may make a bug that printf(\n) in a single line // idk which better, both have a bug that printf(\n) in a single line
/*
BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream())); BufferedReader reader = new BufferedReader(new InputStreamReader(p.getInputStream()));
String line; String line;
while ((line = reader.readLine()) != null) { while ((line = reader.readLine()) != null) {
act.appendlnToLog(line); act.appendlnToLog(line);
} }
*/
/*
byte[] buf = new byte[512]; byte[] buf = new byte[512];
int len; int len;
while ((len = p.getInputStream().read(buf)) != -1) { while ((len = p.getInputStream().read(buf)) != -1) {
appendToLog(new String(buf, 0, len)); act.appendToLog(new String(buf, 0, len));
} }
*/
} catch (IOException e) { } catch (IOException e) {
Log.e("jrelog-logcat", "IOException on logging thread"); Log.e("jrelog-logcat", "IOException on logging thread");
e.printStackTrace(); e.printStackTrace();

View File

@ -433,13 +433,11 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
CallbackBridge.mouseLeft = true; CallbackBridge.mouseLeft = true;
} }
if (CallbackBridge.isGrabbing()) {
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 1, x, y, 0, System.nanoTime()); CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 1, x, y, 0, System.nanoTime());
initialX = x; initialX = x;
initialY = y; initialY = y;
theHandler.sendEmptyMessageDelayed(MainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK, LauncherPreferences.PREF_LONGPRESS_TRIGGER); theHandler.sendEmptyMessageDelayed(MainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK, LauncherPreferences.PREF_LONGPRESS_TRIGGER);
} }
}
break; break;
case MotionEvent.ACTION_UP: // 1 case MotionEvent.ACTION_UP: // 1
case MotionEvent.ACTION_CANCEL: // 3 case MotionEvent.ACTION_CANCEL: // 3
@ -455,7 +453,6 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
} }
} }
if (CallbackBridge.isGrabbing()) {
// System.out.println((String) ("[Math.abs(" + initialX + " - " + x + ") = " + Math.abs(initialX - x) + "] < " + fingerStillThreshold)); // System.out.println((String) ("[Math.abs(" + initialX + " - " + x + ") = " + Math.abs(initialX - x) + "] < " + fingerStillThreshold));
// System.out.println((String) ("[Math.abs(" + initialY + " - " + y + ") = " + Math.abs(initialY - y) + "] < " + fingerStillThreshold)); // System.out.println((String) ("[Math.abs(" + initialY + " - " + y + ") = " + Math.abs(initialY - y) + "] < " + fingerStillThreshold));
if (isTouchInHotbar && Math.abs(hotbarX - x) < fingerStillThreshold && Math.abs(hotbarY - y) < fingerStillThreshold) { if (isTouchInHotbar && Math.abs(hotbarX - x) < fingerStillThreshold && Math.abs(hotbarY - y) < fingerStillThreshold) {
@ -474,7 +471,6 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_Q, 0, false); sendKeyPress(LWJGLGLFWKeycode.GLFW_KEY_Q, 0, false);
theHandler.removeMessages(MSG_DROP_ITEM_BUTTON_CHECK); theHandler.removeMessages(MSG_DROP_ITEM_BUTTON_CHECK);
} }
}
break; break;
default: default:
@ -1036,22 +1032,6 @@ public class MainActivity extends LoggableActivity implements OnTouchListener, O
}); });
} }
public void handleMessage(Message msg) {
switch (msg.what) {
case MainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK /*1028*/:
int x = CallbackBridge.mouseX;
int y = CallbackBridge.mouseY;
if (CallbackBridge.isGrabbing() && Math.abs(initialX - x) < fingerStillThreshold && Math.abs(initialY - y) < fingerStillThreshold) {
triggeredLeftMouseButton = true;
sendMouseButton(0, true);
return;
}
return;
default:
return;
}
}
public String getMinecraftOption(String key) { public String getMinecraftOption(String key) {
try { try {
String[] options = Tools.read(Tools.MAIN_PATH + "/options.txt").split("\n"); String[] options = Tools.read(Tools.MAIN_PATH + "/options.txt").split("\n");