Skip to main content
PESDK/Android/Guides/Border Frames
Language:

Configure Border Frames

PhotoEditor SDK supports several configuration options for the FrameToolPanel allowing flexible adaptation to different needs and use cases.

Set available tools#

By default, all available frame tools are enabled. In our example, we remove the option to change the frame width and only allow replacing it and changing its opacity. We do this by setting the optionList and adding only the tools that we need. Alternatively, this could also be done by removing the FrameOption with the id OPTION_WIDTH from the optionList.

Set allowed actions#

The quickOptionList contains all the actions that users can perform on a frame. It also contains SpaceItems that are used to space out the actions. In our example, we clear the quickOptionList as we don't want to allow any actions.

File:
class PhotoFrameConfiguration(private val activity: AppCompatActivity) : Example(activity) {
override fun invoke() {
// In this example, we do not need access to the Uri(s) after the editor is closed
// so we pass false in the constructor
val settingsList = PhotoEditorSettingsList(false)
// Set the source as the Uri of the image to be loaded
.configure<LoadSettings> {
it.source = activity.resourceUri(R.drawable.la)
}
settingsList.configure<UiConfigFrame> {
// By default all available frame tools are enabled
// For this example only a couple are enabled
val tools = listOf(
FrameOption(
FrameOption.OPTION_REPLACE,
ly.img.android.pesdk.ui.frame.R.string.pesdk_frame_button_replace,
ImageSource.create(ly.img.android.pesdk.ui.R.drawable.imgly_icon_replace)
),
FrameOption(
FrameOption.OPTION_OPACITY,
ly.img.android.pesdk.ui.frame.R.string.pesdk_frame_button_opacity,
ImageSource.create(ly.img.android.pesdk.ui.R.drawable.imgly_icon_option_opacity)
)
)
it.optionList.set(tools)
// By default the editor has all available overlay actions for this tool enabled
// For this example, we remove all the actions
it.quickOptionsList.clear()
}
// Start the photo editor using PhotoEditorBuilder
// The result will be obtained in onActivityResult() corresponding to EDITOR_REQUEST_CODE
PhotoEditorBuilder(activity)
.setSettingsList(settingsList)
.startActivityForResult(activity, EDITOR_REQUEST_CODE)
// Release the SettingsList once done
settingsList.release()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
intent ?: return
if (requestCode == EDITOR_REQUEST_CODE) {
// Wrap the intent into an EditorSDKResult
val result = EditorSDKResult(intent)
when (result.resultStatus) {
EditorSDKResult.Status.CANCELED -> showMessage("Editor cancelled")
EditorSDKResult.Status.EXPORT_DONE -> showMessage("Result saved at ${result.resultUri}")
else -> {
}
}
}
}
}