本文整理汇总了Java中com.alibaba.android.vlayout.LayoutHelper类的典型用法代码示例。如果您正苦于以下问题:Java LayoutHelper类的具体用法?Java LayoutHelper怎么用?Java LayoutHelper使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
LayoutHelper类属于com.alibaba.android.vlayout包,在下文中一共展示了LayoutHelper类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: transformCards
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@NonNull
@Override
protected List<LayoutHelper> transformCards(@Nullable List<Card> cards, @NonNull List<BaseCell> data, @NonNull List<Pair<Range<Integer>, Card>> rangeCards) {
if (cards == null) {
return super.transformCards(cards, data, rangeCards);
}
/* record card id, used in {@link #getItems} to clean "forLabel" cards */
for (Card card : cards) {
if (!TextUtils.isEmpty(card.id)) {
mIdCardCache.put(card.id, card);
}
}
List<LayoutHelper> layoutHelpers = super.transformCards(cards, data, rangeCards);
// clean cache after used
mIdCardCache.clear();
return layoutHelpers;
}
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:22,代码来源:PojoGroupBasicAdapter.java
示例2: setData
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
/**
* @param cards new cards data
* @param silence true, call {@link RecyclerView.Adapter#notifyDataSetChanged()}; false do not call{@link RecyclerView.Adapter#notifyDataSetChanged()}
*/
public void setData(@Nullable List<L> cards, boolean silence) {
createSnapshot();
mCards.clear();
mData.clear();
if (cards != null && cards.size() != 0) {
mCards.ensureCapacity(cards.size());
setLayoutHelpers(transformCards(cards, mData, mCards));
} else {
setLayoutHelpers(Collections.<LayoutHelper>emptyList());
}
diffWithSnapshot();
if (!silence)
notifyDataSetChanged();
}
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:24,代码来源:GroupBasicAdapter.java
示例3: computeStartSpace
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
protected int computeStartSpace(LayoutManagerHelper helper, boolean layoutInVertical, boolean isLayoutEnd, boolean isOverLapMargin) {
int startSpace = 0;
LayoutHelper lastLayoutHelper = null;
if (helper instanceof VirtualLayoutManager) {
lastLayoutHelper = ((VirtualLayoutManager) helper).findNeighbourNonfixLayoutHelper(this, isLayoutEnd);
}
MarginLayoutHelper lastMarginLayoutHelper = null;
if (lastLayoutHelper != null && lastLayoutHelper instanceof MarginLayoutHelper) {
lastMarginLayoutHelper = (MarginLayoutHelper) lastLayoutHelper;
}
if (lastLayoutHelper == this)
return 0;
if (!isOverLapMargin) {
startSpace = layoutInVertical
? (isLayoutEnd ? mMarginTop + mPaddingTop : mMarginBottom + mPaddingBottom)
: (isLayoutEnd ? mMarginLeft + mPaddingLeft : mMarginRight + mPaddingRight);
} else {
int offset = 0;
if (lastMarginLayoutHelper == null) {
offset = layoutInVertical
? (isLayoutEnd ? mMarginTop + mPaddingTop : mMarginBottom + mPaddingBottom)
: (isLayoutEnd ? mMarginLeft + mPaddingLeft : mMarginRight + mPaddingRight);
} else {
offset = layoutInVertical
? (isLayoutEnd ? calGap(lastMarginLayoutHelper.mMarginBottom, mMarginTop) : calGap(lastMarginLayoutHelper.mMarginTop, mMarginBottom))
: (isLayoutEnd ? calGap(lastMarginLayoutHelper.mMarginRight, mMarginLeft) : calGap(lastMarginLayoutHelper.mMarginLeft, mMarginRight));
}
//Log.e("huang", "computeStartSpace offset: " + offset + ", isLayoutEnd: " + isLayoutEnd + ", " + this);
startSpace += layoutInVertical
? (isLayoutEnd ? mPaddingTop : mPaddingBottom)
: (isLayoutEnd ? mPaddingLeft : mPaddingRight);
startSpace += offset;
}
return startSpace;
}
开发者ID:weiwenqiang,项目名称:GitHub,代码行数:40,代码来源:BaseLayoutHelper.java
示例4: getGridLayoutHelp
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
private LayoutHelper getGridLayoutHelp() {
//设置Grid布局
GridLayoutHelper gridLayoutHelper = new GridLayoutHelper(5);
//是否自动扩展
gridLayoutHelper.setAutoExpand(false);
/* gridLayoutHelper.setPadding(0, 16, 0, 16);
gridLayoutHelper.setVGap(16);// 控制子元素之间的垂直间距
gridLayoutHelper.setHGap(0);// 控制子元素之间的水平间距
gridLayoutHelper.setBgColor(Color.WHITE);*/
return gridLayoutHelper;
}
开发者ID:lvtanxi,项目名称:BaseVLayoutAdapterHelper,代码行数:12,代码来源:TaobaoActivity.java
示例5: onAttachedLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
/**
* 处理GridLayoutHelper中手动换行的。(后期可以加个开关)
* @param layoutHelper VBaseAdapter 的LayoutHelper
*/
private void onAttachedLayoutHelper(LayoutHelper layoutHelper) {
if (layoutHelper instanceof GridLayoutHelper) {
final GridLayoutHelper gridLayoutHelper = (GridLayoutHelper) layoutHelper;
gridLayoutHelper.setAutoExpand(false);
gridLayoutHelper.setSpanSizeLookup(new GridLayoutHelper.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return doSpanSize(position-getStartPosition(),gridLayoutHelper.getSpanCount());
}
});
}
}
开发者ID:lvtanxi,项目名称:BaseVLayoutAdapterHelper,代码行数:17,代码来源:VBaseWrapper.java
示例6: onCreateLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Override
public LayoutHelper onCreateLayoutHelper() {
if (mLayoutHelper == null)
throw new RuntimeException("LayoutHelper is null,please check your params !");
//判断是否需要监听GridLayoutHelper换行的事情
onAttachedLayoutHelper(mLayoutHelper);
return mLayoutHelper;
}
开发者ID:lvtanxi,项目名称:BaseVLayoutAdapterHelper,代码行数:9,代码来源:VBaseAdapter.java
示例7: onAttachedLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
/**
* 判断是否需要监听GridLayoutHelper换行的事情(好像应该放在BaseAdapter中)
*/
private void onAttachedLayoutHelper(LayoutHelper layoutHelper) {
if (layoutHelper instanceof GridLayoutHelper) {
final GridLayoutHelper gridLayoutHelper = (GridLayoutHelper) layoutHelper;
gridLayoutHelper.setAutoExpand(false);
gridLayoutHelper.setSpanSizeLookup(new GridLayoutHelper.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
if (isLineFeed(position - getStartPosition() - mHeaderCount))
return gridLayoutHelper.getSpanCount();
return 1;
}
});
}
}
开发者ID:lvtanxi,项目名称:BaseVLayoutAdapterHelper,代码行数:18,代码来源:VBaseAdapter.java
示例8: VBaseSectionedAdapter
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
public VBaseSectionedAdapter(@LayoutRes int sectionId, @LayoutRes int normalId, LayoutHelper layoutHelper) {
super(new ArrayList<M>(), normalId, layoutHelper);
mSectionId = sectionId;
mHeaderLocationMap = new SparseIntArray();
mSectionMap = new SparseIntArray();
mPositionMap = new SparseIntArray();
}
开发者ID:lvtanxi,项目名称:BaseVLayoutAdapterHelper,代码行数:8,代码来源:VBaseSectionedAdapter.java
示例9: FooterAdapter
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
public FooterAdapter(RecyclerView recyclerView, Context context, LayoutHelper layoutHelper, int count, @NonNull LayoutParams layoutParams) {
this.mRecyclerView = recyclerView;
this.mContext = context;
this.mLayoutHelper = layoutHelper;
this.mCount = count;
this.mLayoutParams = layoutParams;
}
开发者ID:alibaba,项目名称:vlayout,代码行数:8,代码来源:VLayoutActivity.java
示例10: computeStartSpace
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
protected int computeStartSpace(LayoutManagerHelper helper, boolean layoutInVertical, boolean isLayoutEnd, boolean isOverLapMargin) {
int startSpace = 0;
LayoutHelper lastLayoutHelper = null;
if (helper instanceof VirtualLayoutManager) {
lastLayoutHelper = ((VirtualLayoutManager) helper).findNeighbourNonfixLayoutHelper(this, isLayoutEnd);
}
MarginLayoutHelper lastMarginLayoutHelper = null;
if (lastLayoutHelper != null && lastLayoutHelper instanceof MarginLayoutHelper) {
lastMarginLayoutHelper = (MarginLayoutHelper) lastLayoutHelper;
}
if (lastLayoutHelper == this)
return 0;
if (!isOverLapMargin) {
startSpace = layoutInVertical ? mMarginTop + mPaddingTop : mMarginLeft + mPaddingLeft;
} else {
int offset = 0;
if (lastMarginLayoutHelper == null) {
offset = layoutInVertical ? mMarginTop + mPaddingTop : mMarginLeft + mPaddingLeft;
} else {
offset = layoutInVertical
? (isLayoutEnd ? calGap(lastMarginLayoutHelper.mMarginBottom, mMarginTop) : calGap(lastMarginLayoutHelper.mMarginTop, mMarginBottom))
: (isLayoutEnd ? calGap(lastMarginLayoutHelper.mMarginRight, mMarginLeft) : calGap(lastMarginLayoutHelper.mMarginLeft, mMarginRight));
}
//Log.e("huang", "computeStartSpace offset: " + offset + ", isLayoutEnd: " + isLayoutEnd + ", " + this);
startSpace += layoutInVertical
? (isLayoutEnd ? mPaddingTop : mPaddingBottom)
: (isLayoutEnd ? mPaddingLeft : mPaddingRight);
startSpace += offset;
}
return startSpace;
}
开发者ID:alibaba,项目名称:vlayout,代码行数:36,代码来源:BaseLayoutHelper.java
示例11: convertLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Nullable
@Override
public LayoutHelper convertLayoutHelper(@Nullable LayoutHelper oldHelper) {
LayoutHelper helper = super.convertLayoutHelper(oldHelper);
if (helper instanceof FixLayoutHelper) {
((FixLayoutHelper) helper).setAlignType(FixLayoutHelper.TOP_LEFT);
}
return helper;
}
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:11,代码来源:PinTopCard.java
示例12: convertLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Nullable
@Override
public LayoutHelper convertLayoutHelper(@Nullable LayoutHelper oldHelper) {
LayoutHelper helper = super.convertLayoutHelper(oldHelper);
if (helper instanceof FixLayoutHelper) {
((FixLayoutHelper) helper).setAlignType(FixLayoutHelper.BOTTOM_LEFT);
((FixLayoutHelper) helper).setSketchMeasure(true);
}
return helper;
}
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:13,代码来源:PinBottomCard.java
示例13: convertLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Nullable
@Override
public LayoutHelper convertLayoutHelper(LayoutHelper oldHelper) {
LinearLayoutHelper helper = new LinearLayoutHelper();
helper.setItemCount(getCells().size());
return helper;
}
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:8,代码来源:BannerCard.java
示例14: convertLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Nullable
@Override
public LayoutHelper convertLayoutHelper(@Nullable LayoutHelper oldHelper) {
LinearLayoutHelper helper = new LinearLayoutHelper();
helper.setItemCount(getCells().size());
return helper;
}
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:8,代码来源:VVCard.java
示例15: convertLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Nullable
@Override
public LayoutHelper convertLayoutHelper(@Nullable LayoutHelper oldHelper) {
GridLayoutHelper helper = new GridLayoutHelper(1);
helper.setItemCount(getCells().size());
if (style != null && !Float.isNaN(style.aspectRatio)) {
helper.setAspectRatio(style.aspectRatio);
}
return helper;
}
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:11,代码来源:LinearScrollCard.java
示例16: convertLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Nullable
@Override
public LayoutHelper convertLayoutHelper(@Nullable LayoutHelper helper) {
//create new layoutHelper to simplify recycling background view in vlayout
RangeGridLayoutHelper gridHelper = new RangeGridLayoutHelper(1, mCells.size());
gridHelper.setItemCount(mCells.size());
gridHelper.setSpanCount(mColumn);
// update style
if (style instanceof GridStyle) {
GridStyle gridStyle = (GridStyle) style;
int totalColumn = mColumn;
if (gridStyle.column > 0) {
totalColumn = gridStyle.column;
gridHelper.setSpanCount(gridStyle.column);
}
gridHelper.setSpanSizeLookup(new CellSpanSizeLookup(mCells, totalColumn));
gridHelper.setVGap(gridStyle.vGap);
gridHelper.setHGap(gridStyle.hGap);
gridHelper.setAutoExpand(gridStyle.autoExpand);
if (gridStyle.cols != null && gridStyle.cols.length > 0) {
gridHelper.setWeights(gridStyle.cols);
}
if (!Float.isNaN(gridStyle.aspectRatio)) {
gridHelper.setAspectRatio(gridStyle.aspectRatio);
}
}
gridHelper.getRootRangeStyle().onClearChildMap();
convertChildLayoutHelper(gridHelper, this);
return gridHelper;
}
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:41,代码来源:GridCard.java
示例17: convertLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Nullable
@Override
public LayoutHelper convertLayoutHelper(@Nullable LayoutHelper oldHelper) {
LayoutHelper layoutHelper = mCard.convertLayoutHelper(oldHelper);
if (layoutHelper != null) {
layoutHelper.setItemCount(mCells.size());
if (layoutHelper instanceof RangeGridLayoutHelper) {
RangeGridLayoutHelper gridHelper = (RangeGridLayoutHelper) layoutHelper;
gridHelper.setSpanSizeLookup(new GridCard.CellSpanSizeLookup(mCells, gridHelper.getSpanCount()));
}
}
return layoutHelper;
}
开发者ID:alibaba,项目名称:Tangram-Android,代码行数:15,代码来源:WrapperCard.java
示例18: createLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Override
public LayoutHelper createLayoutHelper() {
final OnePlusNLayoutHelperEx layoutHelper =
new OnePlusNLayoutHelperEx(getSectionData().size());
decorLayoutHelper(layoutHelper);
return layoutHelper;
}
开发者ID:leobert-lan,项目名称:UiLib,代码行数:8,代码来源:OneNExSection.java
示例19: createLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Override
public LayoutHelper createLayoutHelper() {
final ColumnLayoutHelper columnLayoutHelper =
new ColumnLayoutHelper();
decorLayoutHelper(columnLayoutHelper);
return columnLayoutHelper;
}
开发者ID:leobert-lan,项目名称:UiLib,代码行数:8,代码来源:ColumnSection.java
示例20: createLayoutHelper
import com.alibaba.android.vlayout.LayoutHelper; //导入依赖的package包/类
@Override
public LayoutHelper createLayoutHelper() {
final OnePlusNLayoutHelper layoutHelper =
new OnePlusNLayoutHelper(getItemDataCount());
decorLayoutHelper(layoutHelper);
return layoutHelper;
}
开发者ID:leobert-lan,项目名称:UiLib,代码行数:8,代码来源:OneNSection.java
注:本文中的com.alibaba.android.vlayout.LayoutHelper类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论