本文整理汇总了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);
}
}
}
示例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();
}
示例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);
}
示例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);
}
}
示例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;
}
示例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);
}
}
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}
}
示例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);
}
}
示例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);
}
}
示例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);
}
示例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());
}
}
}
示例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);
}
}