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


Java QBChatMessage.getDialogId方法代码示例

本文整理汇总了Java中com.quickblox.chat.model.QBChatMessage.getDialogId方法的典型用法代码示例。如果您正苦于以下问题:Java QBChatMessage.getDialogId方法的具体用法?Java QBChatMessage.getDialogId怎么用?Java QBChatMessage.getDialogId使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.quickblox.chat.model.QBChatMessage的用法示例。


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

示例1: checkForSendingNotification

import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
protected void checkForSendingNotification(boolean ownMessage, QBChatMessage qbChatMessage, QMUser user,
                                           boolean isPrivateChat) {
    String dialogId = qbChatMessage.getDialogId();
    if (qbChatMessage.getId() == null || dialogId == null) {
        return;
    }

    if (!ownMessage) {
        sendNotificationBroadcast(QBServiceConsts.GOT_CHAT_MESSAGE, qbChatMessage, user, dialogId, isPrivateChat);
    }

    if (currentDialog != null) {
        if (!ownMessage && !currentDialog.getDialogId().equals(dialogId)) {
            sendNotificationBroadcast(QBServiceConsts.GOT_CHAT_MESSAGE_LOCAL, qbChatMessage, user, dialogId, isPrivateChat);
        }
    } else if (!ownMessage) {
        sendNotificationBroadcast(QBServiceConsts.GOT_CHAT_MESSAGE_LOCAL, qbChatMessage, user, dialogId,
                isPrivateChat);
    }
}
 
开发者ID:QuickBlox,项目名称:q-municate-android,代码行数:21,代码来源:QBChatHelper.java

示例2: updateGroupDialogByNotification

import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
private void updateGroupDialogByNotification(QBChatMessage qbChatMessage) {
    String dialogId = qbChatMessage.getDialogId();
    QBChatDialog qbDialog = dataManager.getQBChatDialogDataManager().getByDialogId(dialogId);
    if (qbDialog == null) {
        qbDialog = ChatNotificationUtils.parseDialogFromQBMessage(context, qbChatMessage, QBDialogType.GROUP);
    }

    ChatNotificationUtils.updateDialogFromQBMessage(context, dataManager, qbChatMessage, qbDialog);
    DbUtils.saveDialogToCache(dataManager, qbDialog);

    notifyUpdatingDialog();
}
 
开发者ID:QuickBlox,项目名称:q-municate-android,代码行数:13,代码来源:QBChatHelper.java

示例3: friendRequestMessageReceived

import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
private void friendRequestMessageReceived(QBChatMessage qbChatMessage, DialogNotification.Type notificationType) {
    String dialogId = qbChatMessage.getDialogId();
    Message message = parseReceivedMessage(qbChatMessage);

    if (!QMUserService.getInstance().getUserCache().exists((long) qbChatMessage.getSenderId())) {
        QBRestHelper.loadAndSaveUser(qbChatMessage.getSenderId());
    }

    DialogNotification dialogNotification = ChatUtils.convertMessageToDialogNotification(message);
    dialogNotification.setType(notificationType);

    QBChatDialog chatDialog = dataManager.getQBChatDialogDataManager().getByDialogId(dialogId);
    if (chatDialog == null) {
        QBChatDialog newChatDialog = ChatNotificationUtils.parseDialogFromQBMessage(context, qbChatMessage, QBDialogType.PRIVATE);
        ArrayList<Integer> occupantsIdsList = ChatUtils.createOccupantsIdsFromPrivateMessage(chatCreator.getId(), qbChatMessage.getSenderId());
        newChatDialog.setOccupantsIds(occupantsIdsList);
        DbUtils.saveDialogToCache(dataManager, newChatDialog, false);
    }

    DialogOccupant dialogOccupant = dataManager.getDialogOccupantDataManager().getDialogOccupant(dialogId, qbChatMessage.getSenderId());
    DbUtils.saveDialogNotificationToCache(context, dataManager, dialogOccupant, qbChatMessage, false);

    if (dialogOccupant != null) {
        checkForSendingNotification(false, qbChatMessage, dialogOccupant.getUser(), true);
    }
}
 
开发者ID:QuickBlox,项目名称:q-municate-android,代码行数:27,代码来源:QBChatHelper.java

示例4: parseDialogFromQBMessage

import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
public static QBChatDialog parseDialogFromQBMessage(Context context, QBChatMessage qbChatMessage, QBDialogType qbDialogType) {
    String dialogId = qbChatMessage.getDialogId();
    String currentOccupantsIdsString = (String) qbChatMessage.getProperty(PROPERTY_ROOM_CURRENT_OCCUPANTS_IDS);
    String addedOccupantsIdsString = (String) qbChatMessage.getProperty(PROPERTY_ROOM_ADDED_OCCUPANTS_IDS);
    String dialogName = (String) qbChatMessage.getProperty(PROPERTY_ROOM_NAME);
    String photoUrl = (String) qbChatMessage.getProperty(PROPERTY_ROOM_PHOTO);
    long dateSent = ChatUtils.getMessageDateSent(qbChatMessage);
    String updatedAtString = (String) qbChatMessage.getProperty(PROPERTY_ROOM_UPDATED_AT);
    String roomJid = ChatUtils.getRoomJid(dialogId);

    QBChatDialog qbDialog = new QBChatDialog(dialogId);
    qbDialog.setRoomJid(roomJid);
    qbDialog.setPhoto(photoUrl);
    qbDialog.setType(qbDialogType);

    qbDialog.setName(dialogName);

    if (!TextUtils.isEmpty(currentOccupantsIdsString)) {
        qbDialog.setOccupantsIds((ArrayList<Integer>) ChatUtils.getOccupantsIdsListFromString(currentOccupantsIdsString));
    } else if (!TextUtils.isEmpty(addedOccupantsIdsString)) {
        qbDialog.setOccupantsIds((ArrayList<Integer>) ChatUtils.getOccupantsIdsListFromString(addedOccupantsIdsString));
    }

    if (!CollectionUtils.isEmpty(qbChatMessage.getAttachments())) {
        qbDialog.setLastMessage(context.getString(R.string.dlg_attached_last_message));
    } else if (!TextUtils.isEmpty(qbChatMessage.getBody())) {
        qbDialog.setLastMessage(qbChatMessage.getBody());
    }

    qbDialog.setLastMessageDateSent(dateSent);
    qbDialog.setUnreadMessageCount(ConstsCore.ZERO_INT_VALUE);

    if (!TextUtils.isEmpty(updatedAtString)) {
        qbDialog.setUpdatedAt(new Date(Long.parseLong(updatedAtString)));
    }

    return qbDialog;
}
 
开发者ID:QuickBlox,项目名称:q-municate-android,代码行数:39,代码来源:ChatNotificationUtils.java

示例5: parseReceivedMessage

import com.quickblox.chat.model.QBChatMessage; //导入方法依赖的package包/类
protected Message parseReceivedMessage(QBChatMessage qbChatMessage) {
        long dateSent = ChatUtils.getMessageDateSent(qbChatMessage);
        String attachUrl = ChatUtils.getAttachUrlIfExists(qbChatMessage);
        String dialogId = qbChatMessage.getDialogId();

        Message message = new Message();
        message.setMessageId(qbChatMessage.getId());
        message.setBody(qbChatMessage.getBody());
        message.setCreatedDate(dateSent);
        message.setState(State.DELIVERED);

        DialogOccupant dialogOccupant = dataManager.getDialogOccupantDataManager().getDialogOccupant(dialogId, qbChatMessage.getSenderId());
        if (dialogOccupant == null) {
            dialogOccupant = new DialogOccupant();
            QBChatDialog chatDialog = dataManager.getQBChatDialogDataManager().getByDialogId(dialogId);
            if (chatDialog != null) {
                dialogOccupant.setDialog(DialogTransformUtils.createLocalDialog(chatDialog));
            }
            QMUser user = QMUserService.getInstance().getUserCache().get((long) qbChatMessage.getSenderId());
            if (user != null) {
                dialogOccupant.setUser(user);
            }
        }

        message.setDialogOccupant(dialogOccupant);

        if (qbChatMessage.getAttachments() != null && !qbChatMessage.getAttachments().isEmpty()) {
            Attachment attachment = new Attachment();
//            if (getAttachmentType(qbChatMessage.getAttachments()).equalsIgnoreCase(Attachment.Type.LOCATION.toString())) {
//                attachment.setType(Attachment.Type.LOCATION);
//            } else {
//                attachment.setType(Attachment.Type.IMAGE);
//            }
            if (getAttachmentType(qbChatMessage.getAttachments()).equalsIgnoreCase(QBAttachment.PHOTO_TYPE)) {
                attachment.setType(Attachment.Type.IMAGE);
            } else {
                attachment.setType(Attachment.Type.valueOf(getAttachmentType(qbChatMessage.getAttachments()).toUpperCase()));
            }
            attachment.setRemoteUrl(attachUrl);
            message.setAttachment(attachment);
        }

        return message;
    }
 
开发者ID:QuickBlox,项目名称:q-municate-android,代码行数:45,代码来源:QBChatHelper.java


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