From 2a78d1881827561d54a8f71b2aacdead93df8334 Mon Sep 17 00:00:00 2001 From: Vera-Firefly <87926662+Vera-Firefly@users.noreply.github.com> Date: Fri, 4 Aug 2023 13:23:01 +0800 Subject: [PATCH] chore(control): bumb up the version number of control schema --- .../kdt/pojavlaunch/customcontrols/CustomControls.java | 6 +++--- .../pojavlaunch/customcontrols/buttons/ControlDrawer.java | 2 +- .../customcontrols/buttons/ControlSubButton.java | 8 +++++--- 3 files changed, 9 insertions(+), 7 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/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(); }