From 1d386ac87bbd2a7ec60b708625fe442d08a7f57b Mon Sep 17 00:00:00 2001 From: Vera-Firefly <1964762970@qq.com> Date: Tue, 15 Oct 2024 12:29:00 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4[=E5=88=86=E8=BE=A8=E7=8E=87?= =?UTF-8?q?=E6=8E=A7=E5=88=B6]:=20=E6=B8=B8=E6=88=8F=E5=86=85=E5=88=86?= =?UTF-8?q?=E8=BE=A8=E7=8E=87=E7=BC=A9=E6=94=BE=E6=98=BE=E7=A4=BA=E7=9A=84?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87=E5=A7=8B=E7=BB=88=E4=BF=9D=E6=8C=81?= =?UTF-8?q?=E5=81=B6=E6=95=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../main/java/com/firefly/utils/ResolutionAdjuster.java | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/app_pojavlauncher/src/main/java/com/firefly/utils/ResolutionAdjuster.java b/app_pojavlauncher/src/main/java/com/firefly/utils/ResolutionAdjuster.java index e7d92e60..abe669a4 100644 --- a/app_pojavlauncher/src/main/java/com/firefly/utils/ResolutionAdjuster.java +++ b/app_pojavlauncher/src/main/java/com/firefly/utils/ResolutionAdjuster.java @@ -42,7 +42,7 @@ public void showSeekBarDialog() { // 因为麻烦 LinearLayout layout = new LinearLayout(context); layout.setOrientation(LinearLayout.HORIZONTAL); // 设置水平排列 - layout.setPadding(50, 40, 50, 40); + layout.setPadding(50, 40, 50, 20); layout.setGravity(Gravity.CENTER); // 动态创建一个 SeekBar ,用于调整缩放因子 @@ -113,8 +113,9 @@ private void changeResolutionRatioPreview(int progress, TextView resolutionTextV boolean isLandscape = context.getResources().getConfiguration().orientation == Configuration.ORIENTATION_LANDSCAPE || width > height; double progressDouble = (double) progress / 100; - int previewWidth = (int) ((isLandscape ? width : height) * progressDouble); - int previewHeight = (int) ((isLandscape ? height : width) * progressDouble); + // 计算要显示的宽高,用Tools现有的方案getDisplayFriendlyRes()确保是偶数 + int previewWidth = Tools.getDisplayFriendlyRes(isLandscape ? width : height, (float) progressDouble); + int previewHeight = Tools.getDisplayFriendlyRes(isLandscape ? height : width, (float) progressDouble); String preview = previewWidth + " x " + previewHeight; resolutionTextView.setText(preview); // 实时更新TextView中的分辨率