11111
This commit is contained in:
141
common/src/main/java/com/yunbao/common/bean/ImUserInfoModel.java
Normal file
141
common/src/main/java/com/yunbao/common/bean/ImUserInfoModel.java
Normal file
@@ -0,0 +1,141 @@
|
||||
package com.yunbao.common.bean;
|
||||
|
||||
import com.google.gson.annotations.SerializedName;
|
||||
|
||||
/**
|
||||
* r融雲發送的系統消息通知
|
||||
*/
|
||||
public class ImUserInfoModel extends BaseModel {
|
||||
@SerializedName("title")
|
||||
String title;//
|
||||
@SerializedName("image")
|
||||
String image;//头像
|
||||
@SerializedName("content")
|
||||
String content;//最新一条内容
|
||||
@SerializedName("addtime")
|
||||
String addtime;//最后时间
|
||||
@SerializedName("num")
|
||||
String num;//未读消息数
|
||||
@SerializedName("link")
|
||||
String link;//跳转连接
|
||||
@SerializedName("type")
|
||||
String type;//
|
||||
@SerializedName("userId")
|
||||
String userId;//单聊的id
|
||||
@SerializedName("remarks")
|
||||
String remarks;//备注的信息
|
||||
@SerializedName("is_admin")
|
||||
String isAdmin;
|
||||
@SerializedName("isDelet")
|
||||
String isDelet;
|
||||
@SerializedName("_method_")
|
||||
String method="";//融雲消息類型
|
||||
|
||||
public String getTitle() {
|
||||
return title;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setTitle(String title) {
|
||||
this.title = title;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getImage() {
|
||||
return image;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setImage(String image) {
|
||||
this.image = image;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getContent() {
|
||||
return content;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setContent(String content) {
|
||||
this.content = content;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getAddtime() {
|
||||
return addtime;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setAddtime(String addtime) {
|
||||
this.addtime = addtime;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getNum() {
|
||||
return num;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setNum(String num) {
|
||||
this.num = num;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return link;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setLink(String link) {
|
||||
this.link = link;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getType() {
|
||||
return type;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setType(String type) {
|
||||
this.type = type;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getUserId() {
|
||||
return userId;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setUserId(String userId) {
|
||||
this.userId = userId;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getRemarks() {
|
||||
return remarks;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setRemarks(String remarks) {
|
||||
this.remarks = remarks;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsAdmin() {
|
||||
return isAdmin;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setIsAdmin(String isAdmin) {
|
||||
this.isAdmin = isAdmin;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getIsDelet() {
|
||||
return isDelet;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setIsDelet(String isDelet) {
|
||||
this.isDelet = isDelet;
|
||||
return this;
|
||||
}
|
||||
|
||||
public String getMethod() {
|
||||
return method;
|
||||
}
|
||||
|
||||
public ImUserInfoModel setMethod(String method) {
|
||||
this.method = method;
|
||||
return this;
|
||||
}
|
||||
}
|
||||
@@ -3,21 +3,30 @@ package com.yunbao.common.manager.imrongcloud;
|
||||
import android.content.Context;
|
||||
import android.os.Handler;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.google.gson.Gson;
|
||||
import com.yunbao.common.bean.IMLoginModel;
|
||||
import com.yunbao.common.bean.ImUserInfoModel;
|
||||
import com.yunbao.common.event.MessageIMEvent;
|
||||
import com.yunbao.common.http.HttpCallback;
|
||||
import com.yunbao.common.http.HttpClient;
|
||||
import com.yunbao.common.manager.IMLoginManager;
|
||||
import com.yunbao.common.utils.ToastUtil;
|
||||
|
||||
import org.greenrobot.eventbus.EventBus;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
import io.rong.imkit.IMCenter;
|
||||
import io.rong.imkit.config.ConversationClickListener;
|
||||
import io.rong.imkit.manager.UnReadMessageManager;
|
||||
import io.rong.imlib.model.Conversation;
|
||||
import io.rong.imlib.model.Message;
|
||||
import io.rong.imlib.model.UserInfo;
|
||||
import io.rong.message.TextMessage;
|
||||
|
||||
/**
|
||||
* 消息的监听管理
|
||||
@@ -85,7 +94,7 @@ public class MessageIMManager {
|
||||
List<IMLoginModel> listUserBean = JSON.parseArray(Arrays.toString(info), IMLoginModel.class);
|
||||
if (listUserBean != null && listUserBean.size() >= 2) {
|
||||
//目前就三条消息,需求判断前两条消息是否有未读消息
|
||||
for (int i = 0; i < listUserBean.size() - 2; i++) {
|
||||
for (int i = 0; i < listUserBean.size(); i++) {
|
||||
//消息对象
|
||||
IMLoginModel userBean = listUserBean.get(i);
|
||||
//未读消息数
|
||||
@@ -94,7 +103,7 @@ public class MessageIMManager {
|
||||
try {
|
||||
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
|
||||
systemNumber = Integer.parseInt(number);
|
||||
}else {
|
||||
} else {
|
||||
systemNumber = 0;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
@@ -109,6 +118,30 @@ public class MessageIMManager {
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 融雲發送的系統消息
|
||||
*
|
||||
* @param message
|
||||
*/
|
||||
public void getSystemForRongcloud(Message message) {
|
||||
ImUserInfoModel model = null;
|
||||
if ((message.getConversationType() == Conversation.ConversationType.SYSTEM) && (message.getContent() instanceof TextMessage)) {
|
||||
TextMessage content = (TextMessage) message.getContent();
|
||||
String json = content.getContent();
|
||||
model = new Gson().fromJson(json, ImUserInfoModel.class);
|
||||
}
|
||||
if (message.getConversationType() == Conversation.ConversationType.SYSTEM && model != null && TextUtils.equals(model.getMethod(), "LivePK_UnreadCount")) {
|
||||
//发送通知
|
||||
EventBus.getDefault().post(model);
|
||||
try {
|
||||
systemNumber = systemNumber + 1;
|
||||
unreadMessagesHandler.post(essagesRunnable);
|
||||
} catch (NumberFormatException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取系统消息(有未读数展示红点)
|
||||
*/
|
||||
@@ -127,7 +160,7 @@ public class MessageIMManager {
|
||||
List<IMLoginModel> listUserBean = JSON.parseArray(Arrays.toString(info), IMLoginModel.class);
|
||||
if (listUserBean != null && listUserBean.size() >= 2) {
|
||||
//目前就三条消息,需求判断前两条消息是否有未读消息
|
||||
for (int i = 0; i < listUserBean.size() - 2; i++) {
|
||||
for (int i = 0; i < listUserBean.size(); i++) {
|
||||
//消息对象
|
||||
IMLoginModel userBean = listUserBean.get(i);
|
||||
//未读消息数
|
||||
@@ -136,7 +169,7 @@ public class MessageIMManager {
|
||||
try {
|
||||
if (!TextUtils.isEmpty(number) && Integer.parseInt(number) > 0) {
|
||||
systemNumber = Integer.parseInt(number);
|
||||
}else {
|
||||
} else {
|
||||
systemNumber = 0;
|
||||
}
|
||||
} catch (NumberFormatException e) {
|
||||
@@ -164,4 +197,50 @@ public class MessageIMManager {
|
||||
EventBus.getDefault().post(new MessageIMEvent().setNumber(number));
|
||||
};
|
||||
|
||||
/**
|
||||
* 设置会话界面操作监听器
|
||||
*/
|
||||
public void addConversationClickListener() {
|
||||
IMCenter.setConversationClickListener(listener);
|
||||
}
|
||||
|
||||
/**
|
||||
* 会话界面操作监听器
|
||||
*/
|
||||
private ConversationClickListener listener = new ConversationClickListener() {
|
||||
@Override
|
||||
public boolean onUserPortraitClick(Context context, Conversation.ConversationType conversationType, UserInfo userInfo, String s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onUserPortraitLongClick(Context context, Conversation.ConversationType conversationType, UserInfo userInfo, String s) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMessageClick(Context context, View view, Message message) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 长按消息时。
|
||||
*/
|
||||
@Override
|
||||
public boolean onMessageLongClick(Context context, View view, Message message) {
|
||||
|
||||
ToastUtil.show(message.getContent().toString());
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMessageLinkClick(Context context, String s, Message message) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onReadReceiptStateClick(Context context, Message message) {
|
||||
return false;
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
@@ -827,4 +827,5 @@
|
||||
<string name="live_hot_ruletext22">前往「個人中心」-「我的包裹」中,即可使用熱度卡。</string>
|
||||
<string name="live_hot_ruletext31">熱度卡生效多久?</string>
|
||||
<string name="live_hot_ruletext32">對指定主播使用熱度卡後,將會立即生效,效果時長為24小時,不管主播是否在線,熱度時長都將會持續減少</string>
|
||||
<string name="quote">引用</string>
|
||||
</resources>
|
||||
|
||||
Reference in New Issue
Block a user