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


Java MultiTypeAdapter类代码示例

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


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

示例1: initRecyclerView

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
private void initRecyclerView(final View view) {
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
    mAdapter = new MultiTypeAdapter();
    mAdapter.register(HomeTopPager.class, new HomeTopPagerBinder());
    mAdapter.register(LongButton.class, new LongButtonBinder(getActivity()));
    mAdapter.register(Line.class, new GreyLineBinder());
    mAdapter.register(GreyArea.class, new GreyAreaBinder());
    mAdapter.register(Banner.class, new BannerBinder(getActivity()));
    mAdapter.register(TextHeader.class, new TextHeaderBinder(TextHeaderBinder.FLAG_HOME));
    mAdapter.register(HomeItem.class, new HomeItemBinder(getActivity()));
    mAdapter.register(HomeItemCollection.class, new HomeItemCollectionBinder(getActivity()));

    mItems = new Items();
    mAdapter.setItems(mItems);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.setAdapter(mAdapter);
}
 
开发者ID:KnowledgeBegger,项目名称:MyEyepetizer,代码行数:18,代码来源:HomeFragment.java

示例2: initRecyclerView

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
private void initRecyclerView(View view) {
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
    mAdapter = new MultiTypeAdapter();
    mAdapter.register(HomeItem.class, new HomeItemBinder(getActivity()));
    mAdapter.register(FoundCategoryDetailCollection.class, new FoundCategoryDetailCollectionBinder(getChildFragmentManager(), getActivity()));
    mAdapter.register(Line.class, new GreyLineBinder());
    mAdapter.register(GreyArea.class, new GreyAreaBinder());
    mAdapter.register(TextHeader.class, new TextHeaderBinder(TextHeaderBinder.FLAG_FOUND));
    mAdapter.register(EndArea.class, new EndAreaBinder(EndAreaBinder.FLAG_TEXT_COLOR_BLACK));
    mAdapter.register(AuthorCollectionItem.class, new AuthorCollectionItemBinder(getActivity()));

    mItems = new Items();
    mAdapter.setItems(mItems);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.setAdapter(mAdapter);
}
 
开发者ID:KnowledgeBegger,项目名称:MyEyepetizer,代码行数:17,代码来源:CategoryViewPagerFragment.java

示例3: initRecyclerView

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
private void initRecyclerView() {
    mAdapter = new MultiTypeAdapter();
    mAdapter.register(Banner.class, new FoundBannerBinder());
    mAdapter.register(TextHeader.class, new TextHeaderBinder(TextHeaderBinder.FLAG_FOUND));
    mAdapter.register(HomeItem.class, new HomeItemBinder(getActivity()));
    mAdapter.register(GreyArea.class, new GreyAreaBinder());
    mAdapter.register(CollectionItem.class, new SquareCardCollectionBinder(getActivity()));
    mAdapter.register(Line.class, new GreyLineBinder());
    mAdapter.register(FoundCategorySubjectItem.class, new FoundCategorySubjectItemBinder(getChildFragmentManager(), getActivity()));
    mAdapter.register(FoundCategoryItem.class, new FoundCategoryItemBinder(getActivity()));
    mAdapter.register(EndArea.class, new EndAreaBinder(EndAreaBinder.FLAG_TEXT_COLOR_BLACK));
    mAdapter.register(LeftAlignTextHeader.class, new LeftAlignTextHeaderBinder());
    mAdapter.register(AuthorCard.class, new AuthorCardBinder(getActivity()));
    mAdapter.register(AuthorCollectionItem.class, new AuthorCollectionItemBinder(getActivity()));

    mItems = new Items();
    mAdapter.setItems(mItems);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.setAdapter(mAdapter);
}
 
开发者ID:KnowledgeBegger,项目名称:MyEyepetizer,代码行数:21,代码来源:FoundViewPagerFragment.java

示例4: initRecyclerView

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
private void initRecyclerView(View view) {
    mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
    mAdapter = new MultiTypeAdapter();
    mAdapter.register(Line.class, new GreyLineBinder());
    mAdapter.register(GreyArea.class, new GreyAreaBinder());
    mAdapter.register(TextHeader.class, new TextHeaderBinder(TextHeaderBinder.FLAG_FOUND));
    mAdapter.register(EndArea.class, new EndAreaBinder(EndAreaBinder.FLAG_TEXT_COLOR_BLACK));
    mAdapter.register(FoundCategoryDetailCollection.class, new FoundCategoryDetailCollectionBinder(getChildFragmentManager(), getActivity()));
    mAdapter.register(AuthorCollectionItem.class, new AuthorCollectionItemBinder(getActivity()));
    mAdapter.register(MovieDetailRelateItem.class, new MovieDetailRelateItemBinder(getActivity(), MovieDetailRelateItemBinder.FLAG_BLACK_WORD_COLOR));

    mItems = new Items();
    mAdapter.setItems(mItems);
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getActivity()));
    mRecyclerView.setAdapter(mAdapter);
}
 
开发者ID:KnowledgeBegger,项目名称:MyEyepetizer,代码行数:17,代码来源:AuthorViewPagerFragment.java

示例5: initViews

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
@Override
protected void initViews() {
    setTitle(R.string.bar_title_image);
    final GridLayoutManager layoutManager =
            new GridLayoutManager(this, SPAN_COUNT);
    mAdapter = new MultiTypeAdapter();
    mAdapter.register(Content.class, new ImageItemBinder());
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.addItemDecoration(new ImageSpacItemDecoration
            (12, SPAN_COUNT, true));
    mRecyclerView.setItemAnimator(new DefaultItemAnimator());
    mRecyclerView.addOnScrollListener(getOnBottomListener(layoutManager));
    mRecyclerView.setAdapter(mAdapter);
    showLoading();
    mPresenter.fromRealmLoad();
    refresh();
}
 
开发者ID:Shuanghua,项目名称:LikeGank,代码行数:18,代码来源:ImageActivity.java

示例6: onCreate

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
@Override
protected void onCreate(@Nullable Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.related_activity);

    Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar);
    setSupportActionBar(toolbar);
    toolbar.setNavigationOnClickListener(view -> finishAfterTransition());

    RecyclerView list = (RecyclerView) findViewById(R.id.related_list);

    adapter = new MultiTypeAdapter(items);
    list.setAdapter(adapter);

    Register.registerRelatedItem(adapter, this);

    id = getIntent().getIntExtra(ID, id);
    relatedApi = RetrofitFactory.getRetrofit().createApi(RelatedApi.class);

    loadRelated();
}
 
开发者ID:Assassinss,项目名称:Interessant,代码行数:22,代码来源:RelatedActivity.java

示例7: initViews

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
@Override
protected void initViews(View view) {
    Toolbar toolbar = view.findViewById(R.id.toolbar_title);
    mRecyclerView = view.findViewById(R.id.recycler_view);
    mRefreshLayout = view.findViewById(R.id.refresh_layout);
    initToolBar(toolbar, true, mTitle);
    toolbar.setOnClickListener(new View.OnClickListener() {
        @Override
        public void onClick(View v) {
            mRecyclerView.smoothScrollToPosition(0);
        }
    });
    mRecyclerView.setLayoutManager(new LinearLayoutManager(getContext()));
    mRecyclerView.setHasFixedSize(true);
    // 设置下拉刷新的按钮的颜色
    mRefreshLayout.setColorSchemeColors(mSettingHelper.getColor());
    mRefreshLayout.setOnRefreshListener(this);

    mAdapter = new MultiTypeAdapter();
    mAdapter.register(PostsListBean.class, new PostsListViewBinder());
    mAdapter.register(FooterBean.class, new FooterViewBinder());
    mAdapter.setItems(mOldItems);
    mRecyclerView.setAdapter(mAdapter);
}
 
开发者ID:iMeiji,项目名称:Daily,代码行数:25,代码来源:PostsListView.java

示例8: init

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
private void init() {
    mRecyclerView = (RecyclerView) findViewById(R.id.me_recycle_view);
    final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
    mRecyclerView.addItemDecoration(new DividerItemDecoration(this, DividerItemDecoration.VERTICAL));
    mRecyclerView.setLayoutManager(layoutManager);
    mAdapter = new MultiTypeAdapter();
    mAdapter.register(SettingImgTvItem.class, new SettingImgTvItemViewBinder());
    mAdapter.register(AvatarItem.class,new AvatarItemViewBinder());
    mAdapter.register(TextViewItem.class, new TextItemViewBinder());

    list.add(new AvatarItem());
    for (int i = 0; i < 10; i++) {
        SettingImgTvItem item = new SettingImgTvItem();
        item.title = "item:" + (i+1);
        list.add(item);
    }

    TextViewItem item1 = new TextViewItem();
    item1.text = ResourceUtil.getString(R.string.about_copyright);
    list.add(item1);

    mAdapter.setItems(list);
    mAdapter.notifyDataSetChanged();
    mRecyclerView.setAdapter(mAdapter);
}
 
开发者ID:whiskeyfei,项目名称:SimpleNews.io,代码行数:26,代码来源:MeActivity.java

示例9: addData

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
@Override
public void addData(MultiTypeAdapter adapter, List<Card> cards) {
    Items items = items();
    for (int index = 0; index < cards.size(); index++) {
        final Card card = cards.get(index);
        if (card.type.equals(MUSIC)) {
            items.add(new Music(card, index, adapter, cards, showPlus()));
        } else if (card.type.equals(VIDEO)) {
            items.add(new Video(card, index, adapter, cards, showPlus()));
        } else if (card.type.equals(WEB)) {
            items.add(new Web(card, index, adapter, cards, showPlus()));
        } else if (card.type.equals(COVER_WEB)) {
            items.add(new Web(card, index, adapter, cards, showPlus()));
        } else if (card.type.equals(PICTURE)) {
            items.add(new Picture(card, index, adapter, cards, showPlus()));
        }
    }
    if (cards.size() > 0) {
        items.add(new Footer());
    } else {
        items.add(new EmptyChannel());
    }
    adapter.notifyDataSetChanged();
}
 
开发者ID:oxoooo,项目名称:excited-android,代码行数:25,代码来源:DataObserver.java

示例10: follow

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
private void follow(HeaderHolder holder, MultiTypeAdapter adapter,
                    Channel channel, boolean followed) {
    Context context = holder.itemView.getContext();

    QueryAPI queryAPI = ExcitedRetrofitFactory.getRetrofit(context).createApi(QueryAPI.class);
    queryAPI.mutation(QueryField.setFollowState(channel.id, !followed))
            .compose(RxMainThread.mainThread())
            .map(newData -> newData.followState)
            .subscribe(followState -> {
                boolean currentFollowed = followState.channel.followed;
                holder.follow.setText(currentFollowed ? context.getString(R.string.unfollow)
                        : context.getString(R.string.follow)
                );
                ToastUtils.shorts(context, currentFollowed ?
                        R.string.follow_success : R.string.unfollow_success);
                channel.followed = currentFollowed;
                adapter.notifyItemChanged(0);
            }, throwable -> {});

}
 
开发者ID:oxoooo,项目名称:excited-android,代码行数:21,代码来源:HeaderViewProvider.java

示例11: initView

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
@Override
protected void initView(View view) {
    super.initView(view);
    adapter = new MultiTypeAdapter(oldItems);
    Register.registerWendaArticleItem(adapter);
    recyclerView.setAdapter(adapter);
    recyclerView.addOnScrollListener(new OnLoadMoreListener() {
        @Override
        public void onLoadMore() {
            if (canLoadMore) {
                canLoadMore = false;
                presenter.doLoadMoreData();
            }
        }
    });
}
 
开发者ID:iMeiji,项目名称:Toutiao,代码行数:17,代码来源:WendaArticleView.java

示例12: initView

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
@Override
protected void initView(View view) {
    super.initView(view);
    adapter = new MultiTypeAdapter(oldItems);
    Register.registerSearchItem(adapter);
    recyclerView.setAdapter(adapter);
    recyclerView.addOnScrollListener(new OnLoadMoreListener() {
        @Override
        public void onLoadMore() {
            if (canLoadMore) {
                canLoadMore = false;
                presenter.doLoadMoreData();
            }
        }
    });
}
 
开发者ID:iMeiji,项目名称:Toutiao,代码行数:17,代码来源:SearchResultFragment.java

示例13: initView

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
@Override
protected void initView(View view) {
    super.initView(view);
    adapter = new MultiTypeAdapter(oldItems);
    Register.registerJokeContentItem(adapter);
    recyclerView.setAdapter(adapter);
    recyclerView.addOnScrollListener(new OnLoadMoreListener() {
        @Override
        public void onLoadMore() {
            if (canLoadMore) {
                canLoadMore = false;
                presenter.doLoadMoreData();
            }
        }
    });
}
 
开发者ID:iMeiji,项目名称:Toutiao,代码行数:17,代码来源:JokeContentView.java

示例14: initView

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
@Override
protected void initView(View view) {
    super.initView(view);
    adapter = new MultiTypeAdapter(oldItems);
    Register.registerNewsArticleItem(adapter);
    recyclerView.setAdapter(adapter);
    recyclerView.addOnScrollListener(new OnLoadMoreListener() {
        @Override
        public void onLoadMore() {
            if (canLoadMore) {
                canLoadMore = false;
                presenter.doLoadMoreData();
            }
        }
    });
}
 
开发者ID:iMeiji,项目名称:Toutiao,代码行数:17,代码来源:NewsArticleView.java

示例15: initView

import me.drakeet.multitype.MultiTypeAdapter; //导入依赖的package包/类
@Override
protected void initView(View view) {
    super.initView(view);
    adapter = new MultiTypeAdapter(oldItems);
    Register.registerPhotoArticleItem(adapter);
    recyclerView.setAdapter(adapter);
    recyclerView.addOnScrollListener(new OnLoadMoreListener() {
        @Override
        public void onLoadMore() {
            if (canLoadMore) {
                canLoadMore = false;
                presenter.doLoadMoreData();
            }
        }
    });
}
 
开发者ID:iMeiji,项目名称:Toutiao,代码行数:17,代码来源:PhotoArticleView.java


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