add

abstract fun add(@NonNull context: Context, @NonNull value: MeasurementValueConfiguration, @NonNull onSelectedExistingConfiguration: MeasurementValueConfigurationPickerListener): Boolean

Adds the provided configuration to the document. If it's already present in the document, a dialog is displayed and this function returns false. If the user decides via the dialog to use the already existing configuration, `value` will not be added to the document, `onDeletedUsedConfiguration` is called with the existing configuration as parameter and this function returns false.

If the function returns true, the configuration was not in use and was deleted without further ado.

Return

true if the configuration could be added right away, otherwise false which indicates that a dialog was displayed, informing the user that an identical configuration is already present in the document.

Parameters

context

The context to be used if we need to show a dialog.

value

The MeasurementValueConfiguration to be removed from the document.

onSelectedExistingConfiguration

callback which is called if `value` matches an already existing configuration and the user decides to use that one.


abstract fun add(@NonNull value: MeasurementValueConfiguration, addToUndo: Boolean)

Adds the `value` configuration to the document's configuration list. No checks are being made, no dialogs displayed.

Parameters

value

The MeasurementValueConfiguration to be added to the document.

addToUndo

Set to true if this add operation is supposed to be recorded to the undo stack.