Java Code Examples for com.hyphenate.exceptions.HyphenateException#printStackTrace()

The following examples show how to use com.hyphenate.exceptions.HyphenateException#printStackTrace() . 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: EaseChatRowFile.java    From Social with Apache License 2.0 6 votes vote down vote up
@Override
protected void onBubbleClick() {
    String filePath = fileMessageBody.getLocalUrl();
    File file = new File(filePath);
    if (file != null && file.exists()) {
        // 文件存在,直接打开
        FileUtils.openFile(file, (Activity) context);
    } else {
        // 下载
        context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msgbody", message.getBody()));
    }
    if (message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) {
        try {
            EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
        } catch (HyphenateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    
}
 
Example 2
Source File: EaseChatRowFile.java    From Study_Android_Demo with Apache License 2.0 6 votes vote down vote up
@Override
protected void onBubbleClick() {
    String filePath = fileMessageBody.getLocalUrl();
    File file = new File(filePath);
    if (file.exists()) {
        // open files if it exist
        FileUtils.openFile(file, (Activity) context);
    } else {
        // download the file
        context.startActivity(new Intent(context, EaseShowNormalFileActivity.class).putExtra("msgbody", message.getBody()));
    }
    if (message.direct() == EMMessage.Direct.RECEIVE && !message.isAcked() && message.getChatType() == ChatType.Chat) {
        try {
            EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
        } catch (HyphenateException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }
    
}
 
Example 3
Source File: EaseChatRowLocation.java    From Social with Apache License 2.0 5 votes vote down vote up
@Override
    protected void onSetUpView() {
		locBody = (EMLocationMessageBody) message.getBody();
		locationView.setText(locBody.getAddress());

		// deal with send message
		if (message.direct() == EMMessage.Direct.SEND) {
		    setMessageSendCallback();
            switch (message.status()) {
            case CREATE: 
                progressBar.setVisibility(View.GONE);
                statusView.setVisibility(View.VISIBLE);
                // 发送消息
//                sendMsgInBackground(message);
                break;
            case SUCCESS: // 发送成功
                progressBar.setVisibility(View.GONE);
                statusView.setVisibility(View.GONE);
                break;
            case FAIL: // 发送失败
                progressBar.setVisibility(View.GONE);
                statusView.setVisibility(View.VISIBLE);
                break;
            case INPROGRESS: // 发送中
                progressBar.setVisibility(View.VISIBLE);
                statusView.setVisibility(View.GONE);
                break;
            default:
               break;
            }
        }else{
            if(!message.isAcked() && message.getChatType() == ChatType.Chat){
                try {
                    EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
                } catch (HyphenateException e) {
                    e.printStackTrace();
                }
            }
        }
    }
 
Example 4
Source File: EaseChatRowText.java    From Social with Apache License 2.0 5 votes vote down vote up
protected void handleTextMessage() {
        if (message.direct() == EMMessage.Direct.SEND) {
            setMessageSendCallback();
            switch (message.status()) {
            case CREATE: 
                progressBar.setVisibility(View.GONE);
                statusView.setVisibility(View.VISIBLE);
                // 发送消息
//                sendMsgInBackground(message);
                break;
            case SUCCESS: // 发送成功
                progressBar.setVisibility(View.GONE);
                statusView.setVisibility(View.GONE);
                break;
            case FAIL: // 发送失败
                progressBar.setVisibility(View.GONE);
                statusView.setVisibility(View.VISIBLE);
                break;
            case INPROGRESS: // 发送中
                progressBar.setVisibility(View.VISIBLE);
                statusView.setVisibility(View.GONE);
                break;
            default:
               break;
            }
        }else{
            if(!message.isAcked() && message.getChatType() == ChatType.Chat){
                try {
                    EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
                } catch (HyphenateException e) {
                    e.printStackTrace();
                }
            }
        }
    }
 
Example 5
Source File: EaseChatRowLocation.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
@Override
  protected void onSetUpView() {
locBody = (EMLocationMessageBody) message.getBody();
locationView.setText(locBody.getAddress());

// handle sending message
if (message.direct() == EMMessage.Direct.SEND) {
    setMessageSendCallback();
          switch (message.status()) {
          case CREATE: 
              progressBar.setVisibility(View.GONE);
              statusView.setVisibility(View.VISIBLE);
              break;
          case SUCCESS:
              progressBar.setVisibility(View.GONE);
              statusView.setVisibility(View.GONE);
              break;
          case FAIL:
              progressBar.setVisibility(View.GONE);
              statusView.setVisibility(View.VISIBLE);
              break;
          case INPROGRESS:
              progressBar.setVisibility(View.VISIBLE);
              statusView.setVisibility(View.GONE);
              break;
          default:
             break;
          }
      }else{
          if(!message.isAcked() && message.getChatType() == ChatType.Chat){
              try {
                  EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
              } catch (HyphenateException e) {
                  e.printStackTrace();
              }
          }
      }
  }
 
Example 6
Source File: EaseChatRowText.java    From Study_Android_Demo with Apache License 2.0 5 votes vote down vote up
protected void handleTextMessage() {
    if (message.direct() == EMMessage.Direct.SEND) {
        setMessageSendCallback();
        switch (message.status()) {
        case CREATE: 
            progressBar.setVisibility(View.GONE);
            statusView.setVisibility(View.VISIBLE);
            break;
        case SUCCESS:
            progressBar.setVisibility(View.GONE);
            statusView.setVisibility(View.GONE);
            break;
        case FAIL:
            progressBar.setVisibility(View.GONE);
            statusView.setVisibility(View.VISIBLE);
            break;
        case INPROGRESS:
            progressBar.setVisibility(View.VISIBLE);
            statusView.setVisibility(View.GONE);
            break;
        default:
           break;
        }
    }else{
        if(!message.isAcked() && message.getChatType() == ChatType.Chat){
            try {
                EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
            } catch (HyphenateException e) {
                e.printStackTrace();
            }
        }
    }
}
 
Example 7
Source File: EaseChatRowText.java    From nono-android with GNU General Public License v3.0 5 votes vote down vote up
protected void handleTextMessage() {
        if (message.direct() == EMMessage.Direct.SEND) {
            setMessageSendCallback();
            switch (message.status()) {
            case CREATE: 
                progressBar.setVisibility(View.GONE);
                statusView.setVisibility(View.VISIBLE);
                // 发送消息
//                sendMsgInBackground(message);
                break;
            case SUCCESS: // 发送成功
                progressBar.setVisibility(View.GONE);
                statusView.setVisibility(View.GONE);
                break;
            case FAIL: // 发送失败
                progressBar.setVisibility(View.GONE);
                statusView.setVisibility(View.VISIBLE);
                break;
            case INPROGRESS: // 发送中
                progressBar.setVisibility(View.VISIBLE);
                statusView.setVisibility(View.GONE);
                break;
            default:
               break;
            }
        }else{
            if(!message.isAcked() && message.getChatType() == ChatType.Chat){
                try {
                    EMClient.getInstance().chatManager().ackMessageRead(message.getFrom(), message.getMsgId());
                } catch (HyphenateException e) {
                    e.printStackTrace();
                }
            }
        }
    }
 
Example 8
Source File: AddGroupActivity.java    From Social with Apache License 2.0 4 votes vote down vote up
@Override
public void onClick(View view) {
    int id = view.getId();
    switch (id){
        case R.id.id_add_group_iv_group_img:
            CommentUtil.startPicChoiceIntent(this);
            break;
        case R.id.id_add_group_btn_add:
            groupname = et_groupname.getText().toString();
            if (groupname.equals("")) {new Dialog(this,"Tips","请输入群名称").show(); return;}
            description = et_group_description.getText().toString();
            if (description.equals("")) {new Dialog(this,"Tips","请输入群介绍").show(); return; }
            point = tv_choose_point.getText().toString();
            if (point.equals("请选择")) {new Dialog(this,"Tips","请选择群组地点").show(); return;}
            if (rb_private_1.isChecked()){
                group_type = 1;
            }else if (rb_private_2.isChecked()){
                group_type = 2;
            }else if (rb_public_1.isChecked()){
                group_type = 3;
            }else if (rb_public_2.isChecked()){
                group_type = 4;
            }

            showProgressDialog();

            try {
                EMGroupManager.EMGroupOptions option = new EMGroupManager.EMGroupOptions();
                option.maxUsers = 200;
                switch (group_type){
                    case 1:
                        option.style = EMGroupManager.EMGroupStyle.EMGroupStylePrivateMemberCanInvite;//私有群,群成员也能邀请人进群;
                        break;
                    case 2:
                        option.style = EMGroupManager.EMGroupStyle.EMGroupStylePrivateOnlyOwnerInvite;//私有群,只能群主邀请人进群;
                        break;
                    case 3:
                        option.style = EMGroupManager.EMGroupStyle.EMGroupStylePublicJoinNeedApproval;//公开群,加入此群除了群主邀请,只能通过申请加入此群;;
                        break;
                    case 4:
                        option.style = EMGroupManager.EMGroupStyle.EMGroupStylePublicOpenJoin ;//公开群,任何人都能加入此群。;
                        break;
                }

                //option.style = EMGroupManager.EMGroupStyle.EMGroupStylePrivateMemberCanInvite;//私有群,群成员也能邀请人进群;
                //option.style = EMGroupManager.EMGroupStyle.EMGroupStylePrivateOnlyOwnerInvite;//私有群,只能群主邀请人进群;
                //option.style = EMGroupManager.EMGroupStyle.EMGroupStylePublicJoinNeedApproval;//公开群,加入此群除了群主邀请,只能通过申请加入此群;;
                //option.style = EMGroupManager.EMGroupStyle.EMGroupStylePublicOpenJoin ;//公开群,任何人都能加入此群。;
                EMGroup group = EMClient.getInstance().groupManager().createGroup(groupname, description, new String[]{SharedPreferenceUtil.getUserName()}, "reason", option);
                Log.d("AddGroupActivity", "group_id = " + group.getGroupId() + "\n" + "group_name = " + group.getGroupName()
                        + "\n" + "group_desc = " + group.getDescription() + "\n" + "group_owner = " + group.getOwner());
                hx_group_id = group.getGroupId();
            }catch (HyphenateException e){
                e.printStackTrace();
            }

           addGroup();
            break;
        case R.id.id_add_group_tv_choose_point:
            Intent intent = new Intent(this,ChoosePointActivity.class);
            startActivityForResult(intent,REQUESTCODE_CHOOSE_POINT);
            break;
    }
}