From 2d12397f5ea123c7f17437de10c8cfd4db90fa74 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sun, 14 Dec 2025 02:28:53 +0800 Subject: [PATCH] =?UTF-8?q?=E5=87=8F=E5=B0=91=E5=88=9D=E5=A7=8B=E5=8C=96?= =?UTF-8?q?=E5=BA=94=E7=94=A8=E7=9B=B8=E5=86=8C=E7=9B=AE=E5=BD=95=E6=97=B6?= =?UTF-8?q?=E7=9A=84=E5=A4=9A=E4=BD=99=E7=9B=AE=E5=BD=95=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../activities/BackgroundSettingsActivity.java | 15 ++++++--------- .../powerbell/utils/BackgroundSourceUtils.java | 9 +++++++-- 2 files changed, 13 insertions(+), 11 deletions(-) diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BackgroundSettingsActivity.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BackgroundSettingsActivity.java index 38c2188..f44c487 100644 --- a/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BackgroundSettingsActivity.java +++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/activities/BackgroundSettingsActivity.java @@ -91,11 +91,11 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { } mfTakePhoto = new File(tempDir, "TakePhoto.jpg"); - File selectTempDir = new File(mBgSourceUtils.getBackgroundSourceDirPath(), "SelectTemp"); - if (!selectTempDir.exists()) { - selectTempDir.mkdirs(); - LogUtils.d(TAG, "【目录初始化】选图临时目录创建完成:" + selectTempDir.getAbsolutePath()); - } +// File selectTempDir = new File(mBgSourceUtils.getBackgroundSourceDirPath(), "SelectTemp"); +// if (!selectTempDir.exists()) { +// selectTempDir.mkdirs(); +// LogUtils.d(TAG, "【目录初始化】选图临时目录创建完成:" + selectTempDir.getAbsolutePath()); +// } // 初始化界面与事件 initToolbar(); @@ -167,28 +167,25 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { public void finish() { LogUtils.d(TAG, "【生命周期】finish 触发,isCommitSettings:" + isCommitSettings + ",isPreviewBackgroundChanged:" + isPreviewBackgroundChanged); if (isCommitSettings) { - setResult(RESULT_OK); super.finish(); } else { if (isPreviewBackgroundChanged) { YesNoAlertDialog.show(this, "背景更换问题", "是否确定背景图片设置?", new YesNoAlertDialog.OnDialogResultListener() { @Override public void onYes() { + //ToastUtils.show("onYes"); mBgSourceUtils.commitPreviewSourceToCurrent(); isCommitSettings = true; - setResult(RESULT_OK); finish(); } @Override public void onNo() { isCommitSettings = true; - setResult(RESULT_CANCELED); finish(); } }); } else { - setResult(RESULT_OK); isCommitSettings = true; finish(); } diff --git a/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/BackgroundSourceUtils.java b/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/BackgroundSourceUtils.java index 39e9b13..fedd1dc 100644 --- a/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/BackgroundSourceUtils.java +++ b/powerbell/src/main/java/cc/winboll/studio/powerbell/utils/BackgroundSourceUtils.java @@ -185,7 +185,7 @@ public class BackgroundSourceUtils { LogUtils.d(TAG, "【checkEmptyBackgroundAndCreateBlankBackgroundBean调用】开始检查背景Bean"); File fCheckBackgroundFile = new File(checkBackgroundBean.getBackgroundFilePath()); if (!fCheckBackgroundFile.exists()) { - String newCropFileName = "blank10x10"; + String newCropFileName = genNewCropFileName(); String fileSuffix = "png"; mCropSourceFile = new File(fCropCacheDir, newCropFileName + "." + fileSuffix); mCropResultFile = new File(fCropCacheDir, "SelectCompress_" + newCropFileName + "." + fileSuffix); @@ -211,6 +211,10 @@ public class BackgroundSourceUtils { LogUtils.d(TAG, "背景Bean文件存在,无需创建空白背景"); return false; } + + String genNewCropFileName() { + return UUID.randomUUID().toString() + System.currentTimeMillis(); + } /** * 创建并更新预览剪裁环境 @@ -228,7 +232,7 @@ public class BackgroundSourceUtils { Uri uri = UriUtils.getUriForFile(mContext, oldPreviewBackgroundBean.getBackgroundFilePath()); String fileSuffix = FileUtils.getFileSuffix(mContext, uri); - String newCropFileName = UUID.randomUUID().toString() + System.currentTimeMillis(); + String newCropFileName = genNewCropFileName(); mCropSourceFile = new File(fCropCacheDir, newCropFileName + "." + fileSuffix); mCropResultFile = new File(fCropCacheDir, "SelectCompress_" + newCropFileName + "." + fileSuffix); @@ -415,6 +419,7 @@ public class BackgroundSourceUtils { */ public void commitPreviewSourceToCurrent() { LogUtils.d(TAG, "【commitPreviewSourceToCurrent调用】开始深拷贝预览Bean到正式Bean"); + //ToastUtils.show("【commitPreviewSourceToCurrent调用】开始深拷贝预览Bean到正式Bean"); currentBackgroundBean = new BackgroundBean(); currentBackgroundBean.setBackgroundFileName(previewBackgroundBean.getBackgroundFileName()); currentBackgroundBean.setBackgroundFilePath(previewBackgroundBean.getBackgroundFilePath());