modify

Modifies an existing MeasurementValueConfiguration in the current document. Any measurement annotations that use the original configuration will be updated, too. On top of that, it is checked if the modified value matches an already existing configuration. In that case a dialog is displayed and asks how to proceed. If the dialog is confirmed with "Use Existing" the provided callback `onSelectedExistingConfiguration` informs about the used configuration. The original configuration will be deleted in this case.

Return

true if the configuration could be modified to `newValue`, otherwise false which indicates that a dialog was displayed to resolve the conflict.

Parameters

context

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

oldValue

The original MeasurementValueConfiguration to be changed.

newValue

The value to change it to.

onSelectedExistingConfiguration

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


abstract fun modify(@NonNull oldValue: MeasurementValueConfiguration, @NonNull newValue: MeasurementValueConfiguration, modifyAssociatedAnnotations: Boolean, addToUndo: Boolean)

Replaces the `oldValue` configuration straightforward in the document's configuration list with `newValue`. No checks are being made, no dialogs displayed.

Parameters

oldValue

The original MeasurementValueConfiguration to be changed.

newValue

The value to change it to.

modifyAssociatedAnnotations

if true all measurement annotations that use the scale and precision of `oldValue` will be updated to the scale and precision of `newValue`.

addToUndo

Set to true if the modification is supposed to be recorded to the undo stack.