com.youth.banner.listener.OnBannerClickListener Java Examples

The following examples show how to use com.youth.banner.listener.OnBannerClickListener. 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: NewsListRecyclerViewAdapter.java    From LiuAGeAndroid with MIT License 5 votes vote down vote up
/**
 * 配置recyclerView头部轮播
 */
private void setupRecyclerViewHeader(Banner banner) {

    List<String> images = new ArrayList<>();
    List<String> titles = new ArrayList<>();

    for (ArticleListBean bean :
            mIsGoodArticleBeans) {
        images.add(bean.getTitlepic());
        titles.add(bean.getTitle());
    }

    banner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (SizeUtils.getScreenHeightPx(mContext) * 0.3)));

    // 配置banner
    banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
            .setImageLoader(new FrescoImageLoader())
            .setImages(images)
            .setBannerTitles(titles)
            .isAutoPlay(true)
            .setDelayTime(5000)
            .setBannerAnimation(Transformer.Default)
            .setIndicatorGravity(BannerConfig.RIGHT)
            .start();

    // 监听banner点击事件
    banner.setOnBannerClickListener(new OnBannerClickListener() {
        // position 从1开始
        @Override
        public void OnBannerClick(int position) {
            if (mOnItemTapListener != null) {
                mOnItemTapListener.onItemTapListener(mIsGoodArticleBeans.get(position - 1));
            }
        }
    });

}
 
Example #2
Source File: NewsListRecyclerViewAdapter.java    From BaoKanAndroid with MIT License 5 votes vote down vote up
/**
 * 配置recyclerView头部轮播
 */
private void setupRecyclerViewHeader(Banner banner) {

    List<String> images = new ArrayList<>();
    List<String> titles = new ArrayList<>();

    for (ArticleListBean bean :
            isGoodArticleBeans) {
        images.add(bean.getTitlepic());
        titles.add(bean.getTitle());
    }

    banner.setLayoutParams(new FrameLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) (SizeUtils.getScreenHeightPx(context) * 0.3)));

    // 配置banner
    banner.setBannerStyle(BannerConfig.CIRCLE_INDICATOR_TITLE_INSIDE)
            .setImageLoader(new FrescoImageLoader())
            .setImages(images)
            .setBannerTitles(titles)
            .isAutoPlay(true)
            .setDelayTime(5000)
            .setBannerAnimation(Transformer.Default)
            .setIndicatorGravity(BannerConfig.RIGHT)
            .start();

    // 监听banner点击事件
    banner.setOnBannerClickListener(new OnBannerClickListener() {
        // position 从1开始
        @Override
        public void OnBannerClick(int position) {
            if (onItemTapListener != null) {
                onItemTapListener.onItemTapListener(isGoodArticleBeans.get(position - 1));
            }
        }
    });

}
 
Example #3
Source File: Banner.java    From HomeApplianceMall with MIT License 4 votes vote down vote up
@Deprecated
public Banner setOnBannerClickListener(OnBannerClickListener listener) {
    this.bannerListener = listener;
    return this;
}
 
Example #4
Source File: Banner.java    From WanAndroid with GNU General Public License v3.0 4 votes vote down vote up
@Deprecated
public Banner setOnBannerClickListener(OnBannerClickListener listener) {
    this.bannerListener = listener;
    return this;
}