Class AnnotationCreationToolbar
-
- All Implemented Interfaces:
-
android.graphics.drawable.Drawable.Callback
,android.view.KeyEvent.Callback
,android.view.View.OnClickListener
,android.view.View.OnLongClickListener
,android.view.ViewManager
,android.view.ViewParent
,android.view.accessibility.AccessibilityEventSource
,com.pspdfkit.ui.special_mode.manager.AnnotationManager.OnAnnotationCreationModeChangeListener
,com.pspdfkit.ui.special_mode.manager.AnnotationManager.OnAnnotationCreationModeSettingsChangeListener
,com.pspdfkit.undo.OnUndoHistoryChangeListener
public class AnnotationCreationToolbar extends ContextualToolbar<T> implements AnnotationManager.OnAnnotationCreationModeSettingsChangeListener, AnnotationManager.OnAnnotationCreationModeChangeListener, OnUndoHistoryChangeListener
A toolbar used for creating annotations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interface
AnnotationCreationToolbar.ItemToAnnotationToolMapper
A mapper that allows you to map the IDs of AnnotationCreationToolbar menu items with the annotation tool (and variant) you want it to activate/deactivate. The annotation creation toolbar will automatically handle all the logic.
-
Field Summary
Fields Modifier and Type Field Description public AnnotationCreationToolbar.ItemToAnnotationToolMapper
itemToAnnotationToolMapper
-
Constructor Summary
Constructors Constructor Description AnnotationCreationToolbar(Context context)
AnnotationCreationToolbar(Context context, AttributeSet attrs)
AnnotationCreationToolbar(Context context, AttributeSet attrs, int defStyleAttr)
-
Method Summary
Modifier and Type Method Description void
bindController(@NonNull() AnnotationCreationController controller)
Binds controller for managing annotation creation mode. void
unbindController()
Unbinds controller for managing annotation creation mode. boolean
isControllerBound()
Returns true
if the controller is bound.void
onChangeAnnotationCreationMode(@NonNull() AnnotationCreationController controller)
Called when the annotation creation mode has changed, meaning another annotation type is being selected for creation. List<ContextualToolbarMenuItem>
onMenuItemsGrouped(@NonNull() List<ContextualToolbarMenuItem> menuItems)
Called when the menu items are being grouped. void
setItemToAnnotationToolMapper(@Nullable() AnnotationCreationToolbar.ItemToAnnotationToolMapper itemToAnnotationToolMapper)
Mapper for mapping annotation creation tool menu items with the tool/variant they want to activate. void
onAnnotationCreationModeSettingsChange(@NonNull() AnnotationCreationController controller)
Called when the settings changed in the active annotation creation mode. void
onUndoHistoryChanged(@NonNull() UndoManager undoManager)
Notifies the observer that the undo history has changed inside the undo manager. void
onEnterAnnotationCreationMode(@NonNull() AnnotationCreationController controller)
Called when the annotation creation mode has been entered. void
onExitAnnotationCreationMode(@NonNull() AnnotationCreationController controller)
Called when the annotation creation mode has been exited. void
setShouldShowStylusButton(boolean shouldShow)
Whether to show the stylus button on the annotation toolbar when a stylus is detected as connected. -
-
Constructor Detail
-
AnnotationCreationToolbar
AnnotationCreationToolbar(Context context)
-
AnnotationCreationToolbar
AnnotationCreationToolbar(Context context, AttributeSet attrs)
-
AnnotationCreationToolbar
AnnotationCreationToolbar(Context context, AttributeSet attrs, int defStyleAttr)
-
-
Method Detail
-
bindController
void bindController(@NonNull() AnnotationCreationController controller)
Binds controller for managing annotation creation mode.
- Parameters:
controller
- Annotation creation mode controller provided when entering annotation creation mode.
-
unbindController
void unbindController()
Unbinds controller for managing annotation creation mode.
-
isControllerBound
boolean isControllerBound()
Returns
true
if the controller is bound.
-
onChangeAnnotationCreationMode
void onChangeAnnotationCreationMode(@NonNull() AnnotationCreationController controller)
Called when the annotation creation mode has changed, meaning another annotation type is being selected for creation. Provided controller holds all the new data.
- Parameters:
controller
- Provided controller for managing annotation creation mode.
-
onMenuItemsGrouped
@NonNull() List<ContextualToolbarMenuItem> onMenuItemsGrouped(@NonNull() List<ContextualToolbarMenuItem> menuItems)
Called when the menu items are being grouped. This allows us to set default selected tool and initialize style indicator icons.
- Parameters:
menuItems
- Grouped menu items.- Returns:
List of grouped items to be showed at the end.
-
setItemToAnnotationToolMapper
void setItemToAnnotationToolMapper(@Nullable() AnnotationCreationToolbar.ItemToAnnotationToolMapper itemToAnnotationToolMapper)
Mapper for mapping annotation creation tool menu items with the tool/variant they want to activate.
- Parameters:
itemToAnnotationToolMapper
- Mapper to register ornull
to remove any registered mapper.
-
onAnnotationCreationModeSettingsChange
void onAnnotationCreationModeSettingsChange(@NonNull() AnnotationCreationController controller)
Called when the settings changed in the active annotation creation mode. You can then get the new values from the provided AnnotationCreationController.
- Parameters:
controller
- Provided controller for managing annotation creation mode, holds values such as color, thickness, etc.
-
onUndoHistoryChanged
void onUndoHistoryChanged(@NonNull() UndoManager undoManager)
Notifies the observer that the undo history has changed inside the undo manager.
- Parameters:
undoManager
- Undo manager this listener is registered to.
-
onEnterAnnotationCreationMode
void onEnterAnnotationCreationMode(@NonNull() AnnotationCreationController controller)
Called when the annotation creation mode has been entered.
- Parameters:
controller
- Provided controller for managing annotation creation mode.
-
onExitAnnotationCreationMode
void onExitAnnotationCreationMode(@NonNull() AnnotationCreationController controller)
Called when the annotation creation mode has been exited.
- Parameters:
controller
- Provided controller for managing annotation creation mode.
-
setShouldShowStylusButton
void setShouldShowStylusButton(boolean shouldShow)
Whether to show the stylus button on the annotation toolbar when a stylus is detected as connected.
-
-
-
-