Annotate Toolbar


Contents

1. Start Annotation

2. Stop Annotation

3. Colors

1. Start Annotation

To start annotation, firstly you need to get the InMeetingAnnotationController instance from ZoomSDK:

InMeetingAnnotationController mAnnotationController = ZoomSDK.getInstance().getInMeetingService().getInMeetingAnnotationController();

Then, simply call startAnnotation method to start annotation:

private void startAnnotation()
{

  mAnnotationController.startAnnotation();

  mLineWidth = 2;

  setRandomColor();
  mAnnotationController.setToolType(AnnotationToolType.ANNO_TOOL_TYPE_PEN);
  updateSelection(mPen);
  mArrow.setVisibility(mAnnotationController.isPresenter() ? GONE : VISIBLE);
  mSpotlight.setVisibility(mAnnotationController.isPresenter() ? VISIBLE : GONE);
}

2. Stop Annotation

Stop annotation service is similar to start annotation, call stopAnnotation method in mAnnotationController to stop the service:

public void stopAnnotation() {

  if(mAnnotationController == null) return;

  mAnnotationController.stopAnnotation();

  mAnnotationController.setToolType(AnnotationToolType.ANNO_TOOL_TYPE_PEN);
  updateSelection(mPen);
  if(null != mColorTableView && mColorTableView.isShowing())
    mColorTableView.dismiss();

  if(null != mSaveTableView && mSaveTableView.isShowing())
    mSaveTableView.dismiss();
}

3. Colors

You can override the onColorChanged and the onColorPicked method to add behavior to the above actions:

@Override
public void onColorChanged(View view, int newColor) {
}

@Override
public void onColorPicked(View view, int newColor) {
  if(mAnnotationController != null)
    mAnnotationController.setToolColor(newColor);
  mColorImage.setColor(newColor);
}

If you want to have random color, you can implement a setRandomColor method to achieve this:

private void setRandomColor()
{
  Random rand = new Random();
  int index = rand.nextInt(9);
  int color = ColorTable.COLOR_RED;
  if(null != mColorTable){
    color = mColorTable.getColorByIndex(index);
  }
  if(mAnnotationController != null)
    mAnnotationController.setToolColor(color);
  mColorImage.setColor(color);
}