图片选择到剪裁选定流程调试完成。

This commit is contained in:
2025-12-11 20:49:04 +08:00
parent 03212c0554
commit d35d0d0291
3 changed files with 30 additions and 17 deletions

View File

@@ -1,8 +1,8 @@
#Created by .winboll/winboll_app_build.gradle #Created by .winboll/winboll_app_build.gradle
#Thu Dec 11 11:14:29 GMT 2025 #Thu Dec 11 12:47:00 GMT 2025
stageCount=15 stageCount=15
libraryProject= libraryProject=
baseVersion=15.12 baseVersion=15.12
publishVersion=15.12.14 publishVersion=15.12.14
buildCount=28 buildCount=41
baseBetaVersion=15.12.15 baseBetaVersion=15.12.15

View File

@@ -394,7 +394,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity implements Backg
// 第一重刷新 // 第一重刷新
try { try {
mBgSourceUtils.loadSettings(); mBgSourceUtils.loadSettings();
mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean()); mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean(), true);
LogUtils.d(TAG, "【双重刷新】第一重完成"); LogUtils.d(TAG, "【双重刷新】第一重完成");
} catch (Exception e) { } catch (Exception e) {
LogUtils.e(TAG, "【双重刷新】第一重异常:" + e.getMessage()); LogUtils.e(TAG, "【双重刷新】第一重异常:" + e.getMessage());
@@ -408,7 +408,7 @@ public class BackgroundSettingsActivity extends WinBoLLActivity implements Backg
if (mBackgroundView != null && !isFinishing() && mBgSourceUtils != null) { if (mBackgroundView != null && !isFinishing() && mBgSourceUtils != null) {
try { try {
mBgSourceUtils.loadSettings(); mBgSourceUtils.loadSettings();
mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean()); mBackgroundView.loadBackgroundBean(mBgSourceUtils.getPreviewBackgroundBean(), true);
LogUtils.d(TAG, "【双重刷新】第二重完成"); LogUtils.d(TAG, "【双重刷新】第二重完成");
} catch (Exception e) { } catch (Exception e) {
LogUtils.e(TAG, "【双重刷新】第二重异常:" + e.getMessage()); LogUtils.e(TAG, "【双重刷新】第二重异常:" + e.getMessage());
@@ -817,17 +817,16 @@ public class BackgroundSettingsActivity extends WinBoLLActivity implements Backg
*/ */
boolean putUriFileToPreviewSource(File srcFile) { boolean putUriFileToPreviewSource(File srcFile) {
LogUtils.d(TAG, String.format("putUriFileToPreviewSource(File srcFile) srcFile %s", srcFile)); LogUtils.d(TAG, String.format("putUriFileToPreviewSource(File srcFile) srcFile %s", srcFile));
mBgSourceUtils.loadSettings(); mBgSourceUtils.loadSettings();
BackgroundBean previewBean = mBgSourceUtils.getPreviewBackgroundBean(); BackgroundBean previewBean = mBgSourceUtils.getPreviewBackgroundBean();
// 核心修复将预览Bean的路径更新为选中图片的路径 File dstFile = new File(previewBean.getBackgroundFilePath());
previewBean.setBackgroundFilePath(srcFile.getAbsolutePath()); LogUtils.d(TAG, String.format("putUriFileToPreviewSource(File srcFile) dstFile %s", dstFile));
// 同步压缩图路径(避免裁剪输出路径错误) if (FileUtils.copyFile(srcFile, dstFile)) {
String compressPath = mBgSourceUtils.getBackgroundSourceDirPath() + "/cache/SelectCompress_" + srcFile.getName(); LogUtils.d(TAG, "putUriFileToPreviewSource(File srcFile) 文件拷贝成功。 ");
previewBean.setBackgroundScaledCompressFilePath(compressPath); return true;
mBgSourceUtils.saveSettings(); // 保存修改后的Bean }
LogUtils.d(TAG, "putUriFileToPreviewSource(File srcFile) 文件无法拷贝。 ");
File dstFile = new File(previewBean.getBackgroundFilePath()); return false;
return FileUtils.copyFile(srcFile, dstFile);
} }
/** /**

View File

@@ -104,6 +104,10 @@ public class BackgroundView extends RelativeLayout {
} }
public void loadBackgroundBean(BackgroundBean bean) { public void loadBackgroundBean(BackgroundBean bean) {
loadBackgroundBean(bean, false);
}
public void loadBackgroundBean(BackgroundBean bean, boolean isRefresh) {
if (!bean.isUseBackgroundFile()) { if (!bean.isUseBackgroundFile()) {
setDefaultTransparentBackground(); setDefaultTransparentBackground();
return; return;
@@ -111,8 +115,18 @@ public class BackgroundView extends RelativeLayout {
String targetPath = bean.isUseBackgroundScaledCompressFile() String targetPath = bean.isUseBackgroundScaledCompressFile()
? bean.getBackgroundScaledCompressFilePath() ? bean.getBackgroundScaledCompressFilePath()
: bean.getBackgroundFilePath(); : bean.getBackgroundFilePath();
// 调用带路径判断的loadImage方法
loadImage(targetPath); if (!(new File(targetPath).exists())) {
LogUtils.d(TAG, String.format("视图控件图片不存在:%s", targetPath));
return;
}
// 调用带路径判断的loadImage方法
if (isRefresh) {
App._mBitmapCacheUtils.removeCachedBitmap(targetPath);
App._mBitmapCacheUtils.cacheBitmap(targetPath);
}
loadImage(targetPath);
} }
// ====================================== 对外方法 ====================================== // ====================================== 对外方法 ======================================