Language:
Configure Adjustments
PhotoEditor SDK supports several configuration options for the AdjustmentToolPanel
allowing flexible adaptation to different needs and use cases.
Set available tools#
The default configuration includes several different tools.
For the sake of this example, we configure the list of adjustment tools by picking the first five default tools and adding the temperature tool manually.
Note how an AdjustOption
also takes in a name
and iconSource
to further allow you to customize each adjustment as per your needs.
File:
class PhotoAdjustmentConfiguration(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 constructorval 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<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))it.setOptionList(ArrayList(tools))}// Start the photo editor using PhotoEditorBuilder// The result will be obtained in onActivityResult() corresponding to EDITOR_REQUEST_CODEPhotoEditorBuilder(activity).setSettingsList(settingsList).startActivityForResult(activity, EDITOR_REQUEST_CODE)// Release the SettingsList once donesettingsList.release()}override fun onActivityResult(requestCode: Int, resultCode: Int, intent: Intent?) {intent ?: returnif (requestCode == EDITOR_REQUEST_CODE) {// Wrap the intent into an EditorSDKResultval result = EditorSDKResult(intent)when (result.resultStatus) {EditorSDKResult.Status.CANCELED -> showMessage("Editor cancelled")EditorSDKResult.Status.EXPORT_DONE -> showMessage("Result saved at ${result.resultUri}")else -> {}}}}}
Previous
Overview
Next
Overview