@Override
        public void onTextChanged(
            final CharSequence s, final int start, final int before, final int count) {

          mLogger.info("onTextChanged", view);

          if ((view != null) && (view.getContent() instanceof EditableDrawable)) {
            final EditableDrawable editable = (EditableDrawable) view.getContent();

            if (!editable.isEditing()) return;

            editable.setText(s.toString());

            if (topHv.equals(view)) {
              editTopButton.setText(s);
              clearButtonTop.setVisibility(
                  s != null && s.length() > 0 ? View.VISIBLE : View.INVISIBLE);
            } else if (bottomHv.equals(view)) {
              editBottomButton.setText(s);
              clearButtonBottom.setVisibility(
                  s != null && s.length() > 0 ? View.VISIBLE : View.INVISIBLE);
            }

            view.forceUpdate();
            setIsChanged(true);
          }
        }
  /**
   * Begins an edit view.
   *
   * @param hv the hv
   */
  private void beginEditView(DrawableHighlightView hv) {
    mLogger.info("beginEditView");
    final EditableDrawable text = (EditableDrawable) hv.getContent();

    if (hv == topHv) {
      endEditView(bottomHv);
    } else {
      endEditView(topHv);
    }

    if (!text.isEditing()) {
      text.beginEdit();
      beginEditText(hv);
    }
  }
  /**
   * Terminates an edit view.
   *
   * @param hv the hv
   */
  private void endEditView(DrawableHighlightView hv) {
    EditableDrawable text = (EditableDrawable) hv.getContent();
    mLogger.info("endEditView", text.isEditing());
    if (text.isEditing()) {
      text.endEdit();
      endEditText(hv);
    }

    CharSequence value = text.getText();
    if (topHv.equals(hv)) {
      editTopButton.setText(value);
      clearButtonTop.setVisibility(
          value != null && value.length() > 0 ? View.VISIBLE : View.INVISIBLE);
    } else if (bottomHv.equals(hv)) {
      editBottomButton.setText(value);
      clearButtonBottom.setVisibility(
          value != null && value.length() > 0 ? View.VISIBLE : View.INVISIBLE);
    }
  }
  /**
   * Begin edit text.
   *
   * @param view the view
   */
  private void beginEditText(final DrawableHighlightView view) {
    mLogger.info("beginEditText", view);

    EditText editText = null;

    if (view == topHv) {
      editText = editTopText;
    } else if (view == bottomHv) {
      editText = editBottomText;
    }

    if (editText != null) {
      mEditTextWatcher.view = null;
      editText.removeTextChangedListener(mEditTextWatcher);

      final EditableDrawable editable = (EditableDrawable) view.getContent();
      final String oldText = (String) editable.getText();
      editText.setText(oldText);
      editText.setSelection(editText.length());
      editText.setImeOptions(EditorInfo.IME_ACTION_DONE);
      editText.requestFocusFromTouch();

      Handler handler = new Handler();
      ResultReceiver receiver = new ResultReceiver(handler);

      if (!mInputManager.showSoftInput(editText, 0, receiver)) {
        mInputManager.toggleSoftInput(InputMethodManager.SHOW_FORCED, 0); // TODO: verify
      }

      mEditTextWatcher.view = view;
      editText.setOnEditorActionListener(this);
      editText.addTextChangedListener(mEditTextWatcher);

      ((ImageViewDrawableOverlay) mImageView).setSelectedHighlightView(view);
      ((EditableDrawable) view.getContent())
          .setText(((EditableDrawable) view.getContent()).getText());
      view.forceUpdate();
    }
  }