本文整理汇总了Java中com.github.jdsjlzx.recyclerview.LRecyclerViewAdapter类的典型用法代码示例。如果您正苦于以下问题:Java LRecyclerViewAdapter类的具体用法?Java LRecyclerViewAdapter怎么用?Java LRecyclerViewAdapter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LRecyclerViewAdapter类属于com.github.jdsjlzx.recyclerview包,在下文中一共展示了LRecyclerViewAdapter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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);
}
}
}
示例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);
}
}
}
示例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();
}
}
示例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();
}
}
示例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);
}
});
}
示例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);
}
});
}
示例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);
}
示例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;
}
示例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;
}
示例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);
}
}
}
示例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);
}
}
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}