Initialization problem with AnnotationToolbarComponent

Product: Native Android SDK

Product Version: 9.4.2 to 10.4.0

Please give a brief summary of your issue:
updating 9.4.2 to 10.4.0 cause compilation issue

Please describe your issue and provide steps to reproduce it:
We have a custom class instantiating a TabletAnnotationToolbarComponent but after updating our sdk level it looks as thought the constructors needed to instantiate a TabletAnnotationToolbarComponent. This is what is used to be in 9.4.2:

currentPdfViewCtrlFragment?.toolManager?.let { toolManager ->
            val annotationBar = view?.findViewById<FrameLayout>(R.id.annotation_toolbar)
            val vmProvider = ViewModelProvider(this)
            val toolManagerVm: ToolManagerViewModel =
                vmProvider[ToolManagerViewModel::class.java]
            toolManager.addCustomizedTool(CheckmarkStamp(currentPdfViewCtrlFragment.pdfViewCtrl))
            toolManager.addCustomizedTool(XStamp(currentPdfViewCtrlFragment.pdfViewCtrl))
            toolManager.enableAnnotManager(if (hasAnnotationPermission) userID else "-1")
            toolManagerVm.toolManager = toolManager

            val presetVm: PresetBarViewModel = vmProvider[PresetBarViewModel::class.java]
            val annotToolbarVm: AnnotationToolbarViewModel =
                vmProvider[AnnotationToolbarViewModel::class.java]

            annotationView = AnnotationToolbarView(annotationBar ?: return@let)
            // Create our UI component for the annotation toolbar
            mAnnotationToolbarComponent = TabletAnnotationToolbarComponent(
                /* lifecycleOwner = */ this,
                /* fragmentManager = */ childFragmentManager,
                /* annotationToolbarViewModel = */ annotToolbarVm,
                /* presetBarViewModel = */ presetVm,
                /* toolManagerViewModel = */ toolManagerVm,
                /* signatureViewModel = */ this.mSignatureViewModel,
                /* view = */ annotationView ?: return@let,
                /* presetBarView = */ this.presetBarComponent,
                /* isInsideAnnotationToolbar = */ this.useTabletLayout(),
                /* toolsToHidePresetBar = */ null,
                /* hidePresetBar = */ this.mHidePresetBar,
            )
}

This code above now won’t compile. How can I convert the 9.4.2 custom toolbar to work in the 10.4.0 constructor? I can’t find any documentation on this.

Please provide a link to a minimal sample where the issue is reproducible:

1 Like

Hi Seth,
Theres been a change to the TabletAnnotationToolbarComponent constructor in 10.2.0 of our Apryse Android release, as documented here:

You will need to now provide this argument: TabletPresetBarView

1 Like

@ama1 Could you give an example of how to initialize the TabletPresetBarView please? The documentation doesn’t really give an example of what to pass in as the parent: View

1 Like

The parent should be the parent of the AnnotationToolbarView.
From your example it looks like it should be annotationBar

val tabletPresetBarView = TabletPresetBarView(
       annotationBar,
       AnnotationToolbarPosition.TOP
)
1 Like