Program: 114362
Project: 114362
Buggy source:
private void initListeners(){
  messageEditText.setOnTouchListener(new View.OnTouchListener(){
    @Override public boolean onTouch(    View view,    MotionEvent event){
      hideSmileLayout();
      if (!isTypingNow) {
        startTypingMessage();
      }
      return false;
    }
  }
);
  messageEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      if (TextUtils.isEmpty(charSequence) || TextUtils.isEmpty(charSequence.toString().trim())) {
        sendButton.setEnabled(false);
      }
 else {
        sendButton.setEnabled(true);
      }
      if (!isTypingNow) {
        startTypingMessage();
      }
      checkStopTyping();
    }
  }
);
  smilePanelImageButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isSmilesLayoutShowing()) {
        hideSmileLayout();
        KeyboardUtils.showKeyboard(BaseDialogActivity.this);
      }
 else {
        KeyboardUtils.hideKeyboard(BaseDialogActivity.this);
        needToShowSmileLayout=true;
        if (keyboardHeight == Consts.ZERO_INT_VALUE) {
          showSmileLayout(Consts.ZERO_INT_VALUE);
        }
      }
    }
  }
);
  rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      initKeyboardHeight();
      if (needToShowSmileLayout) {
        showSmileLayout(keyboardHeight);
      }
    }
  }
);
}

Fixed version (ground truth):
private void initListeners(){
  messageEditText.setOnTouchListener(new View.OnTouchListener(){
    @Override public boolean onTouch(    View view,    MotionEvent event){
      hideSmileLayout();
      if (QBDialogType.PRIVATE.equals(dialog.getType())) {
        if (!isTypingNow) {
          startTypingMessage();
        }
      }
      return false;
    }
  }
);
  messageEditText.addTextChangedListener(new SimpleTextWatcher(){
    @Override public void onTextChanged(    CharSequence charSequence,    int start,    int before,    int count){
      super.onTextChanged(charSequence,start,before,count);
      setSendButtonVisibility(charSequence);
      if (QBDialogType.PRIVATE.equals(dialog.getType())) {
        if (!isTypingNow) {
          startTypingMessage();
        }
        checkStopTyping();
      }
    }
  }
);
  smilePanelImageButton.setOnClickListener(new View.OnClickListener(){
    @Override public void onClick(    View view){
      if (isSmilesLayoutShowing()) {
        hideSmileLayout();
        KeyboardUtils.showKeyboard(BaseDialogActivity.this);
      }
 else {
        KeyboardUtils.hideKeyboard(BaseDialogActivity.this);
        needToShowSmileLayout=true;
        if (keyboardHeight == Consts.ZERO_INT_VALUE) {
          showSmileLayout(Consts.ZERO_INT_VALUE);
        }
      }
    }
  }
);
  rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      initKeyboardHeight();
      if (needToShowSmileLayout) {
        showSmileLayout(keyboardHeight);
      }
    }
  }
);
}