From 36bdd059b0485ff022494ab425c60435ff2bf0f0 Mon Sep 17 00:00:00 2001 From: ZhanGSKen Date: Sun, 21 Dec 2025 09:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E7=A9=BA=E7=99=BD=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E8=83=8C=E6=99=AF=E6=8C=89=E9=92=AE=E4=B8=8E=E5=9B=BE?= =?UTF-8?q?=E7=89=87=E8=83=8C=E6=99=AF=E6=8C=89=E9=92=AE=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- powerbell/build.properties | 4 +- .../BackgroundSettingsActivity.java | 13 +++-- .../utils/BackgroundSourceUtils.java | 52 ++++++++++--------- 3 files changed, 38 insertions(+), 31 deletions(-) diff --git a/powerbell/build.properties b/powerbell/build.properties index fb14460..1dda429 100644 --- a/powerbell/build.properties +++ b/powerbell/build.properties @@ -1,8 +1,8 @@ #Created by .winboll/winboll_app_build.gradle -#Sun Dec 21 09:22:26 HKT 2025 +#Sun Dec 21 01:45:57 GMT 2025 stageCount=14 libraryProject= baseVersion=15.14 publishVersion=15.14.13 -buildCount=0 +buildCount=6 baseBetaVersion=15.14.14 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 d8f8357..3c6fdf8 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 @@ -216,9 +216,10 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { @Override public void onClick(View v) { LogUtils.d(TAG, "【按钮点击】取消背景图片"); - BackgroundBean previewBackgroundBean = mBgSourceUtils.getPreviewBackgroundBean(); - previewBackgroundBean.setIsUseBackgroundFile(false); - doubleRefreshPreview(); + mBgSourceUtils.getPreviewBackgroundBean().setIsUseBackgroundFile(false); + mBgSourceUtils.saveSettings(); + doubleRefreshPreview(); + isPreviewBackgroundChanged = true; } }; @@ -293,8 +294,10 @@ public class BackgroundSettingsActivity extends WinBoLLActivity { private View.OnClickListener onReceivedPictureClickListener = new View.OnClickListener() { @Override public void onClick(View v) { - ToastUtils.show("图片接收功能暂未实现"); - LogUtils.d(TAG, "【按钮点击】图片接收"); + mBgSourceUtils.getPreviewBackgroundBean().setIsUseBackgroundFile(true); + mBgSourceUtils.saveSettings(); + doubleRefreshPreview(); + isPreviewBackgroundChanged = true; } }; 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 6c54926..1b43f20 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 @@ -183,38 +183,42 @@ public class BackgroundSourceUtils { /** * 检查背景是否为空并创建空白背景Bean */ - boolean checkEmptyBackgroundAndCreateBlankBackgroundBean(BackgroundBean checkBackgroundBean) { + public boolean checkEmptyBackgroundAndCreateBlankBackgroundBean(BackgroundBean checkBackgroundBean) { LogUtils.d(TAG, "【checkEmptyBackgroundAndCreateBlankBackgroundBean调用】开始检查背景Bean"); File fCheckBackgroundFile = new File(checkBackgroundBean.getBackgroundFilePath()); if (!fCheckBackgroundFile.exists()) { - String newCropFileName = genNewCropFileName(); - String fileSuffix = "png"; - mCropSourceFile = new File(fCropCacheDir, newCropFileName + "." + fileSuffix); - mCropResultFile = new File(fCropCacheDir, "SelectCompress_" + newCropFileName + "." + fileSuffix); - - AssetsCopyUtils.copyAssetsFileToDir(mContext, "images/blank100x100.png", mCropSourceFile.getAbsolutePath()); - try { - mCropResultFile.createNewFile(); - } catch (IOException e) { - LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); - } - - loadSettings(); - previewBackgroundBean.setPixelColor(0xFFFFFFFF); - previewBackgroundBean.setIsUseBackgroundFile(true); - previewBackgroundBean.setIsUseBackgroundScaledCompressFile(false); - previewBackgroundBean.setBackgroundFileName(mCropSourceFile.getName()); - previewBackgroundBean.setBackgroundFilePath(mCropSourceFile.getAbsolutePath()); - previewBackgroundBean.setBackgroundScaledCompressFileName(mCropResultFile.getName()); - previewBackgroundBean.setBackgroundScaledCompressFilePath(mCropResultFile.getAbsolutePath()); - saveSettings(); - LogUtils.d(TAG, "背景Bean为空,已创建空白背景并更新配置"); - return true; + return createBlankBackgroundBean(checkBackgroundBean.getPixelColor()); } LogUtils.d(TAG, "背景Bean文件存在,无需创建空白背景"); return false; } + public boolean createBlankBackgroundBean(int nBackgroundPixelColor) { + String newCropFileName = genNewCropFileName(); + String fileSuffix = "png"; + mCropSourceFile = new File(fCropCacheDir, newCropFileName + "." + fileSuffix); + mCropResultFile = new File(fCropCacheDir, "SelectCompress_" + newCropFileName + "." + fileSuffix); + + AssetsCopyUtils.copyAssetsFileToDir(mContext, "images/blank100x100.png", mCropSourceFile.getAbsolutePath()); + try { + mCropResultFile.createNewFile(); + } catch (IOException e) { + LogUtils.d(TAG, e, Thread.currentThread().getStackTrace()); + } + + loadSettings(); + previewBackgroundBean.setPixelColor(nBackgroundPixelColor); + previewBackgroundBean.setIsUseBackgroundFile(true); + previewBackgroundBean.setIsUseBackgroundScaledCompressFile(false); + previewBackgroundBean.setBackgroundFileName(mCropSourceFile.getName()); + previewBackgroundBean.setBackgroundFilePath(mCropSourceFile.getAbsolutePath()); + previewBackgroundBean.setBackgroundScaledCompressFileName(mCropResultFile.getName()); + previewBackgroundBean.setBackgroundScaledCompressFilePath(mCropResultFile.getAbsolutePath()); + saveSettings(); + LogUtils.d(TAG, "背景Bean为空,已创建空白背景并更新配置"); + return true; + } + String genNewCropFileName() { return UUID.randomUUID().toString() + System.currentTimeMillis(); }