Skip to main content
Language:

Configure Text Design

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

Set available colors#

The default color palette provides multiple colors. For this example, we only provide a small selection of colors.

Set allowed actions#

The quickOptionList contains all the actions that users can perform on a text design. It also contains SpaceItems that are used to space out the actions. In our example, we remove the last three elements of the list, thus removing the undo and redo actions essentially.

File:
class VideoTextDesignConfiguration(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)
}
settingsList.configure<UiConfigTextDesign> { textDesignConfig ->
// By default the editor provides a variety of different colors to customize the color of the text design
// For this example only a small selection of colors is enabled
textDesignConfig.setTextColorList(
ColorItem(ly.img.android.pesdk.ui.R.string.pesdk_common_title_whiteColor, ColorAsset(-0x1)),
ColorItem(ly.img.android.pesdk.ui.R.string.pesdk_common_title_blackColor, ColorAsset(-0x1000000))
)
// By default the editor has all available overlay actions for this tool enabled
// For this example the last 3 items (space, undo, redo) are removed
repeat(3) {
textDesignConfig.quickOptionList.removeLast()
}
}
// 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?) {
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 -> {
}
}
}
}
}