diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MinecraftGLSurface.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MinecraftGLSurface.java index 48d745d8c..22c421059 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MinecraftGLSurface.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/MinecraftGLSurface.java @@ -1,6 +1,7 @@ package net.kdt.pojavlaunch; import static net.kdt.pojavlaunch.MainActivity.touchCharInput; +import static net.kdt.pojavlaunch.prefs.LauncherPreferences.PREF_DISABLE_SWAP_HAND; import static net.kdt.pojavlaunch.utils.MCOptionUtils.getMcScale; import static org.lwjgl.glfw.CallbackBridge.sendKeyPress; import static org.lwjgl.glfw.CallbackBridge.sendMouseButton; @@ -291,7 +292,7 @@ public class MinecraftGLSurface extends View implements GrabListener{ boolean isTouchInHotbar = hudKeyHandled != -1; if (isTouchInHotbar) { sendKeyPress(hudKeyHandled); - if(hasDoubleTapped && hudKeyHandled == mLastHotbarKey){ + if(hasDoubleTapped && hudKeyHandled == mLastHotbarKey && !PREF_DISABLE_SWAP_HAND){ //Prevent double tapping Event on two different slots sendKeyPress(LwjglGlfwKeycode.GLFW_KEY_F); } diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java index 23e301384..04c0f3a13 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/LauncherPreferences.java @@ -10,10 +10,6 @@ import android.content.*; import android.graphics.Rect; import android.os.Build; import android.util.Log; -import android.view.WindowInsets; -import android.view.WindowMetrics; - -import androidx.core.view.WindowInsetsCompat; import net.kdt.pojavlaunch.*; import net.kdt.pojavlaunch.multirt.MultiRTUtils; @@ -40,6 +36,7 @@ public class LauncherPreferences { public static String PREF_VERSION_REPOS = "https://piston-meta.mojang.com/mc/game/version_manifest_v2.json"; public static boolean PREF_CHECK_LIBRARY_SHA = true; public static boolean PREF_DISABLE_GESTURES = false; + public static boolean PREF_DISABLE_SWAP_HAND = false; public static float PREF_MOUSESPEED = 1f; public static int PREF_RAM_ALLOCATION; public static String PREF_DEFAULT_RUNTIME; @@ -81,6 +78,7 @@ public class LauncherPreferences { PREF_FORCE_ENGLISH = DEFAULT_PREF.getBoolean("force_english", false); PREF_CHECK_LIBRARY_SHA = DEFAULT_PREF.getBoolean("checkLibraries",true); PREF_DISABLE_GESTURES = DEFAULT_PREF.getBoolean("disableGestures",false); + PREF_DISABLE_SWAP_HAND = DEFAULT_PREF.getBoolean("disableDoubleTap", false); PREF_RAM_ALLOCATION = DEFAULT_PREF.getInt("allocation", findBestRAMAllocation(ctx)); PREF_CUSTOM_JAVA_ARGS = DEFAULT_PREF.getString("javaArgs", ""); PREF_SUSTAINED_PERFORMANCE = DEFAULT_PREF.getBoolean("sustainedPerformance", false); diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceControlFragment.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceControlFragment.java index d6f430b2c..3df4919aa 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceControlFragment.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/prefs/screens/LauncherPreferenceControlFragment.java @@ -7,7 +7,6 @@ import android.hardware.SensorManager; import android.os.Bundle; import androidx.preference.PreferenceCategory; -import androidx.preference.SwitchPreference; import net.kdt.pojavlaunch.R; import net.kdt.pojavlaunch.prefs.CustomSeekBarPreference; diff --git a/app_pojavlauncher/src/main/res/values/strings.xml b/app_pojavlauncher/src/main/res/values/strings.xml index 29e9c12bd..5ed9715ba 100644 --- a/app_pojavlauncher/src/main/res/values/strings.xml +++ b/app_pojavlauncher/src/main/res/values/strings.xml @@ -231,6 +231,8 @@ Library %s is fine and usable Disable gestures Disables gestures, such as hold to break block, and tap to place a block. + Disable double tap to swap hands + Disables double tap on an hotbar item to swap it in the second hand Mouse Speed Changes the speed of the software mouse Mouse pass-thru diff --git a/app_pojavlauncher/src/main/res/xml/pref_control.xml b/app_pojavlauncher/src/main/res/xml/pref_control.xml index 26cc8d3ea..273212676 100644 --- a/app_pojavlauncher/src/main/res/xml/pref_control.xml +++ b/app_pojavlauncher/src/main/res/xml/pref_control.xml @@ -23,6 +23,12 @@ android:summary="@string/mcl_disable_gestures_subtitle" android:title="@string/mcl_disable_gestures" /> + +