當前位置: 首頁>>代碼示例>>Java>>正文


Java ChatMessageCell類代碼示例

本文整理匯總了Java中org.telegram.ui.Cells.ChatMessageCell的典型用法代碼示例。如果您正苦於以下問題:Java ChatMessageCell類的具體用法?Java ChatMessageCell怎麽用?Java ChatMessageCell使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


ChatMessageCell類屬於org.telegram.ui.Cells包,在下文中一共展示了ChatMessageCell類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: updateMessagesVisisblePart

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
public void updateMessagesVisisblePart() {
    if (chatListView == null) {
        return;
    }
    int count = chatListView.getChildCount();
    int additionalTop = chatActivityEnterView.isTopViewVisible() ? AndroidUtilities.dp(48) : 0;
    int height = chatListView.getMeasuredHeight();
    for (int a = 0; a < count; a++) {
        View view = chatListView.getChildAt(a);
        if (view instanceof ChatMessageCell) {
            ChatMessageCell messageCell = (ChatMessageCell) view;
            int top = messageCell.getTop();
            int bottom = messageCell.getBottom();
            int viewTop = top >= 0 ? 0 : -top;
            int viewBottom = messageCell.getMeasuredHeight();
            if (viewBottom > height) {
                viewBottom = viewTop + height;
            }
            messageCell.setVisiblePart(viewTop, viewBottom - viewTop);
        }
    }
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:23,代碼來源:ChatActivity.java

示例2: processRowSelect

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
public void processRowSelect(View view) {
    MessageObject message = null;
    if (view instanceof ChatMessageCell) {
        message = ((ChatMessageCell) view).getMessageObject();
    } else if (view instanceof ChatActionCell) {
        message = ((ChatActionCell) view).getMessageObject();
    }

    int type = getMessageType(message);

    if (type < 2 || type == 20) {
        return;
    }
    addToSelectedMessages(message);
    updateActionModeTitle();
    updateVisibleRows();
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:18,代碼來源:ChatActivity.java

示例3: updateInformationForScreenshotDetector

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
public void updateInformationForScreenshotDetector() {
    if (currentEncryptedChat == null) {
        return;
    }
    ArrayList<Long> visibleMessages = new ArrayList<>();
    if (chatListView != null) {
        int count = chatListView.getChildCount();
        for (int a = 0; a < count; a++) {
            View view = chatListView.getChildAt(a);
            MessageObject object = null;
            if (view instanceof ChatMessageCell) {
                ChatMessageCell cell = (ChatMessageCell) view;
                object = cell.getMessageObject();
            }
            if (object != null && object.getId() < 0 && object.messageOwner.random_id != 0) {
                visibleMessages.add(object.messageOwner.random_id);
            }
        }
    }
    MediaController.getInstance().setLastEncryptedChatParams(chatEnterTime, chatLeaveTime, currentEncryptedChat, visibleMessages);
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:22,代碼來源:ChatActivity.java

示例4: onViewAttachedToWindow

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
    if (holder.itemView instanceof ChatMessageCell) {
        final ChatMessageCell messageCell = (ChatMessageCell) holder.itemView;
        messageCell.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                messageCell.getViewTreeObserver().removeOnPreDrawListener(this);

                int height = chatListView.getMeasuredHeight();
                int top = messageCell.getTop();
                int bottom = messageCell.getBottom();
                int viewTop = top >= 0 ? 0 : -top;
                int viewBottom = messageCell.getMeasuredHeight();
                if (viewBottom > height) {
                    viewBottom = viewTop + height;
                }
                messageCell.setVisiblePart(viewTop, viewBottom - viewTop);

                return true;
            }
        });
        messageCell.setHighlighted(highlightMessageId != Integer.MAX_VALUE && messageCell.getMessageObject().getId() == highlightMessageId);
    }
}
 
開發者ID:MLNO,項目名稱:airgram,代碼行數:26,代碼來源:ChatActivity.java

示例5: getSwipeDirs

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
@Override
public int getSwipeDirs(RecyclerView recyclerView,RecyclerView.ViewHolder viewHolder) {
    if (viewHolder.itemView instanceof ChatMessageCell) {
        int type = getMessageType(message);
        boolean allowChatActions = true;
        message = ((ChatMessageCell) viewHolder.itemView).getMessageObject();
        boolean isVoiceMsg = MessageObject.isVoiceDocument(this.message.getDocument());
        if ((currentEncryptedChat != null && AndroidUtilities.getPeerLayerVersion(ChatActivity.this.currentEncryptedChat.layer) < 46) || ((type == ChatActivity.attach_gallery && this.message.getDialogId() == ChatActivity.this.mergeDialogId) || ((ChatActivity.this.currentEncryptedChat == null && this.message.getId() < 0) || ChatActivity.this.isBroadcast || ((ChatActivity.this.currentChat != null && (ChatObject.isNotInChat(ChatActivity.this.currentChat) || !(!ChatObject.isChannel(ChatActivity.this.currentChat) || ChatActivity.this.currentChat.creator || ChatActivity.this.currentChat.editor || ChatActivity.this.currentChat.megagroup))) || isVoiceMsg)))) {
            allowChatActions = false;
        }
        if (allowChatActions) {
            ChatActivity.this.chatListView.cancelClickRunnables(true);
            return super.getSwipeDirs(recyclerView, viewHolder);
        }
    }
    return ChatActivity.attach_photo;
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:18,代碼來源:ChatActivity.java

示例6: updateMessagesVisisblePart

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
private void updateMessagesVisisblePart() {
    if (chatListView == null) {
        return;
    }
    int count = chatListView.getChildCount();
    int additionalTop = chatActivityEnterView.isTopViewVisible() ? AndroidUtilities.dp(48) : 0;
    int height = chatListView.getMeasuredHeight();
    for (int a = 0; a < count; a++) {
        View view = chatListView.getChildAt(a);
        if (view instanceof ChatMessageCell) {
            ChatMessageCell messageCell = (ChatMessageCell) view;
            int top = messageCell.getTop();
            int bottom = messageCell.getBottom();
            int viewTop = top >= 0 ? 0 : -top;
            int viewBottom = messageCell.getMeasuredHeight();
            if (viewBottom > height) {
                viewBottom = viewTop + height;
            }
            messageCell.setVisiblePart(viewTop, viewBottom - viewTop);
        }
    }
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:23,代碼來源:ChatActivity.java

示例7: processRowSelect

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
private void processRowSelect(View view) {
    MessageObject message = null;
    if (view instanceof ChatMessageCell) {
        message = ((ChatMessageCell) view).getMessageObject();
    } else if (view instanceof ChatActionCell) {
        message = ((ChatActionCell) view).getMessageObject();
    }

    int type = getMessageType(message);

    if (type < 2 || type == 20) {
        return;
    }
    addToSelectedMessages(message);
    updateActionModeTitle();
    updateVisibleRows();
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:18,代碼來源:ChatActivity.java

示例8: updateInformationForScreenshotDetector

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
private void updateInformationForScreenshotDetector() {
    if (currentEncryptedChat == null) {
        return;
    }
    ArrayList<Long> visibleMessages = new ArrayList<>();
    if (chatListView != null) {
        int count = chatListView.getChildCount();
        for (int a = 0; a < count; a++) {
            View view = chatListView.getChildAt(a);
            MessageObject object = null;
            if (view instanceof ChatMessageCell) {
                ChatMessageCell cell = (ChatMessageCell) view;
                object = cell.getMessageObject();
            }
            if (object != null && object.getId() < 0 && object.messageOwner.random_id != 0) {
                visibleMessages.add(object.messageOwner.random_id);
            }
        }
    }
    MediaController.getInstance().setLastEncryptedChatParams(chatEnterTime, chatLeaveTime, currentEncryptedChat, visibleMessages);
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:22,代碼來源:ChatActivity.java

示例9: processRowSelect

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
private void processRowSelect(View view, boolean outside) {
    MessageObject message = null;
    if (view instanceof ChatMessageCell) {
        message = ((ChatMessageCell) view).getMessageObject();
    } else if (view instanceof ChatActionCell) {
        message = ((ChatActionCell) view).getMessageObject();
    }

    int type = getMessageType(message);

    if (type < 2 || type == 20) {
        return;
    }
    addToSelectedMessages(message, outside);
    updateActionModeTitle();
    updateVisibleRows();
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:18,代碼來源:ChatActivity.java

示例10: setCellSelectionBackground

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
private void setCellSelectionBackground(MessageObject message, ChatMessageCell messageCell, int idx) {
    MessageObject.GroupedMessages groupedMessages = getValidGroupedMessage(message);
    if (groupedMessages != null) {
        boolean hasUnselected = false;
        for (int a = 0; a < groupedMessages.messages.size(); a++) {
            if (!selectedMessagesIds[idx].containsKey(groupedMessages.messages.get(a).getId())) {
                hasUnselected = true;
                break;
            }
        }
        if (!hasUnselected) {
            groupedMessages = null;
        }
    }
    if (groupedMessages == null) {
        messageCell.setBackgroundColor(Theme.getColor(Theme.key_chat_selectedBackground));
    } else {
        messageCell.setBackground(null);
    }
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:21,代碼來源:ChatActivity.java

示例11: onSwiped

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
@Override
public void onSwiped(RecyclerView.ViewHolder viewHolder, int swipeDir) {
    itemTouchHelper.attachToRecyclerView(null);
    itemTouchHelper.attachToRecyclerView(chatListView);
    MessageObject   message = ((ChatMessageCell) viewHolder.itemView).getMessageObject();
    int type = getMessageType(message);
    if (type == ChatActivity.attach_gallery) {
        if (currentChat != null && !isBroadcast) {
            showReplyPanel(true, message, null, null, false, true);
        }
    } else if (type != 0 && type != ChatActivity.edit_done) {
        showReplyPanel(true, message, null, null, false, true);
    }
}
 
開發者ID:pooyafaroka,項目名稱:PlusGram,代碼行數:15,代碼來源:ChatActivity.java

示例12: onViewAttachedToWindow

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
    if (holder.itemView instanceof ChatMessageCell) {
        final ChatMessageCell messageCell = (ChatMessageCell) holder.itemView;
        MessageObject message = messageCell.getMessageObject();

        boolean selected = false;
        boolean disableSelection = false;
        messageCell.setBackgroundDrawable(null);
        messageCell.setCheckPressed(!disableSelection, disableSelection && selected);

        messageCell.getViewTreeObserver().addOnPreDrawListener(new ViewTreeObserver.OnPreDrawListener() {
            @Override
            public boolean onPreDraw() {
                messageCell.getViewTreeObserver().removeOnPreDrawListener(this);

                int height = chatListView.getMeasuredHeight();
                int top = messageCell.getTop();
                int bottom = messageCell.getBottom();
                int viewTop = top >= 0 ? 0 : -top;
                int viewBottom = messageCell.getMeasuredHeight();
                if (viewBottom > height) {
                    viewBottom = viewTop + height;
                }
                messageCell.setVisiblePart(viewTop, viewBottom - viewTop);

                return true;
            }
        });
        messageCell.setHighlighted(false);
    }
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:33,代碼來源:ChannelAdminLogActivity.java

示例13: onItemClick

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
@Override
public void onItemClick(View view, int position, float x, float y) {
    if (actionBar.isActionModeShowed()) {
        boolean outside = false;
        if (view instanceof ChatMessageCell) {
            outside = !((ChatMessageCell) view).isInsideBackground(x, y);
        }
        processRowSelect(view, outside);
        return;
    }
    createMenu(view, true, false);
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:13,代碼來源:ChatActivity.java

示例14: updateInformationForScreenshotDetector

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
private void updateInformationForScreenshotDetector() {
    if (currentUser == null) {
        return;
    }
    ArrayList<Long> visibleMessages;
    int messageId = 0;
    if (currentEncryptedChat != null) {
        visibleMessages = new ArrayList<>();
        if (chatListView != null) {
            int count = chatListView.getChildCount();
            for (int a = 0; a < count; a++) {
                View view = chatListView.getChildAt(a);
                MessageObject object = null;
                if (view instanceof ChatMessageCell) {
                    ChatMessageCell cell = (ChatMessageCell) view;
                    object = cell.getMessageObject();
                }
                if (object != null && object.getId() < 0 && object.messageOwner.random_id != 0) {
                    visibleMessages.add(object.messageOwner.random_id);
                }
            }
        }
        MediaController.getInstance().setLastVisibleMessageIds(chatEnterTime, chatLeaveTime, currentUser, currentEncryptedChat, visibleMessages, messageId);
    } else {
        SecretMediaViewer viewer = SecretMediaViewer.getInstance();
        MessageObject messageObject = viewer.getCurrentMessageObject();
        if (messageObject != null && !messageObject.isOut()) {
            MediaController.getInstance().setLastVisibleMessageIds(viewer.getOpenTime(), viewer.getCloseTime(), currentUser, null, null, messageObject.getId());
        }
    }
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:32,代碼來源:ChatActivity.java

示例15: onBindViewHolder

import org.telegram.ui.Cells.ChatMessageCell; //導入依賴的package包/類
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    MessageObject message = messages.get(position);
    View view = holder.itemView;

    if (view instanceof ChatMessageCell) {
        ChatMessageCell messageCell = (ChatMessageCell) view;
        messageCell.isChat = false;
        int nextType = getItemViewType(position - 1);
        int prevType = getItemViewType(position + 1);
        boolean pinnedBotton;
        boolean pinnedTop;
        if (!(message.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && nextType == holder.getItemViewType()) {
            MessageObject nextMessage = messages.get(position - 1);
            pinnedBotton = nextMessage.isOutOwner() == message.isOutOwner() && Math.abs(nextMessage.messageOwner.date - message.messageOwner.date) <= 5 * 60;
        } else {
            pinnedBotton = false;
        }
        if (prevType == holder.getItemViewType()) {
            MessageObject prevMessage = messages.get(position + 1);
            pinnedTop = !(prevMessage.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && prevMessage.isOutOwner() == message.isOutOwner() && Math.abs(prevMessage.messageOwner.date - message.messageOwner.date) <= 5 * 60;
        } else {
            pinnedTop = false;
        }
        messageCell.setFullyDraw(true);
        messageCell.setMessageObject(message, null, pinnedBotton, pinnedTop);
    } else if (view instanceof ChatActionCell) {
        ChatActionCell actionCell = (ChatActionCell) view;
        actionCell.setMessageObject(message);
        actionCell.setAlpha(1.0f);
    }
}
 
開發者ID:DrKLO,項目名稱:Telegram,代碼行數:33,代碼來源:ThemePreviewActivity.java


注:本文中的org.telegram.ui.Cells.ChatMessageCell類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。