修复空白图片背景按钮与图片背景按钮。
This commit is contained in:
@@ -1,8 +1,8 @@
|
|||||||
#Created by .winboll/winboll_app_build.gradle
|
#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
|
stageCount=14
|
||||||
libraryProject=
|
libraryProject=
|
||||||
baseVersion=15.14
|
baseVersion=15.14
|
||||||
publishVersion=15.14.13
|
publishVersion=15.14.13
|
||||||
buildCount=0
|
buildCount=6
|
||||||
baseBetaVersion=15.14.14
|
baseBetaVersion=15.14.14
|
||||||
|
|||||||
@@ -216,9 +216,10 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
LogUtils.d(TAG, "【按钮点击】取消背景图片");
|
LogUtils.d(TAG, "【按钮点击】取消背景图片");
|
||||||
BackgroundBean previewBackgroundBean = mBgSourceUtils.getPreviewBackgroundBean();
|
mBgSourceUtils.getPreviewBackgroundBean().setIsUseBackgroundFile(false);
|
||||||
previewBackgroundBean.setIsUseBackgroundFile(false);
|
mBgSourceUtils.saveSettings();
|
||||||
doubleRefreshPreview();
|
doubleRefreshPreview();
|
||||||
|
isPreviewBackgroundChanged = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
@@ -293,8 +294,10 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
private View.OnClickListener onReceivedPictureClickListener = new View.OnClickListener() {
|
private View.OnClickListener onReceivedPictureClickListener = new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
ToastUtils.show("图片接收功能暂未实现");
|
mBgSourceUtils.getPreviewBackgroundBean().setIsUseBackgroundFile(true);
|
||||||
LogUtils.d(TAG, "【按钮点击】图片接收");
|
mBgSourceUtils.saveSettings();
|
||||||
|
doubleRefreshPreview();
|
||||||
|
isPreviewBackgroundChanged = true;
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|||||||
@@ -183,38 +183,42 @@ public class BackgroundSourceUtils {
|
|||||||
/**
|
/**
|
||||||
* 检查背景是否为空并创建空白背景Bean
|
* 检查背景是否为空并创建空白背景Bean
|
||||||
*/
|
*/
|
||||||
boolean checkEmptyBackgroundAndCreateBlankBackgroundBean(BackgroundBean checkBackgroundBean) {
|
public boolean checkEmptyBackgroundAndCreateBlankBackgroundBean(BackgroundBean checkBackgroundBean) {
|
||||||
LogUtils.d(TAG, "【checkEmptyBackgroundAndCreateBlankBackgroundBean调用】开始检查背景Bean");
|
LogUtils.d(TAG, "【checkEmptyBackgroundAndCreateBlankBackgroundBean调用】开始检查背景Bean");
|
||||||
File fCheckBackgroundFile = new File(checkBackgroundBean.getBackgroundFilePath());
|
File fCheckBackgroundFile = new File(checkBackgroundBean.getBackgroundFilePath());
|
||||||
if (!fCheckBackgroundFile.exists()) {
|
if (!fCheckBackgroundFile.exists()) {
|
||||||
String newCropFileName = genNewCropFileName();
|
return createBlankBackgroundBean(checkBackgroundBean.getPixelColor());
|
||||||
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;
|
|
||||||
}
|
}
|
||||||
LogUtils.d(TAG, "背景Bean文件存在,无需创建空白背景");
|
LogUtils.d(TAG, "背景Bean文件存在,无需创建空白背景");
|
||||||
return false;
|
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() {
|
String genNewCropFileName() {
|
||||||
return UUID.randomUUID().toString() + System.currentTimeMillis();
|
return UUID.randomUUID().toString() + System.currentTimeMillis();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user