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

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
#Thu Dec 11 11:14:29 GMT 2025
#Thu Dec 11 12:47:00 GMT 2025
stageCount=15
libraryProject=
baseVersion=15.12
publishVersion=15.12.14
buildCount=28
buildCount=41
baseBetaVersion=15.12.15

View File

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

View File

@@ -104,6 +104,10 @@ public class BackgroundView extends RelativeLayout {
}
public void loadBackgroundBean(BackgroundBean bean) {
loadBackgroundBean(bean, false);
}
public void loadBackgroundBean(BackgroundBean bean, boolean isRefresh) {
if (!bean.isUseBackgroundFile()) {
setDefaultTransparentBackground();
return;
@@ -111,8 +115,18 @@ public class BackgroundView extends RelativeLayout {
String targetPath = bean.isUseBackgroundScaledCompressFile()
? bean.getBackgroundScaledCompressFilePath()
: 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);
}
// ====================================== 对外方法 ======================================