Nutrient 2024.7 migration guide

This guide outlines the changes to Nutrient Android SDK 2024.7.

Breaking API Changes

Read on to discover breaking changes.

ElectronicSignatureOptions

  • ElectronicSignatureOptions#Builder has been removed and replaced with a Kotlin data class:

// Before
ElectronicSignatureOptions.Builder()
    .signatureSavingStrategy(configuration.signatureSavingStrategy)
    .signatureColorOptions(configuration.signatureColorOptions)
    .signatureCreationModes(configuration.signatureCreationModes)
    .enableStylusOnDetection(configuration.enableStylusOnDetection())
    .build()

// After
ElectronicSignatureOptions(
    signatureSavingStrategy = configuration.signatureSavingStrategy,
    signatureColorOptions = configuration.signatureColorOptions,
    signatureCreationModes = configuration.signatureCreationModes
)
// Before
new ElectronicSignatureOptions.Builder()
        .signatureSavingStrategy(SignatureSavingStrategy.SAVE_IF_SELECTED)
        .signatureColorOptions(SignatureColorOptions.fromColorInt(Color.BLACK, Color.GRAY, Color.RED))
        .signatureCreationModes(Arrays.asList(SignatureCreationMode.DRAW, SignatureCreationMode.TYPE))
        .build();

// After
new ElectronicSignatureOptions(
        SignatureSavingStrategy.SAVE_IF_SELECTED,
        SignatureColorOptions.fromColorInt(Color.BLACK, Color.GRAY, Color.RED),
        Arrays.asList(SignatureCreationMode.DRAW, SignatureCreationMode.TYPE));
  • If calling from Java, you now need to use Companion to use getAvailableFonts:

// Before
Set<Font> fonts = ElectronicSignatureOptions.getAvailableFonts(getContext());
// After
Set<Font> fonts = ElectronicSignatureOptions.Companion.getAvailableFonts(getContext());

New API

  • Disable the stylus button in the annotation toolbar with the following:

public void onPrepareContextualToolbar(@NonNull ContextualToolbar toolbar) {
        if (toolbar instanceof AnnotationCreationToolbar annotationCreationToolbar) {
            annotationCreationToolbar.setShouldShowStylusButton(false);
        }
    }

For more details, check out the changelog.