public void drawAnnotations() {
   mAnnotationLabelOverlay.removeAllViews();
   if (mQueryResult == null) {
     return;
   }
   int[] actImageRect = getBitmapPositionInsideImageView(mImageView);
   List<Annotation> annotations = mQueryResult.annotations;
   int index = -1;
   for (Annotation anno : annotations) {
     index++;
     LabelView label = new LabelView(getActivity());
     label.mLabelText.setVisibility(View.VISIBLE);
     label.mLabelText.setText(anno.text);
     label.mPosition = index;
     float padding = 100;
     float cx = anno.getCenterX() * actImageRect[2];
     float cy = anno.getCenterY() * actImageRect[3];
     if (cx > actImageRect[2] - padding) {
       cx = actImageRect[2] - padding + randomInt(-30, 30);
     } else if (cx < padding) {
       cx = padding + randomInt(-30, 30);
     }
     if (cy > actImageRect[3] - padding) {
       cy = actImageRect[3] - padding + randomInt(-30, 30);
     } else if (cy < padding) {
       cy = padding + randomInt(-30, 30);
     }
     RelativeLayout.LayoutParams params =
         new RelativeLayout.LayoutParams(
             ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT);
     params.leftMargin = (int) cx + actImageRect[0];
     params.topMargin = (int) cy + actImageRect[1];
     mAnnotationLabelOverlay.addView(label, params);
     label.setOnClickListener(
         new View.OnClickListener() {
           @Override
           public void onClick(View v) {
             LabelView view = (LabelView) v;
             Log.d("label position: ", "" + view.mPosition);
             int position = view.mPosition;
             if (position >= 0 && position < mAnnotationList.size()) {
               mLinearLayoutManager.scrollToPosition(position);
             }
             //                    String text = view.mLabelText.getText().toString();
             //                    AnnotationDetailFragment fragment = new
             // AnnotationDetailFragment();
             //                    Bundle args = new Bundle();
             //                    args.putString("annotation_text", text);
             //                    fragment.setArguments(args);
             //
             // getFragmentManager().beginTransaction().replace(R.id.frame_container,
             // fragment).addToBackStack(null).commit();
           }
         });
     if (mLabels == null) {
       mLabels = new ArrayList<>();
     }
     mLabels.add(label);
   }
 }
 public void showClickedAnnotationLabel(int position) {
   for (int index = 0; index < mAnnotationList.size(); index++) {
     LabelView label = mLabels.get(index);
     if (index == position) {
       label.setVisibility(View.VISIBLE);
     } else {
       label.setVisibility(View.INVISIBLE);
     }
   }
 }
 public void showAllLabels() {
   for (LabelView label : mLabels) {
     label.setVisibility(View.VISIBLE);
   }
 }