Java Code Examples for org.telegram.tgnet.TLRPC#TL_replyInlineMarkup

The following examples show how to use org.telegram.tgnet.TLRPC#TL_replyInlineMarkup . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: ThemePreviewActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@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);
    }
}
 
Example 2
Source File: ThemePreviewActivity.java    From TelePlus-Android with GNU General Public License v2.0 5 votes vote down vote up
@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);
    }
}
 
Example 3
Source File: ChannelAdminLogActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@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);
            messageCell.setHighlighted(false);
            messageCell.setHighlightedText(null);
        } else if (view instanceof ChatActionCell) {
            ChatActionCell actionCell = (ChatActionCell) view;
            actionCell.setMessageObject(message);
            actionCell.setAlpha(1.0f);
        }
    }
}
 
Example 4
Source File: ThemePreviewActivity.java    From Telegram-FOSS with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder.getItemViewType() != 2) {
        if (hasButtons()) {
            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.isChat = showSecretMessages;
            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);
        }
    }
}
 
Example 5
Source File: ChannelAdminLogActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@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);
            messageCell.setHighlighted(false);
            messageCell.setHighlightedText(null);
        } else if (view instanceof ChatActionCell) {
            ChatActionCell actionCell = (ChatActionCell) view;
            actionCell.setMessageObject(message);
            actionCell.setAlpha(1.0f);
        }
    }
}
 
Example 6
Source File: ThemePreviewActivity.java    From Telegram with GNU General Public License v2.0 5 votes vote down vote up
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    if (holder.getItemViewType() != 2) {
        if (hasButtons()) {
            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.isChat = showSecretMessages;
            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);
        }
    }
}
 
Example 7
Source File: ChannelAdminLogActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@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 && DownloadController.getInstance(currentAccount).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);
        }
    }
}
 
Example 8
Source File: ChannelAdminLogActivity.java    From TelePlus-Android with GNU General Public License v2.0 4 votes vote down vote up
@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 && DownloadController.getInstance(currentAccount).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);
        }
    }
}