我在这里有一个问题,每当编辑器意图被激活时,sdk自动将图像保存到图库。在编辑完成之后,再一次在意图内完成。我怎么才能防止这里的自动储蓄?
AdobeImageEditorActivity.class
protected void performSave(Bitmap bitmap, Uri saveUri, CompressFormat outputFormat, int quality, boolean hires, AdobeImageEditorActivity.FinalAction action) {
logger.info("performSave, uri:%s, quality: %d, action:%s", new Object[]{saveUri, Integer.valueOf(quality), action});
File destFile;
if(saveUri != null) {
destFile = new File(saveUri.getPath());
} else {
destFile = this.getDefaultOutputDestination(outputFormat);
}
try {
logger.log("trying to create the new file...");
if(!destFile.exists() && !destFile.createNewFile()) {
logger.error("Failed to create the file");
}
} catch (IOException var11) {
var11.printStackTrace();
try {
logger.error("using a temporary file!");
destFile = File.createTempFile("aviary-image-", ".jpeg");
} catch (IOException var10) {
var10.printStackTrace();
}
}
LocalDataService service = (LocalDataService)this.getMainController().getService(LocalDataService.class);
assert service != null;
service.setDestImageUri(Uri.parse(destFile.getAbsolutePath()));
AdobeImageEditorActivity.SaveHiResImageTask mSaveTask = new AdobeImageEditorActivity.SaveHiResImageTask(destFile, action, outputFormat, quality, hires);
mSaveTask.execute(new Bitmap[]{bitmap});
}我意识到上面的代码可能实际上正在执行该保存,但是它是一个自动生成的文件,有什么方法可以防止保存发生吗?
发布于 2016-07-11 14:46:30
用图像编辑器自动保存
当用户关闭图像编辑器时,Creative图像编辑器将保存已编辑的图像。阻止这种行为是不可能的。
保存的图像Uri被传递回应用程序在onActivityResult()方法中的活动。有关基本演示,请参见这个在GitHub上的示例应用程序。
指定保存已编辑图像的位置。
可以通过使用withOutput()方法指定所编辑的图像的保存位置,并将其传递给File。
您可以在Creative开发人员门户的图像编辑器指南上看到所有可选方法。
请注意,开发人员门户当前声明应该将Uri传递给withOutput(),但这是不正确的。你应该传入一个File
/* 1) Change the argument to your desired location */
File file = new File(Environment.getExternalStorageDirectory() + File.separator + "test.jpg");
try {
file.createNewFile();
} catch (IOException e) {
e.printStackTrace();
}
Intent imageEditorIntent = new AdobeImageIntent.Builder(this)
.setData(imageUri)
.withOutput(file) /* 2) Pass the File here */
.build();https://stackoverflow.com/questions/38119644
复制相似问题