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


Java RecyclerListView类代码示例

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


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

示例1: checkListViewScroll

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
private void checkListViewScroll() {
    if (listView.getChildCount() <= 0 || openAnimationInProgress) {
        return;
    }

    View child = listView.getChildAt(0);
    RecyclerListView.Holder holder = (RecyclerListView.Holder) listView.findContainingViewHolder(child);
    int top = child.getTop();
    int newOffset = 0;
    if (top >= 0 && holder != null && holder.getAdapterPosition() == 0) {
        newOffset = top;
    }
    if (extraHeight != newOffset) {
        extraHeight = newOffset;
        topView.invalidate();
        if (playProfileAnimation) {
            allowProfileAnimation = extraHeight != 0;
        }
        needLayout();
    }
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:22,代码来源:ProfileActivity.java

示例2: onCreateViewHolder

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = new ManageChatUserCell(mContext, 2, true);
    view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    ((ManageChatUserCell) view).setDelegate(new ManageChatUserCell.ManageChatUserCellDelegate() {
        @Override
        public boolean onOptionsButtonCheck(ManageChatUserCell cell, boolean click) {
            TLObject object = getItem((Integer) cell.getTag());
            if (object instanceof TLRPC.ChatParticipant) {
                TLRPC.ChatParticipant participant = (TLRPC.ChatParticipant) getItem((Integer) cell.getTag());
                return createMenuForParticipant(participant, !click);
            } else {
                return false;
            }
        }
    });
    return new RecyclerListView.Holder(view);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:19,代码来源:ChatUsersActivity.java

示例3: onInterceptTouchEvent

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
public boolean onInterceptTouchEvent(MotionEvent event, final View listView, final int height) {
    if (event.getAction() == MotionEvent.ACTION_DOWN) {
        int x = (int) event.getX();
        int y = (int) event.getY();
        int count = 0;
        if (listView instanceof AbsListView) {
            count = ((AbsListView) listView).getChildCount();
        } else if (listView instanceof RecyclerListView) {
            count = ((RecyclerListView) listView).getChildCount();
        }
        for (int a = 0; a < count; a++) {
            View view = null;
            if (listView instanceof AbsListView) {
                view = ((AbsListView) listView).getChildAt(a);
            } else if (listView instanceof RecyclerListView) {
                view = ((RecyclerListView) listView).getChildAt(a);
            }
            if (view == null) {
                return false;
            }
            int top = view.getTop();
            int bottom = view.getBottom();
            int left = view.getLeft();
            int right = view.getRight();
            if (top > y || bottom < y || left > x || right < x) {
                continue;
            }
            boolean ok = false;
            if (view instanceof StickerEmojiCell) {
                ok = ((StickerEmojiCell) view).showingBitmap();
            } else if (view instanceof StickerCell) {
                ok = ((StickerCell) view).showingBitmap();
            } else if (view instanceof ContextLinkCell) {
                ContextLinkCell cell = (ContextLinkCell) view;
                ok = cell.isSticker() && cell.showingBitmap();
            }
            if (!ok) {
                return false;
            }
            startX = x;
            startY = y;
            currentStickerPreviewCell = view;
            openStickerPreviewRunnable = new Runnable() {
                @Override
                public void run() {
                    if (openStickerPreviewRunnable == null) {
                        return;
                    }
                    if (listView instanceof AbsListView) {
                        ((AbsListView) listView).setOnItemClickListener(null);
                        ((AbsListView) listView).requestDisallowInterceptTouchEvent(true);
                    } else if (listView instanceof RecyclerListView) {
                        ((RecyclerListView) listView).setOnItemClickListener(null);
                        ((RecyclerListView) listView).requestDisallowInterceptTouchEvent(true);
                    }
                    openStickerPreviewRunnable = null;
                    setParentActivity((Activity) listView.getContext());
                    setKeyboardHeight(height);
                    if (currentStickerPreviewCell instanceof StickerEmojiCell) {
                        open(((StickerEmojiCell) currentStickerPreviewCell).getSticker());
                        ((StickerEmojiCell) currentStickerPreviewCell).setScaled(true);
                    } else if (currentStickerPreviewCell instanceof StickerCell) {
                        open(((StickerCell) currentStickerPreviewCell).getSticker());
                        ((StickerCell) currentStickerPreviewCell).setScaled(true);
                    } else if (currentStickerPreviewCell instanceof ContextLinkCell) {
                        open(((ContextLinkCell) currentStickerPreviewCell).getDocument());
                        ((ContextLinkCell) currentStickerPreviewCell).setScaled(true);
                    }
                }
            };
            AndroidUtilities.runOnUIThread(openStickerPreviewRunnable, 200);
            return true;
        }
    }
    return false;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:77,代码来源:StickerPreviewViewer.java

示例4: updateVisibleRows

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
private void updateVisibleRows(int mask) {
    if (listView == null) {
        return;
    }
    int count = listView.getChildCount();
    for (int a = 0; a < count; a++) {
        View child = listView.getChildAt(a);
        if (child instanceof DialogCell) {
            if (listView.getAdapter() != dialogsSearchAdapter) {
                DialogCell cell = (DialogCell) child;
                if ((mask & MessagesController.UPDATE_MASK_NEW_MESSAGE) != 0) {
                    cell.checkCurrentDialogIndex();
                    if (dialogsType == 0 && AndroidUtilities.isTablet()) {
                        cell.setDialogSelected(cell.getDialogId() == openedDialogId);
                    }
                } else if ((mask & MessagesController.UPDATE_MASK_SELECT_DIALOG) != 0) {
                    if (dialogsType == 0 && AndroidUtilities.isTablet()) {
                        cell.setDialogSelected(cell.getDialogId() == openedDialogId);
                    }
                } else {
                    cell.update(mask);
                }
            }
        } else if (child instanceof UserCell) {
            ((UserCell) child).update(mask);
        } else if (child instanceof ProfileSearchCell) {
            ((ProfileSearchCell) child).update(mask);
        } else if (child instanceof RecyclerListView) {
            RecyclerListView innerListView = (RecyclerListView) child;
            int count2 = innerListView.getChildCount();
            for (int b = 0; b < count2; b++) {
                View child2 = innerListView.getChildAt(b);
                if (child2 instanceof HintDialogCell) {
                    ((HintDialogCell) child2).checkUnreadCounter(mask);
                }
            }
        }
    }
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:40,代码来源:DialogsActivity.java

示例5: onCreateViewHolder

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view;
    switch (viewType) {
        case 0:
            view = new GroupCreateSectionCell(context);
            break;
        default:
            view = new GroupCreateUserCell(context, true);
            break;
    }
    return new RecyclerListView.Holder(view);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:14,代码来源:GroupCreateActivity.java

示例6: onCreateViewHolder

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view;
    switch (viewType) {
        case 0:
            view = new GroupCreateSectionCell(context);
            break;
        default:
            view = new GroupCreateUserCell(context, false);
            break;
    }
    return new RecyclerListView.Holder(view);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:14,代码来源:GroupCreateFinalActivity.java

示例7: onCreateViewHolder

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    AudioCell view = new AudioCell(mContext);
    view.setDelegate(new AudioCell.AudioCellDelegate() {
        @Override
        public void startedPlayingAudio(MessageObject messageObject) {
            playingAudio = messageObject;
        }
    });
    return new RecyclerListView.Holder(view);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:12,代码来源:AudioSelectActivity.java

示例8: onCreateViewHolder

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view;
    switch (viewType) {
        case 0:
            view = new ManageChatUserCell(mContext, 2, selectType == 0);
            view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
            ((ManageChatUserCell) view).setDelegate(new ManageChatUserCell.ManageChatUserCellDelegate() {
                @Override
                public boolean onOptionsButtonCheck(ManageChatUserCell cell, boolean click) {
                    TLObject object = getItem((Integer) cell.getTag());
                    if (object instanceof TLRPC.ChannelParticipant) {
                        TLRPC.ChannelParticipant participant = (TLRPC.ChannelParticipant) getItem((Integer) cell.getTag());
                        return createMenuForParticipant(participant, !click);
                    } else {
                        return false;
                    }
                }
            });
            break;
        case 1:
        default:
            view = new GraySectionCell(mContext);
            break;
    }
    return new RecyclerListView.Holder(view);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:28,代码来源:ChannelUsersActivity.java

示例9: onCreateViewHolder

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view;
    switch (viewType) {
        case 1:
            view = new InviteTextCell(context);
            ((InviteTextCell) view).setTextAndIcon(LocaleController.getString("ShareTelegram", R.string.ShareTelegram), R.drawable.share);
            break;
        default:
            view = new InviteUserCell(context, true);
            break;
    }
    return new RecyclerListView.Holder(view);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:15,代码来源:InviteContactsActivity.java

示例10: onCreateViewHolder

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    View view = new ManageChatUserCell(mContext, 8, true);
    view.setBackgroundColor(Theme.getColor(Theme.key_windowBackgroundWhite));
    ((ManageChatUserCell) view).setDelegate(new ManageChatUserCell.ManageChatUserCellDelegate() {
        @Override
        public boolean onOptionsButtonCheck(ManageChatUserCell cell, boolean click) {
            return createMenuForParticipant(null, getItem((Integer) cell.getTag()), !click);
        }
    });
    return new RecyclerListView.Holder(view);
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:13,代码来源:ChannelEditActivity.java

示例11: getItemId

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public long getItemId(int i) {
    return RecyclerListView.NO_ID;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:5,代码来源:ChatActivity.java

示例12: createView

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("Stickers", R.string.Stickers));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    //:ramin
    frameLayout.setBackgroundColor(NightModeUtil.darkIfNightMode(0xfff0f0f0));
    //NightModeUtil.dark(frameLayout);

    listView = new RecyclerListView(context);
    listView.setFocusable(true);
    listView.setTag(7);
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    listView.setLayoutManager(layoutManager);
    //:ramin
    if(optionsVisible()){
        ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback());
        itemTouchHelper.attachToRecyclerView(listView);
    }



    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
                sendReorder();
                final TLRPC.TL_messages_stickerSet stickerSet = StickersQuery.getStickerSets().get(position);
                ArrayList<TLRPC.Document> stickers = stickerSet.documents;
                if (stickers == null || stickers.isEmpty()) {
                    return;
                }
                showDialog(new StickersAlert(getParentActivity(), null, stickerSet, null));
            }
        }
    });
    FontManager.instance().setTypefaceImmediate(fragmentView);
    return fragmentView;
}
 
开发者ID:MLNO,项目名称:airgram,代码行数:56,代码来源:StickersActivity.java

示例13: createView

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    if (currentType == StickersQuery.TYPE_IMAGE) {
        actionBar.setTitle(LocaleController.getString("Stickers", R.string.Stickers));
    } else {
        actionBar.setTitle(LocaleController.getString("Masks", R.string.Masks));
    }
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(0xfff0f0f0);

    listView = new RecyclerListView(context);
    listView.setFocusable(true);
    listView.setTag(7);
    LinearLayoutManager layoutManager = new LinearLayoutManager(context);
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    listView.setLayoutManager(layoutManager);
    ItemTouchHelper itemTouchHelper = new ItemTouchHelper(new TouchHelperCallback());
    itemTouchHelper.attachToRecyclerView(listView);

    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
                sendReorder();
                final TLRPC.TL_messages_stickerSet stickerSet = StickersQuery.getStickerSets(currentType).get(position - stickersStartRow);
                ArrayList<TLRPC.Document> stickers = stickerSet.documents;
                if (stickers == null || stickers.isEmpty()) {
                    return;
                }
                showDialog2(new StickersAlert(getParentActivity(), StickersActivity.this, null, stickerSet, null));
            } else if (position == featuredRow) {
                presentFragment(new FeaturedStickersActivity());
            } else if (position == archivedRow) {
                presentFragment(new ArchivedStickersActivity(currentType));
            } else if (position == masksRow) {
                presentFragment(new StickersActivity(StickersQuery.TYPE_MASK));
            }
        }
    });

    return fragmentView;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:59,代码来源:StickersActivity.java

示例14: createView

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public View createView(Context context) {
    actionBar.setBackButtonImage(R.drawable.ic_ab_back);
    actionBar.setAllowOverlayTitle(true);
    actionBar.setTitle(LocaleController.getString("FeaturedStickers", R.string.FeaturedStickers));
    actionBar.setActionBarMenuOnItemClick(new ActionBar.ActionBarMenuOnItemClick() {
        @Override
        public void onItemClick(int id) {
            if (id == -1) {
                finishFragment();
            }
        }
    });

    listAdapter = new ListAdapter(context);

    fragmentView = new FrameLayout(context);
    FrameLayout frameLayout = (FrameLayout) fragmentView;
    frameLayout.setBackgroundColor(0xfff0f0f0);

    RecyclerListView listView = new RecyclerListView(context);
    listView.setItemAnimator(null);
    listView.setLayoutAnimation(null);
    listView.setFocusable(true);
    listView.setTag(14);
    layoutManager = new LinearLayoutManager(context) {
        @Override
        public boolean supportsPredictiveItemAnimations() {
            return false;
        }
    };
    layoutManager.setOrientation(LinearLayoutManager.VERTICAL);
    listView.setLayoutManager(layoutManager);

    frameLayout.addView(listView, LayoutHelper.createFrame(LayoutHelper.MATCH_PARENT, LayoutHelper.MATCH_PARENT));
    listView.setAdapter(listAdapter);
    listView.setOnItemClickListener(new RecyclerListView.OnItemClickListener() {
        @Override
        public void onItemClick(final View view, int position) {
            if (position >= stickersStartRow && position < stickersEndRow && getParentActivity() != null) {
                final TLRPC.StickerSetCovered stickerSet = StickersQuery.getFeaturedStickerSets().get(position);
                TLRPC.InputStickerSet inputStickerSet;
                if (stickerSet.set.id != 0) {
                    inputStickerSet = new TLRPC.TL_inputStickerSetID();
                    inputStickerSet.id = stickerSet.set.id;
                } else {
                    inputStickerSet = new TLRPC.TL_inputStickerSetShortName();
                    inputStickerSet.short_name = stickerSet.set.short_name;
                }
                inputStickerSet.access_hash = stickerSet.set.access_hash;
                StickersAlert stickersAlert = new StickersAlert(getParentActivity(), FeaturedStickersActivity.this, inputStickerSet, null, null);
                stickersAlert.setInstallDelegate(new StickersAlert.StickersAlertInstallDelegate() {
                    @Override
                    public void onStickerSetInstalled() {
                        FeaturedStickerSetCell cell = (FeaturedStickerSetCell) view;
                        cell.setDrawProgress(true);
                        installingStickerSets.put(stickerSet.set.id, stickerSet);
                    }

                    @Override
                    public void onStickerSetUninstalled() {

                    }
                });
                showDialog2(stickersAlert);
            }
        }
    });
    return fragmentView;
}
 
开发者ID:pooyafaroka,项目名称:PlusGram,代码行数:71,代码来源:FeaturedStickersActivity.java

示例15: onCreateViewHolder

import org.telegram.ui.Components.RecyclerListView; //导入依赖的package包/类
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
    return new RecyclerListView.Holder(new LanguageCell(mContext, false));
}
 
开发者ID:DrKLO,项目名称:Telegram,代码行数:5,代码来源:LanguageSelectActivity.java


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