Java Code Examples for cn.jpush.im.android.api.JMessageClient#exitConversation()

The following examples show how to use cn.jpush.im.android.api.JMessageClient#exitConversation() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ChatActivity.java    From o2oa with GNU Affero General Public License v3.0 5 votes vote down vote up
private void returnBtn() {
    mConv.resetUnreadCount();
    dismissSoftInput();
    JMessageClient.exitConversation();
    //发送保存为草稿事件到会话列表
    EventBus.getDefault().post(new Event.Builder().setType(EventType.draft)
            .setConversation(mConv)
            .setDraft(ekBar.getEtChat().getText().toString())
            .build());
    finish();
}
 
Example 2
Source File: ChatMsgActivity.java    From Android-IM with Apache License 2.0 5 votes vote down vote up
@Override
protected void onDestroy() {
    JMessageClient.unRegisterEventReceiver(this);
    JMessageClient.exitConversation();
    super.onDestroy();
    //接收事件解绑
}
 
Example 3
Source File: ChatActivity.java    From jmessage-android-uikit with MIT License 5 votes vote down vote up
@Override
protected void onPause() {
    RecordVoiceButton.mIsPressed = false;
    JMessageClient.exitConversation();
    Log.i(TAG, "[Life cycle] - onPause");
    super.onPause();
}
 
Example 4
Source File: JmessageFlutterPlugin.java    From jmessage-flutter-plugin with MIT License 4 votes vote down vote up
private void exitConversation(MethodCall call, Result result) {
  JMessageClient.exitConversation();
  result.success(null);
}
 
Example 5
Source File: ChatActivity.java    From o2oa with GNU Affero General Public License v3.0 4 votes vote down vote up
@Override
protected void onPause() {
    super.onPause();
    JMessageClient.exitConversation();
    ekBar.reset();
}
 
Example 6
Source File: ChatActivity.java    From jmessage-android-uikit with MIT License 4 votes vote down vote up
@Override
    public void onClick(View v) {
        if (v.getId() == IdHelper.getViewID(mContext, "jmui_return_btn")) {
            mConv.resetUnreadCount();
            dismissSoftInput();
            JMessageClient.exitConversation();
            //发送保存为草稿事件到会话列表
            if (mIsSingle) {
                EventBus.getDefault().post(new Event.DraftEvent(mTargetId, mTargetAppKey,
                        mChatView.getChatInput()));
            } else {
                EventBus.getDefault().post(new Event.DraftEvent(mGroupId, mChatView.getChatInput()));
            }
            finish();
        } else if (v.getId() == IdHelper.getViewID(mContext, "jmui_right_btn")) {
            if (mChatView.getMoreMenu().getVisibility() == View.VISIBLE) {
                mChatView.dismissMoreMenu();
            }
            dismissSoftInput();
            //TODO
//            startChatDetailActivity(mTargetId, mTargetAppKey, mGroupId);
            // 切换输入
        } else if (v.getId() == IdHelper.getViewID(mContext, "jmui_switch_voice_ib")) {
            mChatView.dismissMoreMenu();
            isInputByKeyBoard = !isInputByKeyBoard;
            //当前为语音输入,点击后切换为文字输入,弹出软键盘
            if (isInputByKeyBoard) {
                mChatView.isKeyBoard();
                showSoftInputAndDismissMenu();
            } else {
                //否则切换到语音输入
                mChatView.notKeyBoard(mConv, mChatAdapter, mChatView);
                if (mShowSoftInput) {
                    if (mImm != null) {
                        mImm.hideSoftInputFromWindow(mChatView.getInputView().getWindowToken(), 0); //强制隐藏键盘
                        mShowSoftInput = false;
                    }
                } else if (mChatView.getMoreMenu().getVisibility() == View.VISIBLE) {
                    mChatView.dismissMoreMenu();
                }
                Log.i(TAG, "setConversation success");
            }
            // 发送文本消息
        } else if (v.getId() == IdHelper.getViewID(mContext, "jmui_send_msg_btn")) {
            String msgContent = mChatView.getChatInput();
            mChatView.clearInput();
            mChatView.setToBottom();
            if (msgContent.equals("")) {
                return;
            }
            TextContent content = new TextContent(msgContent);
            final Message msg = mConv.createSendMessage(content);
            mChatAdapter.addMsgToList(msg);
            JMessageClient.sendMessage(msg);
            // 点击添加按钮,弹出更多选项菜单
        } else if (v.getId() == IdHelper.getViewID(mContext, "jmui_add_file_btn")) {
            //如果在语音输入时点击了添加按钮,则显示菜单并切换到输入框
            if (!isInputByKeyBoard) {
                mChatView.isKeyBoard();
                isInputByKeyBoard = true;
                mChatView.showMoreMenu();
            } else {
                //如果弹出软键盘 则隐藏软键盘
                if (mChatView.getMoreMenu().getVisibility() != View.VISIBLE) {
                    dismissSoftInputAndShowMenu();
                    mChatView.focusToInput(false);
                    //如果弹出了更多选项菜单,则隐藏菜单并显示软键盘
                } else {
                    showSoftInputAndDismissMenu();
                }
            }
        } else if (v.getId() == IdHelper.getViewID(mContext, "jmui_pick_from_camera_btn")) {
            takePhoto();
            if (mChatView.getMoreMenu().getVisibility() == View.VISIBLE) {
                mChatView.dismissMoreMenu();
            }
        } else if (v.getId() == IdHelper.getViewID(mContext, "jmui_pick_from_local_btn")){
            if (mChatView.getMoreMenu().getVisibility() == View.VISIBLE) {
                mChatView.dismissMoreMenu();
            }
            Intent intent = new Intent();
            if (mIsSingle) {
                intent.putExtra(TARGET_ID, mTargetId);
                intent.putExtra(TARGET_APP_KEY, mTargetAppKey);
            } else {
                intent.putExtra(GROUP_ID, mGroupId);
            }
//            if (!FileHelper.isSdCardExist()) {
//                Toast.makeText(this, IdHelper.getString(mContext, "sdcard_not_exist_toast"), Toast.LENGTH_SHORT).show();
//            } else {
//                intent.setClass(this, PickPictureTotalActivity.class);
//                startActivityForResult(intent, REQUEST_CODE_SELECT_PICTURE);
//            }
        }
    }