mirror of
https://github.com/AngelAuraMC/Amethyst-Android.git
synced 2026-04-20 09:37:07 -04:00
Merge branch 'v3_openjdk' of git@github.com:PojavLauncherTeam/PojavLauncher.git
This commit is contained in:
@@ -68,11 +68,6 @@
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:name=".MainActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|keyboard|navigation"/>
|
||||
|
||||
<activity
|
||||
android:screenOrientation="sensorLandscape"
|
||||
android:name=".prefs.LauncherPreferenceActivity"
|
||||
android:configChanges="keyboardHidden|orientation|screenSize|keyboard|navigation"/>
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
|
||||
@@ -106,6 +106,8 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
private boolean lastGrab = false;
|
||||
private boolean isExited = false;
|
||||
private boolean isLogAllow = false;
|
||||
private volatile int mouse_x, mouse_y;
|
||||
private boolean ignorePad = false;
|
||||
// private int navBarHeight = 40;
|
||||
|
||||
// private static Collection<? extends Provider.Service> rsaPkcs1List;
|
||||
@@ -277,7 +279,11 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
// and other input controls. In this case, you are only
|
||||
// interested in events where the touch position changed.
|
||||
// int index = event.getActionIndex();
|
||||
|
||||
if(CallbackBridge.isGrabbing()) {
|
||||
minecraftGLView.dispatchTouchEvent(MotionEvent.obtain(event));
|
||||
System.out.println("Transitioned event" + event.hashCode() + " to MinecraftGLView");
|
||||
return false;
|
||||
}
|
||||
int action = event.getActionMasked();
|
||||
|
||||
float x = event.getX();
|
||||
@@ -293,7 +299,8 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
float mouseY = mousePointer.getTranslationY();
|
||||
|
||||
if (gestureDetector.onTouchEvent(event)) {
|
||||
|
||||
mouse_x = (int) (mouseX * scaleFactor);
|
||||
mouse_y = (int) (mouseY * scaleFactor);
|
||||
CallbackBridge.sendCursorPos((int) (mouseX * scaleFactor), (int) (mouseY *scaleFactor));
|
||||
CallbackBridge.sendMouseKeycode(rightOverride ? LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT : LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_LEFT);
|
||||
if (!rightOverride) {
|
||||
@@ -312,8 +319,9 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
case MotionEvent.ACTION_MOVE: // 2
|
||||
mouseX = Math.max(0, Math.min(displayMetrics.widthPixels, mouseX + x - prevX));
|
||||
mouseY = Math.max(0, Math.min(displayMetrics.heightPixels, mouseY + y - prevY));
|
||||
mouse_x = (int) (mouseX * scaleFactor);
|
||||
mouse_y = (int) (mouseY * scaleFactor);
|
||||
placeMouseAt(mouseX, mouseY);
|
||||
|
||||
CallbackBridge.sendCursorPos((int) (mouseX * scaleFactor), (int) (mouseY *scaleFactor));
|
||||
/*
|
||||
if (!CallbackBridge.isGrabbing()) {
|
||||
@@ -340,7 +348,6 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
private boolean isTouchInHotbar = false;
|
||||
private int hotbarX, hotbarY;
|
||||
private int scrollInitialX, scrollInitialY;
|
||||
private int x,y;
|
||||
@Override
|
||||
public boolean onTouch(View p1, MotionEvent e)
|
||||
{
|
||||
@@ -353,6 +360,9 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
}
|
||||
}
|
||||
if (mptrIndex != -1) {
|
||||
if(CallbackBridge.isGrabbing()) {
|
||||
return false;
|
||||
}
|
||||
//handle mouse events by just sending the coords of the new point in touch event
|
||||
int x = (int) (e.getX(mptrIndex) * scaleFactor);
|
||||
int y = (int) (e.getY(mptrIndex) * scaleFactor);
|
||||
@@ -367,12 +377,12 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
/* int x = ((int) e.getX()) * scaleFactor;
|
||||
int y = ((int) e.getY()) * scaleFactor;*/
|
||||
if(e.getHistorySize() > 0 && CallbackBridge.isGrabbing()) {
|
||||
x += (int)(e.getX() - e.getHistoricalX(0));
|
||||
y += (int)(e.getY() - e.getHistoricalY(0));
|
||||
mouse_x += (int)(e.getX() - e.getHistoricalX(0));
|
||||
mouse_y += (int)(e.getY() - e.getHistoricalY(0));
|
||||
}
|
||||
if(!CallbackBridge.isGrabbing()) {
|
||||
x = (int) (e.getX() * scaleFactor);
|
||||
y = (int) (e.getY() * scaleFactor);
|
||||
mouse_x = (int) (e.getX() * scaleFactor);
|
||||
mouse_y = (int) (e.getY() * scaleFactor);
|
||||
}
|
||||
|
||||
int hudKeyHandled = handleGuiBar((int)e.getX(), (int)e.getY());
|
||||
@@ -380,7 +390,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
if (hudKeyHandled != -1) {
|
||||
sendKeyPress(hudKeyHandled);
|
||||
} else {
|
||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0,x,y);
|
||||
CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, mouse_x, mouse_y);
|
||||
if (!rightOverride) {
|
||||
CallbackBridge.mouseLeft = true;
|
||||
}
|
||||
@@ -399,9 +409,9 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
|
||||
theHandler.sendEmptyMessageDelayed(BaseMainActivity.MSG_DROP_ITEM_BUTTON_CHECK, LauncherPreferences.PREF_LONGPRESS_TRIGGER);
|
||||
} else {
|
||||
CallbackBridge.mouseX = x;
|
||||
CallbackBridge.mouseY = y;
|
||||
CallbackBridge.sendCursorPos(x, y);
|
||||
CallbackBridge.mouseX = mouse_x;
|
||||
CallbackBridge.mouseY = mouse_y;
|
||||
CallbackBridge.sendCursorPos(mouse_x, mouse_y);
|
||||
if (!rightOverride) {
|
||||
CallbackBridge.mouseLeft = true;
|
||||
}
|
||||
@@ -409,13 +419,13 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
if (CallbackBridge.isGrabbing()) {
|
||||
// It cause hold left mouse while moving camera
|
||||
// CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 1, x, y);
|
||||
initialX = x;
|
||||
initialY = y;
|
||||
initialX = mouse_x;
|
||||
initialY = mouse_y;
|
||||
theHandler.sendEmptyMessageDelayed(BaseMainActivity.MSG_LEFT_MOUSE_BUTTON_CHECK, LauncherPreferences.PREF_LONGPRESS_TRIGGER);
|
||||
}
|
||||
|
||||
scrollInitialX = x;
|
||||
scrollInitialY = y;
|
||||
scrollInitialX = mouse_x;
|
||||
scrollInitialY = mouse_y;
|
||||
}
|
||||
break;
|
||||
|
||||
@@ -423,12 +433,12 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
case MotionEvent.ACTION_POINTER_UP: // 6
|
||||
case MotionEvent.ACTION_CANCEL: // 3
|
||||
if (!isTouchInHotbar) {
|
||||
CallbackBridge.mouseX = x;
|
||||
CallbackBridge.mouseY = y;
|
||||
CallbackBridge.mouseX = mouse_x;
|
||||
CallbackBridge.mouseY = mouse_y;
|
||||
|
||||
// -TODO uncomment after fix wrong trigger
|
||||
// CallbackBridge.putMouseEventWithCoords(rightOverride ? (byte) 1 : (byte) 0, (byte) 0, x, y);
|
||||
CallbackBridge.sendCursorPos(x, y);
|
||||
CallbackBridge.sendCursorPos(mouse_x, mouse_y);
|
||||
if (!rightOverride) {
|
||||
CallbackBridge.mouseLeft = false;
|
||||
}
|
||||
@@ -437,9 +447,9 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
if (CallbackBridge.isGrabbing()) {
|
||||
// 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));
|
||||
if (isTouchInHotbar && Math.abs(hotbarX - x) < fingerStillThreshold && Math.abs(hotbarY - y) < fingerStillThreshold) {
|
||||
if (isTouchInHotbar && Math.abs(hotbarX - mouse_x) < fingerStillThreshold && Math.abs(hotbarY - mouse_y) < fingerStillThreshold) {
|
||||
sendKeyPress(hudKeyHandled, 0, false);
|
||||
} else if (!triggeredLeftMouseButton && Math.abs(initialX - x) < fingerStillThreshold && Math.abs(initialY - y) < fingerStillThreshold) {
|
||||
} else if (!triggeredLeftMouseButton && Math.abs(initialX - mouse_x) < fingerStillThreshold && Math.abs(initialY - mouse_y) < fingerStillThreshold) {
|
||||
if(!LauncherPreferences.PREF_DISABLE_GESTURES) {
|
||||
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, true);
|
||||
sendMouseButton(LWJGLGLFWKeycode.GLFW_MOUSE_BUTTON_RIGHT, false);
|
||||
@@ -472,19 +482,19 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
*/
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
if (!isTouchInHotbar) {
|
||||
CallbackBridge.mouseX = x;
|
||||
CallbackBridge.mouseY = y;
|
||||
CallbackBridge.mouseX = mouse_x;
|
||||
CallbackBridge.mouseY = mouse_y;
|
||||
|
||||
CallbackBridge.sendCursorPos(x, 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(x - scrollInitialX, y - scrollInitialY);
|
||||
scrollInitialX = x;
|
||||
scrollInitialY = y;
|
||||
CallbackBridge.sendScroll(mouse_x - scrollInitialX, mouse_y - scrollInitialY);
|
||||
scrollInitialX = mouse_x;
|
||||
scrollInitialY = mouse_y;
|
||||
}
|
||||
}
|
||||
break;
|
||||
@@ -590,7 +600,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
if (isAndroid8OrHigher()) {
|
||||
minecraftGLView.setDefaultFocusHighlightEnabled(false);
|
||||
minecraftGLView.setOnCapturedPointerListener(new View.OnCapturedPointerListener() {
|
||||
private int x, y;
|
||||
//private int x, y;
|
||||
private boolean debugErrored = false;
|
||||
|
||||
private String getMoving(float pos, boolean xOrY) {
|
||||
@@ -605,8 +615,12 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
|
||||
@Override
|
||||
public boolean onCapturedPointer (View view, MotionEvent e) {
|
||||
x += ((int) e.getX()) * scaleFactor;
|
||||
y += ((int) e.getY()) * scaleFactor;
|
||||
if(e.getHistorySize() > 0) {
|
||||
mouse_x += (int)(e.getX()*scaleFactor);
|
||||
mouse_y += (int)(e.getY()*scaleFactor);
|
||||
}
|
||||
CallbackBridge.mouseX = mouse_x;
|
||||
CallbackBridge.mouseY = mouse_y;
|
||||
if(!CallbackBridge.isGrabbing()){
|
||||
view.releasePointerCapture();
|
||||
}
|
||||
@@ -623,8 +637,8 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
builder.append("RawX=" + e.getRawX() + "\n");
|
||||
builder.append("RawY=" + e.getRawY() + "\n\n");
|
||||
|
||||
builder.append("XPos=" + x + "\n");
|
||||
builder.append("YPos=" + y + "\n\n");
|
||||
builder.append("XPos=" + mouse_x + "\n");
|
||||
builder.append("YPos=" + mouse_y + "\n\n");
|
||||
builder.append("MovingX=" + getMoving(e.getX(), true) + "\n");
|
||||
builder.append("MovingY=" + getMoving(e.getY(), false) + "\n");
|
||||
} catch (Throwable th) {
|
||||
@@ -639,7 +653,7 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
CallbackBridge.DEBUG_STRING.setLength(0);
|
||||
switch (e.getActionMasked()) {
|
||||
case MotionEvent.ACTION_MOVE:
|
||||
CallbackBridge.sendCursorPos(x, y);
|
||||
CallbackBridge.sendCursorPos(mouse_x, mouse_y);
|
||||
return true;
|
||||
case MotionEvent.ACTION_BUTTON_PRESS:
|
||||
return sendMouseButtonUnconverted(e.getActionButton(), true);
|
||||
@@ -758,15 +772,18 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
}
|
||||
switch(ev.getActionMasked()) {
|
||||
case MotionEvent.ACTION_HOVER_MOVE:
|
||||
CallbackBridge.mouseX = (int) (ev.getX(mouseCursorIndex)*scaleFactor);
|
||||
CallbackBridge.mouseY = (int) (ev.getY(mouseCursorIndex)*scaleFactor);
|
||||
CallbackBridge.sendCursorPos((int) (ev.getX(mouseCursorIndex)*scaleFactor), (int) (ev.getY(mouseCursorIndex)*scaleFactor));
|
||||
mouse_x = (int) (ev.getX(mouseCursorIndex) * scaleFactor);
|
||||
mouse_y = (int) (ev.getY(mouseCursorIndex) * scaleFactor);
|
||||
CallbackBridge.mouseX = mouse_x;
|
||||
CallbackBridge.mouseY = mouse_y;
|
||||
CallbackBridge.sendCursorPos(mouse_x,mouse_y);
|
||||
debugText.setText(CallbackBridge.DEBUG_STRING.toString());
|
||||
CallbackBridge.DEBUG_STRING.setLength(0);
|
||||
return true;
|
||||
case MotionEvent.ACTION_SCROLL:
|
||||
CallbackBridge.sendScroll((double) ev.getAxisValue(MotionEvent.AXIS_VSCROLL), (double) ev.getAxisValue(MotionEvent.AXIS_HSCROLL));
|
||||
return true;
|
||||
case MotionEvent.ACTION_BUTTON_PRESS:
|
||||
|
||||
return sendMouseButtonUnconverted(ev.getActionButton(),true);
|
||||
case MotionEvent.ACTION_BUTTON_RELEASE:
|
||||
return sendMouseButtonUnconverted(ev.getActionButton(),false);
|
||||
@@ -774,11 +791,13 @@ public class BaseMainActivity extends LoggableActivity {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
boolean isKeyboard(KeyEvent evt) {
|
||||
if((evt.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) == KeyEvent.FLAG_SOFT_KEYBOARD) return true;
|
||||
if(evt.getSource() == InputDevice.SOURCE_KEYBOARD) return true;
|
||||
if(evt.getUnicodeChar() != 0) return true;
|
||||
System.out.println("Event:" +evt);
|
||||
//if((evt.getFlags() & KeyEvent.FLAG_SOFT_KEYBOARD) == KeyEvent.FLAG_SOFT_KEYBOARD) return true;
|
||||
//if(evt.getSource() == InputDevice.SOURCE_KEYBOARD) return true;
|
||||
//if(evt.getUnicodeChar() != 0) return true;
|
||||
if(AndroidLWJGLKeycode.androidToLwjglMap.containsKey(evt.getKeyCode())) return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -28,6 +28,7 @@ public class ControlButton extends androidx.appcompat.widget.AppCompatButton imp
|
||||
|
||||
public ControlButton(ControlLayout layout, ControlData properties) {
|
||||
super(layout.getContext());
|
||||
setPadding(4, 4, 4, 4);
|
||||
setWillNotDraw(false);
|
||||
|
||||
mScaleAt = layout.mLayout.scaledAt;
|
||||
|
||||
@@ -56,8 +56,8 @@ public class CallbackBridge {
|
||||
}
|
||||
|
||||
public static void sendPrepareGrabInitialPos() {
|
||||
DEBUG_STRING.append("Prepare set grab initial posititon");
|
||||
sendMouseKeycode(-1, CallbackBridge.getCurrentMods(), false);
|
||||
DEBUG_STRING.append("Prepare set grab initial posititon: ignored");
|
||||
//sendMouseKeycode(-1, CallbackBridge.getCurrentMods(), false);
|
||||
}
|
||||
|
||||
public static void sendKeycode(int keycode, char keychar, int scancode, int modifiers, boolean isDown) {
|
||||
|
||||
BIN
app_pojavlauncher/src/main/res/drawable-hdpi/ic_auto_ram.png
Normal file
BIN
app_pojavlauncher/src/main/res/drawable-hdpi/ic_auto_ram.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 2.0 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 13 KiB |
BIN
app_pojavlauncher/src/main/res/drawable-hdpi/ic_flatstyle.png
Normal file
BIN
app_pojavlauncher/src/main/res/drawable-hdpi/ic_flatstyle.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 1.0 KiB |
BIN
app_pojavlauncher/src/main/res/drawable-hdpi/ic_lib_check.png
Normal file
BIN
app_pojavlauncher/src/main/res/drawable-hdpi/ic_lib_check.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 KiB |
BIN
app_pojavlauncher/src/main/res/drawable-hdpi/ic_map_rmb.png
Normal file
BIN
app_pojavlauncher/src/main/res/drawable-hdpi/ic_map_rmb.png
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 9.6 KiB |
@@ -24,10 +24,11 @@
|
||||
android:key="flatButtonStyle"
|
||||
android:summary="@string/mcl_setting_subtitle_flat_button_style"
|
||||
android:title="@string/mcl_setting_title_flat_button_style"
|
||||
app2:icon="@drawable/hide_sidebar" />
|
||||
app2:icon="@drawable/ic_flatstyle" />
|
||||
|
||||
<androidx.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:icon="@drawable/ic_disable_gestures"
|
||||
android:key="disableGestures"
|
||||
android:summary="@string/mcl_disable_gestures_subtitle"
|
||||
android:title="@string/mcl_disable_gestures" />
|
||||
@@ -53,11 +54,13 @@
|
||||
app2:icon="@drawable/ignore_notch" />
|
||||
<androidx.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:icon="@drawable/ic_auto_ram"
|
||||
android:key="autoRam"
|
||||
android:summary="@string/auto_ram_subtitle"
|
||||
android:title="@string/auto_ram_title" />
|
||||
<androidx.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:defaultValue="false"
|
||||
android:icon="@drawable/ic_map_rmb"
|
||||
android:key="backToRightMouse"
|
||||
android:summary="@string/mcl_setting_subtitle_backtorightmouse"
|
||||
android:title="@string/mcl_setting_title_backtorightmouse" />
|
||||
@@ -71,6 +74,7 @@
|
||||
android:title="@string/mcl_setting_title_javaargs" />
|
||||
<androidx.preference.SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:icon="@drawable/ic_lib_check"
|
||||
android:key="checkLibraries"
|
||||
android:summary="@string/mcl_setting_check_libraries_subtitle"
|
||||
android:title="@string/mcl_setting_check_libraries" />
|
||||
|
||||
@@ -61,7 +61,7 @@ public class Display {
|
||||
private static boolean window_created;
|
||||
|
||||
/** The Drawable instance that tracks the current Display context */
|
||||
private static DrawableLWJGL drawable;
|
||||
private static volatile DrawableLWJGL drawable;
|
||||
|
||||
private static Canvas parent;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user