@Override
 public void commitTyped() {
   if (typedText.length() > 0) {
     commitText(typedText, typedText.length());
     clearTypedText();
   }
 }
  @Override
  public int translateKeyDown(int unicodeChar) {
    if (!Strings.isEmpty(typedText)) {
      char accent = typedText.charAt(typedText.length() - 1);
      int composed = KeyEvent.getDeadChar(accent, unicodeChar);

      if (composed != 0) {
        unicodeChar = composed;
        typedText.setLength(typedText.length() - 1);
      }
    }

    return unicodeChar;
  }
  @Override
  public boolean handleBackspace() {
    boolean changed = false;

    int length = typedText.length();

    final InputConnection ic = getCurrentInputConnection();
    if (length > 1) {
      typedText.delete(length - 1, length);
      ic.setComposingText(typedText, 1);
      changed = true;
    } else if (length > 0) {
      clearTypedText();
      commitText(ic, "", 0);
      changed = true;
    }

    return changed;
  }