Program: 114287
Project: 114287
Buggy source:
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 == ConstsCore.ZERO_INT_VALUE) {
          showSmileLayout(ConstsCore.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) {
          isTypingNow=true;
          sendTypingStatus();
        }
      }
      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) {
          isTypingNow=true;
          sendTypingStatus();
        }
        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 == ConstsCore.ZERO_INT_VALUE) {
          showSmileLayout(ConstsCore.ZERO_INT_VALUE);
        }
      }
    }
  }
);
  rootView.getViewTreeObserver().addOnGlobalLayoutListener(new ViewTreeObserver.OnGlobalLayoutListener(){
    @Override public void onGlobalLayout(){
      initKeyboardHeight();
      if (needToShowSmileLayout) {
        showSmileLayout(keyboardHeight);
      }
    }
  }
);
}