Migration from v7
1. Update the Plugin to v8
There are no compatibility changes on the Gradle Plugin itself. Simply update the version.
// Add the PESDK repository and plugin dependency
buildscript {
repositories {
google()
gradlePluginPortal()
maven { url 'https://artifactory.img.ly/artifactory/imgly' }
}
dependencies {
// Insert the latest SDK version number here. You will find it here https://github.com/imgly/pesdk-android-demo/releases
classpath 'ly.img.android.pesdk:plugin:8.1.2'
}
}
2. Update the Kotlin version
Make sure you are using the Kotlin version 1.4.10 or higher.
3. Update your App for scoped storage.
Version 8 is now scoped storage compatible. See Storage updates in Android 11 for more details.
You can and should remove the requestLegacyExternalStorage
attribute from your AndroidManifest.xml. Make sure, that the rest of your app is ScopedStorage compatible before you remove the flag.
4. Do not mix up SaveSettings
Use PhotoEditorSaveSettings
to specify all your export settings and the export destination.
SaveSettings
are now an abstract class, you can use them to set the destination path of PhotoEditorSDK and VideoEditorSDK.
NOTE: Do not mix up PhotoEditorSaveSettings and VideoEditorSaveSettings in the same SettingsList, this is not supported!
5. Choose the destination for your export.
We have to break the API of PhotoEditorSaveSettings
, we removed the methods setOutputFilePath
, setExportDir
and setExportPrefix
.
Since v8 use can use one of the following 3 options to save your export.
-
Option:
PhotoEditorSaveSettings.setOutputToTemp()
In this case the result is saved into a temporary file. The Editor does not need any permission to write the file. You have to move or remove this file after you are done with it, otherwise, you will waste Storage space. -
Option:
PhotoEditorSaveSettings.setOutputToUri(outputUri: Uri)
In this case the result is saved into your file- or content-uri. The Editor will NOT ask for any write permission! You have to make sure that you have the right to write to this Uri. If not the user can not export! -
Option:
PhotoEditorSaveSettings.setOutputToGallery(relativePath: String, name:String)
In this case the result is saved into to devices gallery. The editor will ask for write permission before starting the exporting. You can prevent that by asking the user for this permission before starting the Editor. The name of the file can have SimpleDateFormat patterns likeimg_<yyyy_MM_dd_HH_mm_ss>
the angled brackets are replaced with the result ofSimpleDateFormat("yyyy_MM_dd_HH_mm_ss", Locale.US).format(Date())
The default locale isLocale.US
you can change it to the device locale by set the static variableAbstractSaveSettings.locale = Locale.getDefault()
. See SimpleDateFormat for more details.
6. We removed PhotoEditorSaveSettings.setSavePolicy
.
Use PhotoEditorSaveSettings.setOutputMode
instead.
There are only 3 options now.
-
Option: OutputMode.EXPORT_ALWAYS, the editor always starts the export. This is useful when you want to make sure your output format is being followed.
-
Option: OutputMode.EXPORT_IF_NECESSARY, the editor only starts the export if changes have been made to the input. Your export settings may not be taken into account in this case.
-
Option: OutputMode.EXPORT_ONLY_SETTINGS_LIST, the editor will never export. This is useful, for example, if you only want to save a serialization.
7. We changed the parameter type of PhotoEditorSaveSettings.setExportFormat
Use the enum ImageExportFormat
as input parameter instead.
8. Some of the SaveSettings functionality is now in EditorSaveState.
SaveSettings.saveResul
t is nowEditorSaveState.saveResult
SaveSettings.Events.EXPORT_START
is nowEditorSaveState.Events.EXPORT_START
SaveSettings.Events.EXPORT_DONE
is nowEditorSaveState.Events.EXPORT_DONE
SaveSettings.Events.EXPORT_START_IN_BACKGROUND
is nowEditorSaveState.Events.EXPORT_START_IN_BACKGROUND
9. Internal Kotlin converting of some classes
We have converted some of our classes into Kotlin. The signature should be the same in Java. But it can result in Kotlin syntax changes on your side like:
- Changed Nullable and Nonnull types.
- Changed variable/getter/setter access.