@Override
  protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (requestCode == 29 && resultCode == Constants.MESSAGE_REPLY) {
      if (data != null && data.hasExtra("REPLY_NAME") && data.hasExtra("REPLY_ID")) {
        String id = data.getStringExtra("REPLY_ID");
        String name = data.getStringExtra("REPLY_NAME");
        TextInputProvider textInputProvider =
            (TextInputProvider) RongContext.getInstance().getPrimaryInputProvider();
        textInputProvider.setEditTextContent(mEditText + name + " ");

        InputMethodManager imm =
            (InputMethodManager) getSystemService(Context.INPUT_METHOD_SERVICE);
        imm.toggleSoftInput(0, InputMethodManager.HIDE_NOT_ALWAYS);
      }
    }
  }
  private void checkTextInputEditTextChanged() {

    TextInputProvider textInputProvider = new TextInputProvider(RongContext.getInstance());
    RongIM.setPrimaryInputProvider(textInputProvider);

    textInputProvider.setEditTextChangedListener(
        new TextWatcher() {

          @Override
          public void beforeTextChanged(CharSequence s, int start, int count, int after) {

            //                Log.e(TAG, "-----rongActivity---beforeTextChanged----");

            //
            //
            // RongIM.getInstance().getRongIMClient().getConversation(mConversationType, targetId,
            // new RongIMClient.ResultCallback<Conversation>() {
            //                    @Override
            //                    public void onSuccess(Conversation conversation) {
            //
            //                        TextInputProvider textInputProvider = (TextInputProvider)
            // RongContext.getInstance().getPrimaryInputProvider();
            //
            //                        textInputProvider.setEditTextContent(conversation.getDraft());
            ////                        Log.e(TAG,
            // "-----rongActivity---conversation.getDraft()----"+conversation.getDraft());
            //                    }
            //
            //                    @Override
            //                    public void onError(RongIMClient.ErrorCode e) {
            //
            //                    }
            //                });
          }

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

            if (mConversationType.equals(Conversation.ConversationType.DISCUSSION)) {

              if (s.length() > 0) {
                String str =
                    s.toString().substring(s.toString().length() - 1, s.toString().length());

                if (str.equals("@")) {

                  Intent intent = new Intent(RongActivity.this, NewTextMessageAcitivty.class);
                  intent.putExtra("DEMO_REPLY_CONVERSATIONTYPE", mConversationType.toString());
                  intent.putExtra("DEMO_REPLY_TARGETID", targetId);
                  startActivityForResult(intent, 29);

                  mEditText = s.toString();
                }
              }
            }
          }

          @Override
          public void afterTextChanged(Editable s) {
            //                Log.e(TAG, "-----rongActivity---afterTextChanged----");
          }
        });
  }