From 5be3c1d295029bf736471e17919d6c5ecb3eb279 Mon Sep 17 00:00:00 2001 From: Vera-Firefly <1964762970@qq.com> Date: Sat, 26 Oct 2024 13:42:23 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B0=83=E6=95=B4[=E6=B8=B8=E6=88=8F=E5=86=85?= =?UTF-8?q?=E5=88=86=E8=BE=A8=E7=8E=87=E7=BC=A9=E6=94=BE]:=20=E4=BD=BF?= =?UTF-8?q?=E7=94=A8=E8=87=AA=E5=AE=9A=E4=B9=89dialog?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/firefly/utils/ResolutionAdjuster.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 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 1893ab09..701eef6c 100644 --- a/app_pojavlauncher/src/main/java/com/firefly/utils/ResolutionAdjuster.java +++ b/app_pojavlauncher/src/main/java/com/firefly/utils/ResolutionAdjuster.java @@ -1,9 +1,7 @@ package com.firefly.utils; -import android.app.AlertDialog; import android.content.Context; import android.content.res.Configuration; -import android.content.res.Resources; import android.util.DisplayMetrics; import android.view.Gravity; import android.view.ViewGroup; @@ -11,6 +9,8 @@ import android.widget.TextView; import android.widget.LinearLayout; +import com.firefly.ui.dialog.CustomDialog; + import net.kdt.pojavlaunch.prefs.LauncherPreferences; import net.kdt.pojavlaunch.R; import net.kdt.pojavlaunch.Tools; @@ -36,7 +36,7 @@ public void showSeekBarDialog() { // 因为麻烦 LinearLayout layout = new LinearLayout(context); layout.setOrientation(LinearLayout.HORIZONTAL); // 设置水平排列 - layout.setPadding(50, 40, 50, 20); + layout.setPadding(50, 8, 50, 8); layout.setGravity(Gravity.CENTER); // 动态创建一个 SeekBar ,用于调整缩放因子 @@ -91,13 +91,14 @@ public void onStopTrackingTouch(SeekBar seekBar) { }); // 创建并显示弹窗 - AlertDialog.Builder builder = new AlertDialog.Builder(context); - builder.setTitle(context.getString(R.string.mcl_setting_title_resolution_scaler)); - builder.setView(layout); - builder.setCancelable(false); // 不允许点击外部关闭弹窗,防止进程错误 - // 设置确认按钮, 点击关闭弹窗 - builder.setPositiveButton(android.R.string.ok, (d, i) -> d.dismiss()); - builder.show(); + new CustomDialog.Builder(context) + .setTitle(context.getString(R.string.mcl_setting_title_resolution_scaler)) + .setCustomView(layout) + .setCancelable(false) + .setDraggable(true) + .setConfirmListener(android.R.string.ok, customView -> true) + .build() + .show(); } private void changeResolutionRatioPreview(int progress, TextView resolutionTextView) {