当前位置: 首页>>代码示例>>Java>>正文


Java HyphenateException类代码示例

本文整理汇总了Java中com.hyphenate.exceptions.HyphenateException的典型用法代码示例。如果您正苦于以下问题:Java HyphenateException类的具体用法?Java HyphenateException怎么用?Java HyphenateException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


HyphenateException类属于com.hyphenate.exceptions包,在下文中一共展示了HyphenateException类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: onBubbleClick

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
@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("msg", message));
    }
    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();
        }
    }
    
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:22,代码来源:EaseChatRowFile.java

示例2: onActivityResult

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
    super.onActivityResult(requestCode, resultCode, data);

    if (resultCode == RESULT_OK) {
        // 获取返回的准备邀请的群成员信息
        final String[] memberses = data.getStringArrayExtra("members");

        Model.getInstance().getGlobalThreadPool().execute(new Runnable() {
            @Override
            public void run() {
                try {
                    // 去环信服务器,发送邀请信息
                    EMClient.getInstance().groupManager().addUsersToGroup(mGroup.getGroupId(), memberses);

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(GroupDetailActivity.this, "发送邀请成功", Toast.LENGTH_SHORT).show();
                        }
                    });
                } catch (final HyphenateException e) {
                    e.printStackTrace();

                    runOnUiThread(new Runnable() {
                        @Override
                        public void run() {
                            Toast.makeText(GroupDetailActivity.this, "发送邀请失败" + e.toString(), Toast.LENGTH_SHORT).show();
                        }
                    });
                }
            }
        });
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:36,代码来源:GroupDetailActivity.java

示例3: registerEaseMob

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
/**
 * 注册到环信
 * @param userName
 * @param pwd
 */
private void registerEaseMob(final String userName, final String pwd) {
    ThreadUtils.runOnBackgroundThread(new Runnable() {
        @Override
        public void run() {
            try {
                EMClient.getInstance().createAccount(userName, pwd);
                ThreadUtils.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        mRegisterView.onRegisterSuccess();
                    }
                });
            } catch (HyphenateException e) {
                e.printStackTrace();
                ThreadUtils.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        mRegisterView.onRegisterError();
                    }
                });
            }
        }
    });
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:30,代码来源:RegisterPresenterImpl.java

示例4: deleteFriend

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
/**
 * 删除联系人
 * @param name
 */
@Override
public void deleteFriend(final String name) {
    ThreadUtils.runOnBackgroundThread(new Runnable() {
        @Override
        public void run() {
            try {
                EMClient.getInstance().contactManager().deleteContact(name);
                ThreadUtils.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        mContactView.onDeleteFriendSuccess();
                    }
                });
            } catch (HyphenateException e) {
                e.printStackTrace();
                ThreadUtils.runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        mContactView.onDeleteFriendFailed();
                    }
                });
            }
        }
    });
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:30,代码来源:ContactPresenterImpl.java

示例5: getContactsFromServer

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
/**
 *从服务器获取联系人列表
 */
@Override
public void getContactsFromServer() {
    if (mContactListItems.size() > 0) {
        mContactView.onGetContactListSuccess();
        return;
    }
    ThreadUtils.runOnBackgroundThread(new Runnable() {
        @Override
        public void run() {
            try {
                startGetContactList();
                notifyGetContactListSuccess();
            } catch (HyphenateException e) {
                e.printStackTrace();
                notifyGetContactListFailed();
            }
        }
    });

}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:24,代码来源:ContactPresenterImpl.java

示例6: startGetContactList

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
/**
 * 获取联系人列表数据
 * @throws HyphenateException
 */
private void startGetContactList() throws HyphenateException {
    List<String> contacts = EMClient.getInstance().contactManager().getAllContactsFromServer();
    DatabaseManager.getInstance().deleteAllContacts();
    if (!contacts.isEmpty()) {
        for (int i = 0; i < contacts.size(); i++) {
            ContactListItem item = new ContactListItem();
            item.userName = contacts.get(i);
            if (itemInSameGroup(i, item)) {
                item.showFirstLetter = false;
            }
            mContactListItems.add(item);
            saveContactToDatabase(item.userName);
        }
    }
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:20,代码来源:ContactPresenterImpl.java

示例7: addFriend

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
@Subscribe(threadMode = ThreadMode.BACKGROUND,priority = 90)
public void addFriend(AddFriendEvent event) {
    Log.d(TAG, "addFriend: ");
    try {
        EMClient.getInstance().contactManager().addContact(event.getFriendName(), event.getReason());
        ThreadUtils.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                mAddFriendView.onAddFriendSuccess();
            }
        });
    } catch (HyphenateException e) {
        e.printStackTrace();
        ThreadUtils.runOnUiThread(new Runnable() {
            @Override
            public void run() {
                mAddFriendView.onAddFriendFailed();
            }
        });
    }
}
 
开发者ID:Vicent9920,项目名称:FanChat,代码行数:22,代码来源:AddFriendPresenterImpl.java

示例8: onBubbleClick

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
@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();
        }
    }
    
}
 
开发者ID:Rabbit00,项目名称:MeifuGO,代码行数:22,代码来源:EaseChatRowFile.java

示例9: onBubbleClick

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
@Override
protected void onBubbleClick() {
    String filePath = fileMessageBody.getLocalUrl();
    File file = new File(filePath);
    if (file != null && 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();
        }
    }
    
}
 
开发者ID:HyphenateInc,项目名称:Hyphenate-EaseUI-Android,代码行数:22,代码来源:EaseChatRowFile.java

示例10: onSetUpView

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
@Override
protected void onSetUpView() {
    try {
        String currentUser = EMClient.getInstance().getCurrentUser();
        String fromUser = message.getStringAttribute(RedPacketConstant.EXTRA_RED_PACKET_SENDER_NAME);//红包发送者
        String toUser = message.getStringAttribute(RedPacketConstant.EXTRA_RED_PACKET_RECEIVER_NAME);//红包接收者
        String senderId;
        if (message.direct() == EMMessage.Direct.SEND) {
            if (message.getChatType().equals(EMMessage.ChatType.GroupChat)) {
                senderId = message.getStringAttribute(RedPacketConstant.EXTRA_RED_PACKET_SENDER_ID);
                if (senderId.equals(currentUser)) {
                    mTvMessage.setText(R.string.money_msg_take_money);
                } else {
                    mTvMessage.setText(String.format(getResources().getString(R.string.money_msg_take_someone_money), fromUser));
                }
            } else {
                mTvMessage.setText(String.format(getResources().getString(R.string.money_msg_take_someone_money), fromUser));
            }
        } else {
            mTvMessage.setText(String.format(getResources().getString(R.string.money_msg_someone_take_money), toUser));
        }
    } catch (HyphenateException e) {
        e.printStackTrace();
    }
}
 
开发者ID:laoduDYM,项目名称:ChatDemoUI3.0,代码行数:26,代码来源:ChatRowRedPacketAck.java

示例11: moveToBlacklist

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
/**
 * move user to blacklist
 */
protected void moveToBlacklist(final String username){
    final ProgressDialog pd = new ProgressDialog(getActivity());
    String st1 = getResources().getString(R.string.Is_moved_into_blacklist);
    final String st2 = getResources().getString(R.string.Move_into_blacklist_success);
    final String st3 = getResources().getString(R.string.Move_into_blacklist_failure);
    pd.setMessage(st1);
    pd.setCanceledOnTouchOutside(false);
    pd.show();
    new Thread(new Runnable() {
        public void run() {
            try {
                //move to blacklist
                EMClient.getInstance().contactManager().addUserToBlackList(username,false);
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), st2, Toast.LENGTH_SHORT).show();
                        refresh();
                    }
                });
            } catch (HyphenateException e) {
                e.printStackTrace();
                getActivity().runOnUiThread(new Runnable() {
                    public void run() {
                        pd.dismiss();
                        Toast.makeText(getActivity(), st3, Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }
    }).start();
    
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:37,代码来源:EaseContactListFragment.java

示例12: onSetUpView

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
@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();
              }
          }
      }
  }
 
开发者ID:turoDog,项目名称:KTalk,代码行数:39,代码来源:EaseChatRowLocation.java

示例13: handleTextMessage

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
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();
            }
        }
    }
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:34,代码来源:EaseChatRowText.java

示例14: add

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
private void add() {
    //去环信服务器添加好友
    Model.getInstance().getGlobalThreadPool().execute(new Runnable() {
        @Override
        public void run() {
            try {
                EMClient.getInstance().contactManager().addContact(userInfo.getName(),"添加好友");

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(addContactActivity.this,"发送添加好友请求成功",Toast.LENGTH_SHORT).show();
                    }
                });
            } catch (HyphenateException e) {
                e.printStackTrace();
                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(addContactActivity.this,"发送添加好友请求失败"+ e.toString(),Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }
    });
    
}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:28,代码来源:addContactActivity.java

示例15: onAccept

import com.hyphenate.exceptions.HyphenateException; //导入依赖的package包/类
@Override
public void onAccept(final InvationInfo invationInfo) {
    //通知环信服务器,点击了接受按钮
    Model.getInstance().getGlobalThreadPool().execute(new Runnable() {
        @Override
        public void run() {
            try {
                EMClient.getInstance().contactManager().
                        acceptInvitation(invationInfo.getUser().getHxid());

                //数据库更新
                Model.getInstance().getDbManager().getInviteTableDao().updateInvitationStatus(
                        InvationInfo.InvitationStatus.INVITE_ACCEPT,invationInfo.getUser().getHxid());

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        //页面发生变化
                        Toast.makeText(InviteActivity.this,"已接受好友邀请",Toast.LENGTH_SHORT).show();

                        //刷新页面
                        refresh();
                    }
                });
            } catch (HyphenateException e) {
                e.printStackTrace();

                runOnUiThread(new Runnable() {
                    @Override
                    public void run() {
                        Toast.makeText(InviteActivity.this, "接受邀请失败", Toast.LENGTH_SHORT).show();
                    }
                });
            }
        }
    });

}
 
开发者ID:turoDog,项目名称:KTalk,代码行数:39,代码来源:InviteActivity.java


注:本文中的com.hyphenate.exceptions.HyphenateException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。