• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java LRecyclerViewAdapter类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: drawHorizontal

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
public void drawHorizontal(Canvas c, RecyclerView parent) {
    int childCount = parent.getChildCount();
    LRecyclerView recyclerView = (LRecyclerView) parent;
    LRecyclerViewAdapter adapter = (LRecyclerViewAdapter) parent.getAdapter();
    for (int i = 0; i < childCount; i++) {
        if ((recyclerView.isOnTop() && (adapter.isHeader(i) || adapter.isRefreshHeader(i))) || adapter.isFooter(i)) {
            c.drawRect(0, 0, 0, 0, mPaint);
        } else {
            final View child = parent.getChildAt(i);
            final int top = child.getBottom();
            final int bottom = top + verticalSpace;
            int left = child.getLeft();
            int right = child.getRight();
            c.drawRect(left, top, right, bottom, mPaint);
        }
    }
}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:18,代码来源:GridItemDecoration.java


示例2: drawVertical

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
public void drawVertical(Canvas c, RecyclerView parent) {
    final int childCount = parent.getChildCount();
    LRecyclerView recyclerView = (LRecyclerView) parent;
    LRecyclerViewAdapter adapter = (LRecyclerViewAdapter) parent.getAdapter();
    for (int i = 0; i < childCount; i++) {
        if ((recyclerView.isOnTop() && (adapter.isHeader(i) || adapter.isRefreshHeader(i))) || adapter.isFooter(i)) {
            c.drawRect(0, 0, 0, 0, mPaint);
        } else {
            final View child = parent.getChildAt(i);
            final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
            final int top = child.getTop();
            final int bottom = child.getBottom() + verticalSpace;
            final int left = child.getRight() + params.rightMargin;
            final int right = left + horizontalSpace;
            c.drawRect(left, top, right, bottom, mPaint);
        }

    }
}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:20,代码来源:GridItemDecoration.java


示例3: drawHorizontal

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
public void drawHorizontal(Canvas c, RecyclerView parent,LRecyclerViewAdapter adapter) {
    int count = parent.getChildCount();

    for (int i = 0; i < count; i++) {
        final View child = parent.getChildAt(i);
        final int top = child.getBottom();
        final int bottom = top + verticalSpacing;

        int left = child.getLeft() ;
        int right = child.getRight();

        int position = parent.getChildAdapterPosition(child);

        c.save();

        if (adapter.isRefreshHeader(position) || adapter. isHeader(position) || adapter.isFooter(position)) {
            c.drawRect(0, 0, 0, 0, mPaint);
        }else {
            c.drawRect(left, top, right, bottom, mPaint);
        }

        c.restore();
    }
}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:25,代码来源:SpacesItemDecoration.java


示例4: drawVertical

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
public void drawVertical(Canvas c, RecyclerView parent,LRecyclerViewAdapter adapter) {
    int count = parent.getChildCount();

    for (int i = 0; i < count; i++) {
        final View child = parent.getChildAt(i);
        final RecyclerView.LayoutParams params = (RecyclerView.LayoutParams) child.getLayoutParams();
        final int top = child.getTop();
        //final int bottom = child.getBottom() + params.bottomMargin;
        final int bottom = child.getBottom() + verticalSpacing; //这里使用verticalSpacing 代替 params.bottomMargin
        final int left = child.getRight() + params.rightMargin;
        final int right = left + itemSplitMarginEven*2;

        int position = parent.getChildAdapterPosition(child);

        c.save();

        if (adapter.isRefreshHeader(position) || adapter. isHeader(position) || adapter.isFooter(position)) {
            c.drawRect(0, 0, 0, 0, mPaint);
        }else {
            c.drawRect(left, top, right, bottom, mPaint);
        }

        c.restore();
    }
}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:26,代码来源:SpacesItemDecoration.java


示例5: doBusiness

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
@Override
protected void doBusiness() {
    lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new SkillAdapter(context, dataList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    lRecyclerView.addItemDecoration(new DividerItemDecoration(context, OrientationHelper.VERTICAL));
    lRecyclerView.setLoadMoreEnabled(false);

    heroSkillPresenter = new HeroSkillPresenter(this, this);
    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {
        @Override
        public void onRefresh() {
            heroSkillPresenter.showSkill(unCode, true);
        }
    });

}
 
开发者ID:NICOLITE,项目名称:Palm300Heroes,代码行数:18,代码来源:HeroSkillFragment.java


示例6: doBusiness

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
@Override
protected void doBusiness() {
    lRecyclerView.setLayoutManager(new LinearLayoutManager(context, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new SkinAdapter(context, dataList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    lRecyclerView.addItemDecoration(new DividerItemDecoration(context, OrientationHelper.VERTICAL));

    lRecyclerView.setLoadMoreEnabled(false);
    heroSkinPresenter = new HeroSkinPresenter(this, this);

    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {
        @Override
        public void onRefresh() {
            heroSkinPresenter.showSkin(unCode, true);
        }
    });
}
 
开发者ID:NICOLITE,项目名称:Palm300Heroes,代码行数:18,代码来源:HeroSkinFragment.java


示例7: doBusiness

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
@Override
protected void doBusiness() {
    toolbarTitle.setText("视频专栏");
    lRecyclerView.setLayoutManager(new GridLayoutManager(context, 2, OrientationHelper.VERTICAL, false));
    lRecyclerViewAdapter = new LRecyclerViewAdapter(new VideoAdapter(context, videoList));
    lRecyclerView.setAdapter(lRecyclerViewAdapter);
    lRecyclerView.setLoadMoreEnabled(false);

    lRecyclerViewAdapter.setOnItemClickListener(new OnItemClickListener() {
        @Override
        public void onItemClick(View view, int position) {
            Bundle bundle = new Bundle();
            bundle.putString("url", video.get_$480P());
            bundle.putSerializable("link", video.getLinks().get(position));
            Bundle options = ActivityOptionsCompat.makeSceneTransitionAnimation(activity, view, "videoTransition").toBundle();
            startActivity(VideoItemActivity.class, bundle, options);
        }
    });

    lRecyclerView.setOnRefreshListener(new OnRefreshListener() {
        @Override
        public void onRefresh() {
            videoPresenter.showVideoList(true);
        }
    });

    videoPresenter = new VideoPresenter(this, this);
    videoPresenter.showVideoList(false);
}
 
开发者ID:NICOLITE,项目名称:HutHelper,代码行数:30,代码来源:VideoActivity.java


示例8: isLastRaw

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
/**
 * @param parent     RecyclerView
 * @param pos        当前item的位置
 * @param spanCount  每行显示的item个数
 * @param childCount child个数
 */
private boolean isLastRaw(RecyclerView parent, int pos, int spanCount, int childCount) {
    LayoutManager layoutManager = parent.getLayoutManager();
    LRecyclerViewAdapter adapter = (LRecyclerViewAdapter) parent.getAdapter();
    if (layoutManager instanceof GridLayoutManager) {
        int leftCount = childCount - childCount % spanCount;//3
        //leftCount:若childCount能被span整除为childCount否则为去掉最后一行的item总数
        if ((pos - adapter.getHeaderViews().size() + 1) > leftCount) {
            return true;
        }
    }
    return false;
}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:19,代码来源:GridItemDecoration.java


示例9: isLastColumn

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
private boolean isLastColumn(RecyclerView parent, int pos, int spanCount) {
    LayoutManager layoutManager = parent.getLayoutManager();
    LRecyclerViewAdapter adapter = (LRecyclerViewAdapter) parent.getAdapter();
    if (layoutManager instanceof GridLayoutManager) {
        if ((pos - adapter.getHeaderViews().size()) % spanCount == 0)
            // 如果是最后一列,则不需要绘制右边
            return true;
    }
    return false;
}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:11,代码来源:GridItemDecoration.java


示例10: getItemTopSpacing

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
private static int getItemTopSpacing(SpanLookup spanLookup, int verticalSpacing, int itemPosition, int spanCount, int childCount, LRecyclerViewAdapter adapter) {
    if(adapter.isHeader(itemPosition) || adapter.isRefreshHeader(itemPosition) || adapter.isFooter(itemPosition)) {
        return 0;
    } else {
        if (itemIsOnTheTopRow(spanLookup, itemPosition, spanCount, childCount)) {
            return 0;
        } else {
            return (int) (.5f * verticalSpacing);
        }
    }

}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:13,代码来源:SpacesItemDecoration.java


示例11: getItemBottomSpacing

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
private static int getItemBottomSpacing(SpanLookup spanLookup, int verticalSpacing, int itemPosition, int childCount, LRecyclerViewAdapter adapter) {

        if(adapter.isHeader(itemPosition) || adapter.isRefreshHeader(itemPosition) || adapter.isFooter(itemPosition)) {
            return 0;
        } else {
            if (itemIsOnTheBottomRow(spanLookup, itemPosition, childCount)) {
                return 0;
            } else {
                return (int) (.5f * verticalSpacing);
            }
        }

    }
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:14,代码来源:SpacesItemDecoration.java


示例12: getLayoutPosition

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
/**
 * 请使用本方法替代RecyclerView.ViewHolder的getLayoutPosition()方法
 *
 * @param recyclerView
 * @param holder
 * @return
 */
public static int getLayoutPosition(RecyclerView recyclerView, RecyclerView.ViewHolder holder) {
    RecyclerView.Adapter outerAdapter = recyclerView.getAdapter();
    if (outerAdapter != null && outerAdapter instanceof LRecyclerViewAdapter) {

        int headerViewCounter = ((LRecyclerViewAdapter) outerAdapter).getHeaderViewsCount();
        if (headerViewCounter > 0) {
            return holder.getLayoutPosition() - (headerViewCounter + 1);
        }
    }

    return holder.getLayoutPosition();
}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:20,代码来源:RecyclerViewUtils.java


示例13: setAdapterAndDecor

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
@Override
protected void setAdapterAndDecor(RecyclerView list) {
    final InlineStickyTestAdapter adapter = new InlineStickyTestAdapter(this.getActivity());
    decor = new StickyHeaderDecoration(adapter, true);
    setHasOptionsMenu(true);

    mLRecyclerViewAdapter = new LRecyclerViewAdapter(adapter);
    list.setAdapter(mLRecyclerViewAdapter);
    list.addItemDecoration(decor, 1);
}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:11,代码来源:InlineStickyHeaderFragment.java


示例14: setAdapterAndDecor

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
@Override
protected void setAdapterAndDecor(RecyclerView list) {
    final StickyTestAdapter adapter = new StickyTestAdapter(this.getActivity());
    decor = new StickyHeaderDecoration(adapter);
    setHasOptionsMenu(true);

    mLRecyclerViewAdapter = new LRecyclerViewAdapter(adapter);
    list.setAdapter(mLRecyclerViewAdapter);

    list.addItemDecoration(decor, 1);
    list.addOnItemTouchListener(this);

}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:14,代码来源:StickyHeaderFragment.java


示例15: setAdapterAndDecor

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
@Override
protected void setAdapterAndDecor(RecyclerView list) {
    final DoubleHeaderTestAdapter adapter = new DoubleHeaderTestAdapter(this.getActivity());
    decor = new DoubleHeaderDecoration(adapter);
    setHasOptionsMenu(true);

    mLRecyclerViewAdapter = new LRecyclerViewAdapter(adapter);
    list.setAdapter(mLRecyclerViewAdapter);
    list.addItemDecoration(decor, 1);
    list.addOnItemTouchListener(this);
}
 
开发者ID:jdsjlzx,项目名称:LRecyclerView,代码行数:12,代码来源:DoubleHeaderFragment.java


示例16: initView

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
private void initView() {


        //setLayoutManager
        GridLayoutManager manager = new GridLayoutManager(getContext(), 2);
        manager.setSpanSizeLookup(new HeaderSpanSizeLookup((LRecyclerViewAdapter) mRecyclerView.getAdapter(), manager.getSpanCount()));
        mRecyclerView.setLayoutManager(manager);
//        mRecyclerView.setRefreshing(true);
        mRecyclerView.setRefreshProgressStyle(ProgressStyle.BallSpinFadeLoader);
        mRecyclerView.setArrowImageView(R.drawable.ic_pulltorefresh_arrow);
    }
 
开发者ID:v991314,项目名称:3DGameInfo,代码行数:12,代码来源:gameFragment.java


示例17: setAdapter

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
private void setAdapter() {
    ArrayAdapter adapter = new ArrayAdapter(getActivity(),android.R.layout.simple_list_item_activated_1, Constant.GAME_TYPES);
    mSpinner.setAdapter(adapter);
    mRecyclerView.setLayoutManager(new GridLayoutManager(getActivity(), 2));
    mGameAdapter = new Game_adapter(getContext(), mList);
    mRecyclerViewAdapter = new LRecyclerViewAdapter(mGameAdapter);
    mRecyclerView.setAdapter(mRecyclerViewAdapter);


}
 
开发者ID:v991314,项目名称:3DGameInfo,代码行数:11,代码来源:gameFragment.java


示例18: getFooterViewState

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
/**
 * 获取当前RecyclerView.FooterView的状态
 *
 * @param recyclerView
 */
public static LoadingFooter.State getFooterViewState(RecyclerView recyclerView) {

    RecyclerView.Adapter outerAdapter = recyclerView.getAdapter();
    if (outerAdapter != null && outerAdapter instanceof LRecyclerViewAdapter) {
        if (((LRecyclerViewAdapter) outerAdapter).getFooterViewsCount() > 0) {
            LoadingFooter footerView = (LoadingFooter) ((LRecyclerViewAdapter) outerAdapter).getFooterView();
            return footerView.getState();
        }
    }

    return LoadingFooter.State.Normal;
}
 
开发者ID:EthanCo,项目名称:NovaRecyclerView,代码行数:18,代码来源:RecyclerViewStateUtils.java


示例19: setFooterViewState

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
/**
 * 设置当前RecyclerView.FooterView的状态
 *
 * @param recyclerView
 * @param state
 */
public static void setFooterViewState(RecyclerView recyclerView, LoadingFooter.State state) {
    RecyclerView.Adapter outerAdapter = recyclerView.getAdapter();
    if (outerAdapter != null && outerAdapter instanceof LRecyclerViewAdapter) {
        if (((LRecyclerViewAdapter) outerAdapter).getFooterViewsCount() > 0) {
            LoadingFooter footerView = (LoadingFooter) ((LRecyclerViewAdapter) outerAdapter).getFooterView();
            footerView.setState(state);
        }
    }
}
 
开发者ID:EthanCo,项目名称:NovaRecyclerView,代码行数:16,代码来源:RecyclerViewStateUtils.java


示例20: setHeaderView

import com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter; //导入依赖的package包/类
/**
 * 设置HeaderView
 *
 * @param recyclerView
 * @param view
 */
public static void setHeaderView(RecyclerView recyclerView, View view) {
    RecyclerView.Adapter outerAdapter = recyclerView.getAdapter();

    if (outerAdapter == null || !(outerAdapter instanceof LRecyclerViewAdapter)) {
        return;
    }

    LRecyclerViewAdapter headerAndFooterAdapter = (LRecyclerViewAdapter) outerAdapter;
    /*if (headerAndFooterAdapter.getHeaderViewsCount() == 0) {
        headerAndFooterAdapter.addHeaderView(view);
    }*/
    headerAndFooterAdapter.addHeaderView(view);
}
 
开发者ID:EthanCo,项目名称:NovaRecyclerView,代码行数:20,代码来源:RecyclerViewUtils.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java BrighthouseRecord类代码示例发布时间:2022-05-22
下一篇:
Java EnvironmentAccessor类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap