mirror of
https://gitea.winboll.cc/Studio/OriginMaster.git
synced 2026-02-04 16:31:31 +08:00
减少初始化应用相册目录时的多余目录。
This commit is contained in:
@@ -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();
|
||||
}
|
||||
|
||||
@@ -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());
|
||||
|
||||
Reference in New Issue
Block a user