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


Java RecyclerView.ViewHolder方法代码示例

本文整理汇总了Java中org.telegram.messenger.support.widget.RecyclerView.ViewHolder方法的典型用法代码示例。如果您正苦于以下问题:Java RecyclerView.ViewHolder方法的具体用法?Java RecyclerView.ViewHolder怎么用?Java RecyclerView.ViewHolder使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.telegram.messenger.support.widget.RecyclerView的用法示例。


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

示例1: onBindViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    switch (holder.getItemViewType()) {
        case 0:
            TLRPC.Document sticker = cache.get(position);
            ((StickerEmojiCell) holder.itemView).setSticker(sticker, false);
            break;
        case 1:
            if (position == totalItems) {
                int row = (position - 1) / stickersPerRow;
                TLRPC.TL_messages_stickerSet pack = rowStartPack.get(row);
                if (pack == null) {
                    ((EmptyCell) holder.itemView).setHeight(1);
                } else {
                    int height = pager.getHeight() - (int) Math.ceil(pack.documents.size() / (float) stickersPerRow) * AndroidUtilities.dp(82);
                    ((EmptyCell) holder.itemView).setHeight(height > 0 ? height : 1);
                }
            } else {
                ((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(82));
            }
            break;
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:24,代码来源:EmojiView.java

示例2: onCreateViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    Holder holder;
    switch (viewType) {
        case 1:
            holder = new Holder(new PhotoAttachCameraCell(mContext));
            break;
        default:
            if (!viewsCache.isEmpty()) {
                holder = viewsCache.get(0);
                viewsCache.remove(0);
            } else {
                holder = createHolder();
            }
            break;
    }

    return holder;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:20,代码来源:ChatAttachAlert.java

示例3: onBindViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    switch (holder.getItemViewType()) {
        case 0:
            TLRPC.Document sticker = cache.get(position);
            ((StickerEmojiCell) holder.itemView).setSticker(sticker, false);
            break;
        case 1:
            if (position == totalItems) {
                int row = (position - 1) / stickersPerRow;
                TLRPC.TL_messages_stickerSet pack = rowStartPack.get(row);
                if (pack == null) {
                    ((EmptyCell) holder.itemView).setHeight(1);
                } else {
                    int height = stickersGridView.getMeasuredHeight() - (int) Math.ceil(pack.documents.size() / (float) stickersPerRow) * AndroidUtilities.dp(82);
                    ((EmptyCell) holder.itemView).setHeight(height > 0 ? height : 1);
                }
            } else {
                ((EmptyCell) holder.itemView).setHeight(AndroidUtilities.dp(82));
            }
            break;
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:24,代码来源:StickerMasksView.java

示例4: onSwiped

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的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

示例5: getMovementFlags

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public int getMovementFlags(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder) {
    if (viewHolder.getItemViewType() != 0) {
        return makeMovementFlags(0, 0);
    }
    return makeMovementFlags(ItemTouchHelper.UP | ItemTouchHelper.DOWN, 0);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:8,代码来源:StickersActivity.java

示例6: onBindViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
    int side = 0;
    if (i == 0) {
        if (stickers.size() == 1) {
            side = 2;
        } else {
            side = -1;
        }
    } else if (i == stickers.size() - 1) {
        side = 1;
    }
    ((StickerCell) viewHolder.itemView).setSticker(stickers.get(i), side);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:15,代码来源:StickersAdapter.java

示例7: onBindViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder viewHolder, int i) {
    Holder holder = (Holder) viewHolder;
    if (i == enhanceTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_enhance, LocaleController.getString("Enhance", R.string.Enhance), enhanceValue);
    } else if (i == highlightsTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_highlights, LocaleController.getString("Highlights", R.string.Highlights), highlightsValue);
    } else if (i == contrastTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_contrast, LocaleController.getString("Contrast", R.string.Contrast), contrastValue);
    } else if (i == exposureTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_brightness, LocaleController.getString("Exposure", R.string.Exposure), exposureValue);
    } else if (i == warmthTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_warmth, LocaleController.getString("Warmth", R.string.Warmth), warmthValue);
    } else if (i == saturationTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_saturation, LocaleController.getString("Saturation", R.string.Saturation), saturationValue);
    } else if (i == vignetteTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_vignette, LocaleController.getString("Vignette", R.string.Vignette), vignetteValue);
    } else if (i == shadowsTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_shadows, LocaleController.getString("Shadows", R.string.Shadows), shadowsValue);
    } else if (i == grainTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_grain, LocaleController.getString("Grain", R.string.Grain), grainValue);
    } else if (i == sharpenTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_details, LocaleController.getString("Sharpen", R.string.Sharpen), sharpenValue);
    } else if (i == tintTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_tint, LocaleController.getString("Tint", R.string.Tint), tintHighlightsColor != 0 || tintShadowsColor != 0 ? "◆" : "");
    } else if (i == fadeTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_fade, LocaleController.getString("Fade", R.string.Fade), fadeValue);
    } else if (i == curvesTool) {
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_curve, LocaleController.getString("Curves", R.string.Curves), curvesToolValue.shouldBeSkipped() ? "" : "◆");
    } else if (i == blurTool) {
        String value = "";
        if (blurType == 1) {
            value = "R";
        } else if (blurType == 2) {
            value = "L";
        }
        ((PhotoEditToolCell) holder.itemView).setIconAndTextAndValue(R.drawable.tool_blur, LocaleController.getString("Blur", R.string.Blur), value);
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:40,代码来源:PhotoFilterView.java

示例8: onBindViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    HintDialogCell cell = (HintDialogCell) holder.itemView;

    TLRPC.TL_topPeer peer = SearchQuery.hints.get(position);
    TLRPC.TL_dialog dialog = new TLRPC.TL_dialog();
    TLRPC.Chat chat = null;
    TLRPC.User user = null;
    int did = 0;
    if (peer.peer.user_id != 0) {
        did = peer.peer.user_id;
        user = MessagesController.getInstance().getUser(peer.peer.user_id);
    } else if (peer.peer.channel_id != 0) {
        did = -peer.peer.channel_id;
        chat = MessagesController.getInstance().getChat(peer.peer.channel_id);
    } else if (peer.peer.chat_id != 0) {
        did = -peer.peer.chat_id;
        chat = MessagesController.getInstance().getChat(peer.peer.chat_id);
    }
    cell.setTag(did);
    String name = "";
    if (user != null) {
        name = ContactsController.formatName(user.first_name, user.last_name);
    } else if (chat != null) {
        name = chat.title;
    }
    cell.setDialog(did, false, name);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:29,代码来源:DialogsSearchAdapter.java

示例9: onBindViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    JoinSheetUserCell cell = (JoinSheetUserCell) holder.itemView;
    if (position < chatInvite.participants.size()) {
        cell.setUser(chatInvite.participants.get(position));
    } else {
        int participants_count;
        if (chatInvite.chat != null) {
            participants_count = chatInvite.chat.participants_count;
        } else {
            participants_count = chatInvite.participants_count;
        }
        cell.setCount(participants_count - chatInvite.participants.size());
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:16,代码来源:JoinGroupAlert.java

示例10: onBindViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的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

示例11: onBindViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    ((StickerEmojiCell) holder.itemView).setSticker(stickerSet.documents.get(position), true);
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:5,代码来源:StickersAlert.java

示例12: onBindViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
    ShareDialogCell cell = (ShareDialogCell) holder.itemView;
    TLRPC.TL_dialog dialog = getItem(position);
    cell.setDialog(dialog, selectedDialogs.containsKey(dialog.id), null);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:7,代码来源:ShareAlert.java

示例13: onCreateViewHolder

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup viewGroup, int i) {
    ContextLinkCell view = new ContextLinkCell(mContext);
    return new Holder(view);
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:6,代码来源:EmojiView.java

示例14: onViewAttachedToWindow

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public void onViewAttachedToWindow(RecyclerView.ViewHolder holder) {
    if (holder.itemView instanceof DialogCell) {
        ((DialogCell) holder.itemView).checkCurrentDialogIndex();
    }
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:7,代码来源:DialogsAdapter.java

示例15: onMove

import org.telegram.messenger.support.widget.RecyclerView; //导入方法依赖的package包/类
@Override
public boolean onMove(RecyclerView recyclerView, RecyclerView.ViewHolder viewHolder, RecyclerView.ViewHolder target) {
    return false;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:5,代码来源:ChatActivity.java


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