class VideoAnnotation(private val activity: AppCompatActivity) : Example(activity) {
override fun invoke() {
val toolList = arrayListOf(
ToolItem(
StickerToolPanel.TOOL_ID,
ly.img.android.pesdk.ui.sticker.R.string.pesdk_sticker_title_name,
ImageSource.create(ly.img.android.pesdk.ui.R.drawable.imgly_icon_tool_sticker)
),
ToolItem(
TextToolPanel.TOOL_ID,
ly.img.android.pesdk.ui.text.R.string.pesdk_text_title_name,
ImageSource.create(ly.img.android.pesdk.ui.R.drawable.imgly_icon_tool_text)
),
ToolItem(
BrushToolPanel.TOOL_ID,
ly.img.android.pesdk.ui.brush.R.string.pesdk_brush_title_name,
ImageSource.create(ly.img.android.pesdk.ui.R.drawable.imgly_icon_tool_brush)
)
)
val annotationStickers = listOf(
ImageStickerItem(
"imgly_sticker_shapes_arrow_02",
ly.img.android.pesdk.assets.sticker.shapes.R.string.imgly_sticker_name_shapes_arrow_02,
ImageSource.create(ly.img.android.pesdk.assets.sticker.shapes.R.drawable.imgly_sticker_shapes_arrow_02)
),
ImageStickerItem(
"imgly_sticker_shapes_arrow_03",
ly.img.android.pesdk.assets.sticker.shapes.R.string.imgly_sticker_name_shapes_arrow_03,
ImageSource.create(ly.img.android.pesdk.assets.sticker.shapes.R.drawable.imgly_sticker_shapes_arrow_03)
),
ImageStickerItem(
"imgly_sticker_shapes_badge_11",
ly.img.android.pesdk.assets.sticker.shapes.R.string.imgly_sticker_name_shapes_badge_11,
ImageSource.create(ly.img.android.pesdk.assets.sticker.shapes.R.drawable.imgly_sticker_shapes_badge_11)
),
ImageStickerItem(
"imgly_sticker_shapes_badge_12",
ly.img.android.pesdk.assets.sticker.shapes.R.string.imgly_sticker_name_shapes_badge_12,
ImageSource.create(ly.img.android.pesdk.assets.sticker.shapes.R.drawable.imgly_sticker_shapes_badge_12)
),
ImageStickerItem(
"imgly_sticker_shapes_badge_36",
ly.img.android.pesdk.assets.sticker.shapes.R.string.imgly_sticker_name_shapes_badge_36,
ImageSource.create(ly.img.android.pesdk.assets.sticker.shapes.R.drawable.imgly_sticker_shapes_badge_36)
)
)
val annotationStickersCategory = StickerCategoryItem(
"annotation_stickers",
"Annotation",
ImageSource.create(ly.img.android.pesdk.assets.sticker.shapes.R.drawable.imgly_sticker_shapes_arrow_02),
annotationStickers
)
val settingsList = VideoEditorSettingsList(false)
.configure<LoadSettings> {
it.source = activity.resourceUri(R.raw.skater)
}
settingsList.configure<UiConfigMainMenu> {
it.setToolList(toolList)
}.configure<UiConfigSticker> {
it.setStickerLists(annotationStickersCategory)
}
VideoEditorBuilder(activity)
.setSettingsList(settingsList)
.startActivityForResult(activity, EDITOR_REQUEST_CODE)
settingsList.release()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {
super.onActivityResult(requestCode, resultCode, intent)
intent ?: return
if (requestCode == EDITOR_REQUEST_CODE) {
val result = EditorSDKResult(intent)
when (result.resultStatus) {
EditorSDKResult.Status.CANCELED -> showMessage("Editor cancelled")
EditorSDKResult.Status.EXPORT_DONE -> showMessage("Result saved at ${result.resultUri}")
else -> {
}
}
}
}
}