class PhotoAdjustmentConfiguration(private val activity: AppCompatActivity) : Example(activity) {
override fun invoke() {
val settingsList = PhotoEditorSettingsList(false)
.configure<LoadSettings> {
it.source = activity.resourceUri(R.drawable.la)
}
settingsList.configure<UiConfigAdjustment> {
val tools = it.optionList.subList(0, 5)
tools += AdjustOption(
AdjustmentToolPanel.OPTION_TEMPERATURE,
ly.img.android.pesdk.ui.adjustment.R.string.pesdk_adjustments_button_temperatureTool,
ImageSource.create(ly.img.android.pesdk.ui.adjustment.R.drawable.imgly_icon_option_tempature)
)
tools += AdjustOption(
AdjustmentToolPanel.OPTION_GAMMA,
ly.img.android.pesdk.ui.adjustment.R.string.pesdk_adjustments_button_temperatureTool,
ImageSource.create(ly.img.android.pesdk.ui.adjustment.R.drawable.imgly_icon_option_tempature),
min = -0.5f,
max = 0.4f,
)
it.setOptionList(ArrayList(tools))
}
PhotoEditorBuilder(activity)
.setSettingsList(settingsList)
.startActivityForResult(activity, EDITOR_REQUEST_CODE)
settingsList.release()
}
override fun onActivityResult(requestCode: Int, resultCode: Int, intent: 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 -> {
}
}
}
}
}