1

每当激活编辑器意图时,我都会遇到问题,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});
    }

我意识到上面的代码实际上可能正在执行该保存,但是它是一个自动生成的文件,有什么方法可以防止保存发生吗?

4

1 回答 1

0

使用图像编辑器自动保存

当用户关闭图像编辑器时,Creative SDK 图像编辑器会保存编辑后的图像。无法阻止这种行为。

保存的图像Uri在方法中传回应用程序的 Activity onActivityResult()。有关基本演示,请参阅GitHub 上的此示例应用程序

指示已编辑图像的保存位置

可以使用该withOutput()方法指定保存编辑图像的位置,并将其传递给File.

您可以在 Creative SDK 开发人员门户的图像编辑器指南中查看所有可选方法。

请注意,开发人员门户当前声明您应该将 a 传递UriwithOutput(),但这是不正确的。你应该传入一个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();
于 2016-07-11T14:46:30.907 回答