Skip to main content
Language:

Single Tool Use

When you want customers to perform only one action on the photo and skip the main menu, you can use the single tool mode in VideoEditor SDK. Single tool mode supported tools are Trim , Composition, Transform, Filters, Adjustments, Focus, Overlays, and Brush.

To open the editor in single tool mode, two conditions need to be satisfied -

  • UiConfigMainMenu.singleToolUse should be true
  • UiConfigMainMenu.toolList should contain only one supported tool

Configuration#

The default value of UiConfigMainMenu.singleToolUse is true. Here, we use UiConfigMainMenu.setToolList() and add a single tool. Make sure to only include a tool that is included in your license.

File:
class VideoSingleTool(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 = VideoEditorSettingsList(false)
// Set the source as the Uri of the video to be loaded
.configure<LoadSettings> {
it.source = activity.resourceUri(R.raw.skater)
}
.configure<UiConfigMainMenu> {
// By default, single tool use is enabled.
// it.singleToolUse = false // To disable single tool use
// Set one of the supported tools to be displayed as single tool
it.setToolList(
ToolItem(
VideoCompositionToolPanel.TOOL_ID,
ly.img.android.pesdk.ui.video_composition.R.string.vesdk_video_composition_title_name,
ImageSource.create(ly.img.android.pesdk.ui.R.drawable.imgly_icon_tool_video_composition)
)
)
}
// Start the video editor using VideoEditorBuilder
// The result will be obtained in onActivityResult() corresponding to EDITOR_REQUEST_CODE
VideoEditorBuilder(activity)
.setSettingsList(settingsList)
.startActivityForResult(activity, EDITOR_REQUEST_CODE)
// Release the SettingsList once done
settingsList.release()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
super.onActivityResult(requestCode, resultCode, 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 -> {
}
}
}
}
}