本文整理汇总了Java中org.telegram.ui.Cells.ChatMessageCell.setHighlighted方法的典型用法代码示例。如果您正苦于以下问题:Java ChatMessageCell.setHighlighted方法的具体用法?Java ChatMessageCell.setHighlighted怎么用?Java ChatMessageCell.setHighlighted使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.telegram.ui.Cells.ChatMessageCell
的用法示例。
在下文中一共展示了ChatMessageCell.setHighlighted方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: 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);
}
}
示例2: 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);
}
}
示例3: onBindViewHolder
import org.telegram.ui.Cells.ChatMessageCell; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (position == botInfoRow) {
BotHelpCell helpView = (BotHelpCell) holder.itemView;
helpView.setText(!botInfo.isEmpty() ? botInfo.get(currentUser.id).description : null);
} else if (position == loadingDownRow || position == loadingUpRow) {
ChatLoadingCell loadingCell = (ChatLoadingCell) holder.itemView;
loadingCell.setProgressVisible(loadsCount > 1);
} else if (position >= messagesStartRow && position < messagesEndRow) {
MessageObject message = messages.get(messages.size() - (position - messagesStartRow) - 1);
View view = holder.itemView;
boolean selected = false;
boolean disableSelection = false;
if (actionBar.isActionModeShowed()) {
MessageObject messageObject = chatActivityEnterView != null ? chatActivityEnterView.getEditingMessageObject() : null;
if (messageObject == message || selectedMessagesIds[message.getDialogId() == dialog_id ? 0 : 1].containsKey(message.getId())) {
view.setBackgroundColor(Theme.MSG_SELECTED_BACKGROUND_COLOR);
selected = true;
} else {
view.setBackgroundColor(0);
}
disableSelection = true;
} else {
view.setBackgroundColor(0);
}
if (view instanceof ChatMessageCell) {
ChatMessageCell messageCell = (ChatMessageCell) view;
messageCell.isChat = currentChat != null;
messageCell.setMessageObject(message);
messageCell.setCheckPressed(!disableSelection, disableSelection && selected);
if (view instanceof ChatMessageCell && MediaController.getInstance().canDownloadMedia(MediaController.AUTODOWNLOAD_MASK_AUDIO)) {
((ChatMessageCell) view).downloadAudioIfNeed();
}
messageCell.setHighlighted(highlightMessageId != Integer.MAX_VALUE && message.getId() == highlightMessageId);
if (searchContainer != null && searchContainer.getVisibility() == View.VISIBLE && MessagesSearchQuery.getLastSearchQuery() != null) {
messageCell.setHighlightedText(MessagesSearchQuery.getLastSearchQuery());
} else {
messageCell.setHighlightedText(null);
}
} else if (view instanceof ChatActionCell) {
ChatActionCell actionCell = (ChatActionCell) view;
actionCell.setMessageObject(message);
} else if (view instanceof ChatUnreadCell) {
ChatUnreadCell unreadCell = (ChatUnreadCell) view;
unreadCell.setText(LocaleController.formatPluralString("NewMessages", unread_to_load));
}
}
}
示例4: onBindViewHolder
import org.telegram.ui.Cells.ChatMessageCell; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (position == botInfoRow) {
BotHelpCell helpView = (BotHelpCell) holder.itemView;
helpView.setText(!botInfo.isEmpty() ? botInfo.get(currentUser.id).description : null);
} else if (position == loadingDownRow || position == loadingUpRow) {
ChatLoadingCell loadingCell = (ChatLoadingCell) holder.itemView;
loadingCell.setProgressVisible(loadsCount > 1);
} else if (position >= messagesStartRow && position < messagesEndRow) {
MessageObject message = messages.get(messages.size() - (position - messagesStartRow) - 1);
View view = holder.itemView;
boolean selected = false;
boolean disableSelection = false;
if (actionBar.isActionModeShowed()) {
MessageObject messageObject = chatActivityEnterView != null ? chatActivityEnterView.getEditingMessageObject() : null;
if (messageObject == message || selectedMessagesIds[message.getDialogId() == dialog_id ? 0 : 1].containsKey(message.getId())) {
view.setBackgroundColor(Theme.MSG_SELECTED_BACKGROUND_COLOR);
selected = true;
} else {
view.setBackgroundColor(0);
}
disableSelection = true;
} else {
view.setBackgroundColor(0);
}
if (view instanceof ChatMessageCell) {
ChatMessageCell messageCell = (ChatMessageCell) view;
messageCell.isChat = currentChat != null;
messageCell.setMessageObject(message);
messageCell.setCheckPressed(!disableSelection, disableSelection && selected);
if (view instanceof ChatMessageCell && MediaController.getInstance().canDownloadMedia(MediaController.AUTODOWNLOAD_MASK_AUDIO)) {
((ChatMessageCell) view).downloadAudioIfNeed();
}
messageCell.setHighlighted(highlightMessageId != Integer.MAX_VALUE && message.getId() == highlightMessageId);
if (searchContainer != null && searchContainer.getVisibility() == View.VISIBLE && MessagesSearchQuery.getLastSearchQuery() != null) {
messageCell.setHighlightedText(MessagesSearchQuery.getLastSearchQuery());
} else {
messageCell.setHighlightedText(null);
}
} else if (view instanceof ChatActionCell) {
ChatActionCell actionCell = (ChatActionCell) view;
actionCell.setMessageObject(message);
} else if (view instanceof ChatUnreadCell) {
ChatUnreadCell unreadCell = (ChatUnreadCell) view;
unreadCell.setText(LocaleController.formatPluralString("NewMessages", unread_to_load));
}
}
}
示例5: onBindViewHolder
import org.telegram.ui.Cells.ChatMessageCell; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
if (position == loadingUpRow) {
ChatLoadingCell loadingCell = (ChatLoadingCell) holder.itemView;
loadingCell.setProgressVisible(loadsCount > 1);
} else if (position >= messagesStartRow && position < messagesEndRow) {
MessageObject message = messages.get(messages.size() - (position - messagesStartRow) - 1);
View view = holder.itemView;
if (view instanceof ChatMessageCell) {
final ChatMessageCell messageCell = (ChatMessageCell) view;
messageCell.isChat = true;
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(messages.size() - (position + 1 - messagesStartRow) - 1);
pinnedBotton = nextMessage.isOutOwner() == message.isOutOwner() && (nextMessage.messageOwner.from_id == message.messageOwner.from_id) && Math.abs(nextMessage.messageOwner.date - message.messageOwner.date) <= 5 * 60;
} else {
pinnedBotton = false;
}
if (prevType == holder.getItemViewType()) {
MessageObject prevMessage = messages.get(messages.size() - (position - messagesStartRow));
pinnedTop = !(prevMessage.messageOwner.reply_markup instanceof TLRPC.TL_replyInlineMarkup) && prevMessage.isOutOwner() == message.isOutOwner() && (prevMessage.messageOwner.from_id == message.messageOwner.from_id) && Math.abs(prevMessage.messageOwner.date - message.messageOwner.date) <= 5 * 60;
} else {
pinnedTop = false;
}
messageCell.setMessageObject(message, null, pinnedBotton, pinnedTop);
if (view instanceof ChatMessageCell && MediaController.getInstance().canDownloadMedia(message)) {
((ChatMessageCell) view).downloadAudioIfNeed();
}
messageCell.setHighlighted(false);
messageCell.setHighlightedText(null);
} else if (view instanceof ChatActionCell) {
ChatActionCell actionCell = (ChatActionCell) view;
actionCell.setMessageObject(message);
actionCell.setAlpha(1.0f);
}
}
}
示例6: 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;
if (actionBar.isActionModeShowed()) {
MessageObject messageObject = chatActivityEnterView != null ? chatActivityEnterView.getEditingMessageObject() : null;
int idx = message.getDialogId() == dialog_id ? 0 : 1;
if (messageObject == message || selectedMessagesIds[idx].containsKey(message.getId())) {
setCellSelectionBackground(message, messageCell, idx);
selected = true;
} else {
messageCell.setBackgroundDrawable(null);
}
disableSelection = true;
} else {
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(highlightMessageId != Integer.MAX_VALUE && messageCell.getMessageObject().getId() == highlightMessageId);
}
}