本文整理汇总了Java中com.hyphenate.easeui.EaseConstant类的典型用法代码示例。如果您正苦于以下问题:Java EaseConstant类的具体用法?Java EaseConstant怎么用?Java EaseConstant使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
EaseConstant类属于com.hyphenate.easeui包,在下文中一共展示了EaseConstant类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: isAtMeMsg
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
public boolean isAtMeMsg(EMMessage message){
EaseUser user = EaseUserUtils.getUserInfo(message.getFrom());
if(user != null){
try {
JSONArray jsonArray = message.getJSONArrayAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG);
for(int i = 0; i < jsonArray.length(); i++){
String username = jsonArray.getString(i);
if(username.equals(EMClient.getInstance().getCurrentUser())){
return true;
}
}
} catch (Exception e) {
//perhaps is a @ all message
String atUsername = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
if(atUsername != null){
if(atUsername.toUpperCase().equals(EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL)){
return true;
}
}
return false;
}
}
return false;
}
示例2: onDestroy
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
@Override
public void onDestroy() {
super.onDestroy();
if (groupListener != null) {
EMClient.getInstance().groupManager().removeGroupChangeListener(groupListener);
}
if (chatRoomListener != null) {
EMClient.getInstance().chatroomManager().removeChatRoomListener(chatRoomListener);
}
if(chatType == EaseConstant.CHATTYPE_CHATROOM){
EMClient.getInstance().chatroomManager().leaveChatRoom(toChatUsername);
}
}
示例3: inputAtUsername
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
/**
* input @
* @param username
*/
protected void inputAtUsername(String username, boolean autoAddAtSymbol){
if(EMClient.getInstance().getCurrentUser().equals(username) ||
chatType != EaseConstant.CHATTYPE_GROUP){
return;
}
EaseAtMessageHelper.get().addAtUser(username);
EaseUser user = EaseUserUtils.getUserInfo(username);
if (user != null){
username = user.getNick();
}
if(autoAddAtSymbol)
inputMenu.insertText("@" + username + " ");
else
inputMenu.insertText(username + " ");
}
示例4: sendAtMessage
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
/**
* send @ message, only support group chat message
* @param content
*/
@SuppressWarnings("ConstantConditions")
private void sendAtMessage(String content){
if(chatType != EaseConstant.CHATTYPE_GROUP){
EMLog.e(TAG, "only support group chat message");
return;
}
EMMessage message = EMMessage.createTxtSendMessage(content, toChatUsername);
EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername);
if(EMClient.getInstance().getCurrentUser().equals(group.getOwner()) && EaseAtMessageHelper.get().containsAtAll(content)){
message.setAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, EaseConstant.MESSAGE_ATTR_VALUE_AT_MSG_ALL);
}else {
message.setAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG,
EaseAtMessageHelper.get().atListToJsonArray(EaseAtMessageHelper.get().getAtMessageUsernames(content)));
}
sendMessage(message);
}
示例5: sendMessage
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
protected void sendMessage(EMMessage message){
if (message == null) {
return;
}
if(chatFragmentHelper != null){
//set extension
chatFragmentHelper.onSetMessageAttributes(message);
}
if (chatType == EaseConstant.CHATTYPE_GROUP){
message.setChatType(ChatType.GroupChat);
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
message.setChatType(ChatType.ChatRoom);
}
//send message
EMClient.getInstance().chatManager().sendMessage(message);
//refresh ui
if(isMessageListInited) {
messageList.refreshSelectLast();
}
}
示例6: toGroupDetails
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
/**
* open group detail
*
*/
protected void toGroupDetails() {
if (chatType == EaseConstant.CHATTYPE_GROUP) {
EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername);
if (group == null) {
Toast.makeText(getActivity(), R.string.gorup_not_found, Toast.LENGTH_SHORT).show();
return;
}
if(chatFragmentHelper != null){
chatFragmentHelper.onEnterToChatDetails();
}
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
if(chatFragmentHelper != null){
chatFragmentHelper.onEnterToChatDetails();
}
}
}
示例7: onSetUpView
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
@Override
public void onSetUpView() {
String emojiconId = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null);
EaseEmojicon emojicon = null;
if(EaseUI.getInstance().getEmojiconInfoProvider() != null){
emojicon = EaseUI.getInstance().getEmojiconInfoProvider().getEmojiconInfo(emojiconId);
}
if(emojicon != null){
if(emojicon.getBigIcon() != 0){
Glide.with(activity).load(emojicon.getBigIcon()).placeholder(R.drawable.ease_default_expression).into(imageView);
}else if(emojicon.getBigIconPath() != null){
Glide.with(activity).load(emojicon.getBigIconPath()).placeholder(R.drawable.ease_default_expression).into(imageView);
}else{
imageView.setImageResource(R.drawable.ease_default_expression);
}
}
handleTextMessage();
}
示例8: intiData
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
private void intiData() {
// 创建一个会话的fragment
easeChatFragment = new EaseChatFragment();
mHxid = getIntent().getStringExtra(EaseConstant.EXTRA_USER_ID);
// 获取聊天类型
mChatType = getIntent().getExtras().getInt(EaseConstant.EXTRA_CHAT_TYPE);
easeChatFragment.setArguments(getIntent().getExtras());
// 替换fragment
FragmentTransaction transaction = getSupportFragmentManager().beginTransaction();
transaction.replace(R.id.fl_chat, easeChatFragment).commit();
// 获取发送广播的管理者
mLocalBroadcastManager = LocalBroadcastManager.getInstance(ChatActivity.this);
}
示例9: onSetUpView
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
@Override
public void onSetUpView() {
String emojiconId = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_EXPRESSION_ID, null);
EaseEmojicon emojicon = null;
if(EaseUI.getInstance().getEmojiconInfoProvider() != null){
emojicon = EaseUI.getInstance().getEmojiconInfoProvider().getEmojiconInfo(emojiconId);
}
if(emojicon != null){
if(emojicon.getBigIcon() != 0){
// Glide.with(activity).load(emojicon.getBigIcon()).placeholder(R.drawable.ease_default_expression).into(imageView);
}else if(emojicon.getBigIconPath() != null){
// Glide.with(activity).load(emojicon.getBigIconPath()).placeholder(R.drawable.ease_default_expression).into(imageView);
}else{
imageView.setImageResource(R.drawable.ease_default_expression);
}
}
handleTextMessage();
}
示例10: onDestroy
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
@Override
public void onDestroy() {
super.onDestroy();
if (groupListener != null) {
EMClient.getInstance().groupManager().removeGroupChangeListener(groupListener);
}
if(chatType == EaseConstant.CHATTYPE_CHATROOM){
EMClient.getInstance().chatroomManager().leaveChatRoom(toChatUsername);
}
if(chatRoomChangeListener != null){
EMClient.getInstance().chatroomManager().removeChatRoomChangeListener(chatRoomChangeListener);
}
}
示例11: sendMessage
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
protected void sendMessage(EMMessage message){
if(chatFragmentListener != null){
//设置扩展属性
chatFragmentListener.onSetMessageAttributes(message);
}
// 如果是群聊,设置chattype,默认是单聊
if (chatType == EaseConstant.CHATTYPE_GROUP){
message.setChatType(ChatType.GroupChat);
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
message.setChatType(ChatType.ChatRoom);
}
//发送消息
EMClient.getInstance().chatManager().sendMessage(message);
//刷新ui
if(isMessageListInited) {
messageList.refreshSelectLast();
}
}
示例12: toGroupDetails
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
/**
* 点击进入群组详情
*
*/
protected void toGroupDetails() {
if (chatType == EaseConstant.CHATTYPE_GROUP) {
EMGroup group = EMClient.getInstance().groupManager().getGroup(toChatUsername);
if (group == null) {
Toast.makeText(getActivity(), R.string.gorup_not_found, 0).show();
return;
}
if(chatFragmentListener != null){
chatFragmentListener.onEnterToChatDetails();
}
}else if(chatType == EaseConstant.CHATTYPE_CHATROOM){
if(chatFragmentListener != null){
chatFragmentListener.onEnterToChatDetails();
}
}
}
示例13: initWidget
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
@Override
public void initWidget() {
super.initWidget();
article_text = get(R.id.article_text);
name = get(R.id.name);
time = get(R.id.time);
imagee = get(R.id.imagee);
get(R.id.textView4).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
getActivity().
startActivity(new Intent(getActivity(), ChatActivity.class).putExtra(EaseConstant.EXTRA_USER_ID, "zhangsi"));
}
});
}
示例14: parseMessages
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
/**
* parse the message, get and save group id if I was mentioned(@)
* @param messages
*/
public void parseMessages(List<EMMessage> messages) {
int size = atMeGroupList.size();
EMMessage[] msgs = messages.toArray(new EMMessage[]{});
for(EMMessage msg : msgs){
if(msg.getChatType() == ChatType.GroupChat){
String groupId = msg.getTo();
String usernameStr = msg.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
if(usernameStr != null){
String[] usernames = usernameStr.split(",");
for(String username : usernames){
if(EMClient.getInstance().getCurrentUser().equals(username)){
if(!atMeGroupList.contains(groupId)){
atMeGroupList.add(groupId);
break;
}
}
}
if(atMeGroupList.size() != size){
EasePreferenceManager.getInstance().setAtMeGroups(atMeGroupList);
}
}
}
}
}
示例15: isAtMeMsg
import com.hyphenate.easeui.EaseConstant; //导入依赖的package包/类
public boolean isAtMeMsg(EMMessage message){
EaseUser user = EaseUserUtils.getUserInfo(message.getFrom());
if(user != null){
String atUsername = message.getStringAttribute(EaseConstant.MESSAGE_ATTR_AT_MSG, null);
if(atUsername != null){
String[] atUsernames = atUsername.split(",");
for(String username : atUsernames){
if(username.equals(EMClient.getInstance().getCurrentUser())){
return true;
}
}
}
}
return false;
}