From 24a9489505d29ab859226fae02ba6608ed386b77 Mon Sep 17 00:00:00 2001 From: Vera-Firefly <87926662+Vera-Firefly@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:50:51 +0800 Subject: [PATCH] Merge v3_openjdk into lwjgl3.3.1 --- .../kdt/pojavlaunch/customcontrols/CustomControls.java | 6 +++--- .../kdt/pojavlaunch/customcontrols/LayoutConverter.java | 2 +- .../pojavlaunch/customcontrols/buttons/ControlDrawer.java | 2 +- .../customcontrols/buttons/ControlSubButton.java | 8 +++++--- 4 files changed, 10 insertions(+), 8 deletions(-) diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java index 0dc96a006..e089be988 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/CustomControls.java @@ -52,13 +52,13 @@ public CustomControls(Context ctx) { this.mControlDataList.add(new ControlData(ctx, R.string.control_jump, new int[]{LwjglGlfwKeycode.GLFW_KEY_SPACE}, "${right} - ${margin} * 2 - ${width}", "${bottom} - ${margin} * 2 - ${height}", true)); //The default controls are conform to the V2 - version = 4; + version = 5; } public void save(String path) throws IOException { - //Current version is the V2.5 so the version as to be marked as 4 ! - version = 4; + //Current version is the V2.6 so the version as to be marked as 5 ! + version = 5; Tools.write(path, Tools.GLOBAL_GSON.toJson(this)); } diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/LayoutConverter.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/LayoutConverter.java index d8e20a907..f5dd33f9b 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/LayoutConverter.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/LayoutConverter.java @@ -28,7 +28,7 @@ public static CustomControls loadAndConvertIfNecessary(String jsonPath) throws I CustomControls layout = LayoutConverter.convertV2Layout(layoutJobj); layout.save(jsonPath); return layout; - }else if (layoutJobj.getInt("version") == 3 || layoutJobj.getInt("version") == 4) { + }else if (layoutJobj.getInt("version") >= 3 && layoutJobj.getInt("version") <= 5) { return Tools.GLOBAL_GSON.fromJson(jsonLayoutData, CustomControls.class); }else{ return null; diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlDrawer.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlDrawer.java index ccacc8323..a43738f24 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlDrawer.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlDrawer.java @@ -88,7 +88,7 @@ private void alignButtons(){ private void resizeButtons(){ - if (buttons == null) return; + if (buttons == null || drawerData.orientation == ControlDrawerData.Orientation.FREE) return; for(ControlSubButton subButton : buttons){ subButton.mProperties.setWidth(mProperties.getWidth()); subButton.mProperties.setHeight(mProperties.getHeight()); diff --git a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlSubButton.java b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlSubButton.java index cd24b8dc9..998b4cdf3 100644 --- a/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlSubButton.java +++ b/app_pojavlauncher/src/main/java/net/kdt/pojavlaunch/customcontrols/buttons/ControlSubButton.java @@ -21,8 +21,10 @@ public ControlSubButton(ControlLayout layout, ControlData properties, ControlDra } private void filterProperties(){ - mProperties.setHeight(parentDrawer.getProperties().getHeight()); - mProperties.setWidth(parentDrawer.getProperties().getWidth()); + if (parentDrawer != null && parentDrawer.drawerData.orientation != ControlDrawerData.Orientation.FREE) { + mProperties.setHeight(parentDrawer.getProperties().getHeight()); + mProperties.setWidth(parentDrawer.getProperties().getWidth()); + } mProperties.isDynamicBtn = false; setProperties(mProperties, false); @@ -35,7 +37,7 @@ public void setVisible(boolean isVisible) { @Override public void setLayoutParams(ViewGroup.LayoutParams params) { - if(parentDrawer != null){ + if(parentDrawer != null && parentDrawer.drawerData.orientation != ControlDrawerData.Orientation.FREE){ params.width = (int)parentDrawer.mProperties.getWidth(); params.height = (int)parentDrawer.mProperties.getHeight(); }