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


Java ChatActionCell类代码示例

本文整理汇总了Java中org.telegram.ui.Cells.ChatActionCell的典型用法代码示例。如果您正苦于以下问题:Java ChatActionCell类的具体用法?Java ChatActionCell怎么用?Java ChatActionCell使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: processRowSelect

import org.telegram.ui.Cells.ChatActionCell; //导入依赖的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

示例2: processRowSelect

import org.telegram.ui.Cells.ChatActionCell; //导入依赖的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

示例3: processRowSelect

import org.telegram.ui.Cells.ChatActionCell; //导入依赖的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

示例4: onBindViewHolder

import org.telegram.ui.Cells.ChatActionCell; //导入依赖的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

示例5: onBindViewHolder

import org.telegram.ui.Cells.ChatActionCell; //导入依赖的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));
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:51,代码来源:ChatActivity.java

示例6: onBindViewHolder

import org.telegram.ui.Cells.ChatActionCell; //导入依赖的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));
        }


    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:53,代码来源:ChatActivity.java

示例7: onBindViewHolder

import org.telegram.ui.Cells.ChatActionCell; //导入依赖的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);
        }
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:42,代码来源:ChannelAdminLogActivity.java

示例8: onPause

import org.telegram.ui.Cells.ChatActionCell; //导入依赖的package包/类
@Override
public void onPause() {
    super.onPause();
    AndroidUtilities.cancelRunOnUIThread(readRunnable);
    MediaController.getInstance().stopRaiseToEarSensors(this);
    paused = true;
    wasPaused = true;
    NotificationsController.getInstance().setOpenedDialogId(0);
    CharSequence draftMessage = null;
    MessageObject replyMessage = null;
    boolean searchWebpage = true;
    if (!ignoreAttachOnPause && chatActivityEnterView != null && bottomOverlayChat.getVisibility() != View.VISIBLE) {
        chatActivityEnterView.onPause();
        replyMessage = replyingMessageObject;
        if (!chatActivityEnterView.isEditingMessage()) {
            CharSequence text = AndroidUtilities.getTrimmedString(chatActivityEnterView.getFieldText());
            if (!TextUtils.isEmpty(text) && !TextUtils.equals(text, "@gif")) {
                draftMessage = text;
            }
        }
        searchWebpage = chatActivityEnterView.isMessageWebPageSearchEnabled();
        chatActivityEnterView.setFieldFocused(false);
    }
    if (chatAttachAlert != null) {
        if (!ignoreAttachOnPause){
            chatAttachAlert.onPause();
        } else {
            ignoreAttachOnPause = false;
        }
    }
    CharSequence[] message = new CharSequence[] {draftMessage};
    ArrayList<TLRPC.MessageEntity> entities = MessagesQuery.getEntities(message);
    DraftQuery.saveDraft(dialog_id, message[0], entities, replyMessage != null ? replyMessage.messageOwner : null, !searchWebpage);

    MessagesController.getInstance().cancelTyping(0, dialog_id);

    if (!pausedOnLastMessage) {
        SharedPreferences.Editor editor = ApplicationLoader.applicationContext.getSharedPreferences("Notifications", Activity.MODE_PRIVATE).edit();
        int messageId = 0;
        int offset = 0;
        if (chatLayoutManager != null) {
            int position = chatLayoutManager.findFirstVisibleItemPosition();
            if (position != 0) {
                RecyclerListView.Holder holder = (RecyclerListView.Holder) chatListView.findViewHolderForAdapterPosition(position);
                if (holder != null) {
                    if (holder.itemView instanceof ChatMessageCell) {
                        messageId = ((ChatMessageCell) holder.itemView).getMessageObject().getId();
                    } else if (holder.itemView instanceof ChatActionCell) {
                        messageId = ((ChatActionCell) holder.itemView).getMessageObject().getId();
                    }
                    if (messageId != 0) {
                        offset = holder.itemView.getBottom() - chatListView.getMeasuredHeight();
                        FileLog.d("save offset = " + offset + " for mid " + messageId);
                    }
                }
            }
        }
        if (messageId != 0) {
            editor.putInt("diditem" + dialog_id, messageId);
            editor.putInt("diditemo" + dialog_id, offset);
        } else {
            pausedOnLastMessage = true;
            editor.remove("diditem" + dialog_id);
            editor.remove("diditemo" + dialog_id);
        }
        editor.commit();
    }

    if (currentUser != null) {
        chatLeaveTime = System.currentTimeMillis();
        updateInformationForScreenshotDetector();
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:74,代码来源:ChatActivity.java


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