本文整理匯總了Java中com.lqr.wechat.model.message.RedPacketMessage類的典型用法代碼示例。如果您正苦於以下問題:Java RedPacketMessage類的具體用法?Java RedPacketMessage怎麽用?Java RedPacketMessage使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
RedPacketMessage類屬於com.lqr.wechat.model.message包,在下文中一共展示了RedPacketMessage類的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: initRongCloud
import com.lqr.wechat.model.message.RedPacketMessage; //導入依賴的package包/類
private void initRongCloud() {
/**
* OnCreate 會被多個進程重入,這段保護代碼,確保隻有您需要使用 RongIMClient 的進程和 Push 進程執行了 init。
* io.rong.push 為融雲 push 進程名稱,不可修改。
*/
if (getApplicationInfo().packageName.equals(getCurProcessName(getApplicationContext())) ||
"io.rong.push".equals(getCurProcessName(getApplicationContext()))) {
RongIMClient.init(this);
}
//監聽接收到的消息
RongIMClient.setOnReceiveMessageListener(this);
try {
RongIMClient.registerMessageType(RedPacketMessage.class);
RongIMClient.registerMessageType(DeleteContactMessage.class);
} catch (AnnotationNotFoundException e) {
e.printStackTrace();
}
}
示例2: getItemViewType
import com.lqr.wechat.model.message.RedPacketMessage; //導入依賴的package包/類
@Override
public int getItemViewType(int position) {
Message msg = mData.get(position);
boolean isSend = msg.getMessageDirection() == Message.MessageDirection.SEND ? true : false;
MessageContent msgContent = msg.getContent();
if (msgContent instanceof TextMessage) {
return isSend ? SEND_TEXT : RECEIVE_TEXT;
}
if (msgContent instanceof ImageMessage) {
return isSend ? SEND_IMAGE : RECEIVE_IMAGE;
}
if (msgContent instanceof FileMessage) {
FileMessage fileMessage = (FileMessage) msgContent;
if (MediaFileUtils.isImageFileType(fileMessage.getName())) {
return isSend ? SEND_STICKER : RECEIVE_STICKER;
} else if (MediaFileUtils.isVideoFileType(fileMessage.getName())) {
return isSend ? SEND_VIDEO : RECEIVE_VIDEO;
}
}
if (msgContent instanceof LocationMessage) {
return isSend ? SEND_LOCATION : RECEIVE_LOCATION;
}
if (msgContent instanceof GroupNotificationMessage) {
return RECEIVE_NOTIFICATION;
}
if (msgContent instanceof VoiceMessage) {
return isSend ? SEND_VOICE : RECEIVE_VOICE;
}
if (msgContent instanceof RedPacketMessage) {
return isSend ? SEND_RED_PACKET : RECEIVE_RED_PACKET;
}
if (msgContent instanceof RecallNotificationMessage) {
return RECALL_NOTIFICATION;
}
return UNDEFINE_MSG;
}