减少初始化应用相册目录时的多余目录。
This commit is contained in:
@@ -91,11 +91,11 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
}
|
}
|
||||||
mfTakePhoto = new File(tempDir, "TakePhoto.jpg");
|
mfTakePhoto = new File(tempDir, "TakePhoto.jpg");
|
||||||
|
|
||||||
File selectTempDir = new File(mBgSourceUtils.getBackgroundSourceDirPath(), "SelectTemp");
|
// File selectTempDir = new File(mBgSourceUtils.getBackgroundSourceDirPath(), "SelectTemp");
|
||||||
if (!selectTempDir.exists()) {
|
// if (!selectTempDir.exists()) {
|
||||||
selectTempDir.mkdirs();
|
// selectTempDir.mkdirs();
|
||||||
LogUtils.d(TAG, "【目录初始化】选图临时目录创建完成:" + selectTempDir.getAbsolutePath());
|
// LogUtils.d(TAG, "【目录初始化】选图临时目录创建完成:" + selectTempDir.getAbsolutePath());
|
||||||
}
|
// }
|
||||||
|
|
||||||
// 初始化界面与事件
|
// 初始化界面与事件
|
||||||
initToolbar();
|
initToolbar();
|
||||||
@@ -167,28 +167,25 @@ public class BackgroundSettingsActivity extends WinBoLLActivity {
|
|||||||
public void finish() {
|
public void finish() {
|
||||||
LogUtils.d(TAG, "【生命周期】finish 触发,isCommitSettings:" + isCommitSettings + ",isPreviewBackgroundChanged:" + isPreviewBackgroundChanged);
|
LogUtils.d(TAG, "【生命周期】finish 触发,isCommitSettings:" + isCommitSettings + ",isPreviewBackgroundChanged:" + isPreviewBackgroundChanged);
|
||||||
if (isCommitSettings) {
|
if (isCommitSettings) {
|
||||||
setResult(RESULT_OK);
|
|
||||||
super.finish();
|
super.finish();
|
||||||
} else {
|
} else {
|
||||||
if (isPreviewBackgroundChanged) {
|
if (isPreviewBackgroundChanged) {
|
||||||
YesNoAlertDialog.show(this, "背景更换问题", "是否确定背景图片设置?", new YesNoAlertDialog.OnDialogResultListener() {
|
YesNoAlertDialog.show(this, "背景更换问题", "是否确定背景图片设置?", new YesNoAlertDialog.OnDialogResultListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onYes() {
|
public void onYes() {
|
||||||
|
//ToastUtils.show("onYes");
|
||||||
mBgSourceUtils.commitPreviewSourceToCurrent();
|
mBgSourceUtils.commitPreviewSourceToCurrent();
|
||||||
isCommitSettings = true;
|
isCommitSettings = true;
|
||||||
setResult(RESULT_OK);
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNo() {
|
public void onNo() {
|
||||||
isCommitSettings = true;
|
isCommitSettings = true;
|
||||||
setResult(RESULT_CANCELED);
|
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
setResult(RESULT_OK);
|
|
||||||
isCommitSettings = true;
|
isCommitSettings = true;
|
||||||
finish();
|
finish();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ public class BackgroundSourceUtils {
|
|||||||
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 = "blank10x10";
|
String newCropFileName = genNewCropFileName();
|
||||||
String fileSuffix = "png";
|
String fileSuffix = "png";
|
||||||
mCropSourceFile = new File(fCropCacheDir, newCropFileName + "." + fileSuffix);
|
mCropSourceFile = new File(fCropCacheDir, newCropFileName + "." + fileSuffix);
|
||||||
mCropResultFile = new File(fCropCacheDir, "SelectCompress_" + newCropFileName + "." + fileSuffix);
|
mCropResultFile = new File(fCropCacheDir, "SelectCompress_" + newCropFileName + "." + fileSuffix);
|
||||||
@@ -212,6 +212,10 @@ public class BackgroundSourceUtils {
|
|||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
String genNewCropFileName() {
|
||||||
|
return UUID.randomUUID().toString() + System.currentTimeMillis();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 创建并更新预览剪裁环境
|
* 创建并更新预览剪裁环境
|
||||||
*/
|
*/
|
||||||
@@ -228,7 +232,7 @@ public class BackgroundSourceUtils {
|
|||||||
|
|
||||||
Uri uri = UriUtils.getUriForFile(mContext, oldPreviewBackgroundBean.getBackgroundFilePath());
|
Uri uri = UriUtils.getUriForFile(mContext, oldPreviewBackgroundBean.getBackgroundFilePath());
|
||||||
String fileSuffix = FileUtils.getFileSuffix(mContext, uri);
|
String fileSuffix = FileUtils.getFileSuffix(mContext, uri);
|
||||||
String newCropFileName = UUID.randomUUID().toString() + System.currentTimeMillis();
|
String newCropFileName = genNewCropFileName();
|
||||||
mCropSourceFile = new File(fCropCacheDir, newCropFileName + "." + fileSuffix);
|
mCropSourceFile = new File(fCropCacheDir, newCropFileName + "." + fileSuffix);
|
||||||
mCropResultFile = new File(fCropCacheDir, "SelectCompress_" + newCropFileName + "." + fileSuffix);
|
mCropResultFile = new File(fCropCacheDir, "SelectCompress_" + newCropFileName + "." + fileSuffix);
|
||||||
|
|
||||||
@@ -415,6 +419,7 @@ public class BackgroundSourceUtils {
|
|||||||
*/
|
*/
|
||||||
public void commitPreviewSourceToCurrent() {
|
public void commitPreviewSourceToCurrent() {
|
||||||
LogUtils.d(TAG, "【commitPreviewSourceToCurrent调用】开始深拷贝预览Bean到正式Bean");
|
LogUtils.d(TAG, "【commitPreviewSourceToCurrent调用】开始深拷贝预览Bean到正式Bean");
|
||||||
|
//ToastUtils.show("【commitPreviewSourceToCurrent调用】开始深拷贝预览Bean到正式Bean");
|
||||||
currentBackgroundBean = new BackgroundBean();
|
currentBackgroundBean = new BackgroundBean();
|
||||||
currentBackgroundBean.setBackgroundFileName(previewBackgroundBean.getBackgroundFileName());
|
currentBackgroundBean.setBackgroundFileName(previewBackgroundBean.getBackgroundFileName());
|
||||||
currentBackgroundBean.setBackgroundFilePath(previewBackgroundBean.getBackgroundFilePath());
|
currentBackgroundBean.setBackgroundFilePath(previewBackgroundBean.getBackgroundFilePath());
|
||||||
|
|||||||
Reference in New Issue
Block a user