本文整理汇总了Java中com.tonicartos.superslim.GridSLM类的典型用法代码示例。如果您正苦于以下问题:Java GridSLM类的具体用法?Java GridSLM怎么用?Java GridSLM使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
GridSLM类属于com.tonicartos.superslim包,在下文中一共展示了GridSLM类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: onBindViewHolder
import com.tonicartos.superslim.GridSLM; //导入依赖的package包/类
@Override
public void onBindViewHolder(RVMainAdapter.ViewHolder holder, int position) {
final Item item = items.get(position);
final View itemView = holder.itemView;
holder.bindItem(item.title, item.count, item.label, item.color, item.id);
final GridSLM.LayoutParams lp = GridSLM.LayoutParams.from(itemView.getLayoutParams());
// Overrides xml attrs, could use different layouts too.
if (item.isHeader) {
lp.headerDisplay = mHeaderDisplay;
if (lp.isHeaderInline() || (mMarginsFixed && !lp.isHeaderOverlay())) {
lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
}
lp.headerEndMarginIsAuto = !mMarginsFixed;
lp.headerStartMarginIsAuto = !mMarginsFixed;
}
lp.setSlm(item.sectionManager == LINEAR ? LinearSLM.ID : GridSLM.ID);
lp.setColumnWidth(mContext.getResources().getDimensionPixelSize(R.dimen.grid_column_width));
lp.setFirstPosition(item.sectionFirstPosition);
itemView.setLayoutParams(lp);
}
开发者ID:AbduazizKayumov,项目名称:Flashcard-Maker-Android,代码行数:26,代码来源:RVMainAdapter.java
示例2: onBindHeaderViewHolder
import com.tonicartos.superslim.GridSLM; //导入依赖的package包/类
public void onBindHeaderViewHolder(RealmViewHolder holder, int position) {
String header = rowWrappers.get(position).header;
final GridSLM.LayoutParams layoutParams =
GridSLM.LayoutParams.from(holder.itemView.getLayoutParams());
holder.headerTextView.setText(header);
if (layoutParams.isHeaderInline()) {
layoutParams.width = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
layoutParams.width = ViewGroup.LayoutParams.WRAP_CONTENT;
}
}
开发者ID:jonashao,项目名称:Samantha,代码行数:13,代码来源:RealmBasedRecyclerViewAdapter.java
示例3: onBindViewHolder
import com.tonicartos.superslim.GridSLM; //导入依赖的package包/类
/**
* DON'T OVERRIDE THIS METHOD. Implement onBindRealmViewHolder instead.
*/
@Override
@SuppressWarnings("unchecked")
public final void onBindViewHolder(RealmViewHolder holder, int position) {
if (getItemViewType(position) == LOAD_MORE_VIEW_TYPE) {
holder.loadMoreView.showSpinner();
} else if (getItemViewType(position) == FOOTER_VIEW_TYPE) {
onBindFooterViewHolder((VH) holder, position);
} else {
if (addSectionHeaders) {
final String header = rowWrappers.get(position).header;
final GridSLM.LayoutParams layoutParams =
GridSLM.LayoutParams.from(holder.itemView.getLayoutParams());
// Setup the header
if (header != null) {
layoutParams.isHeader = true;
onBindHeaderViewHolder(holder, position);
} else {
onBindRealmViewHolder((VH) holder, rowWrappers.get(position).realmIndex);
}
layoutParams.setSlm(LinearSLM.ID);
if (header != null) {
layoutParams.setFirstPosition(position);
} else {
layoutParams.setFirstPosition(rowWrappers.get(position).sectionHeaderIndex);
}
holder.itemView.setLayoutParams(layoutParams);
} else {
onBindRealmViewHolder((VH) holder, position);
}
}
}
开发者ID:jonashao,项目名称:Samantha,代码行数:35,代码来源:RealmBasedRecyclerViewAdapter.java
示例4: onViewCreated
import com.tonicartos.superslim.GridSLM; //导入依赖的package包/类
@Override
public void onViewCreated(View view, Bundle savedInstanceState) {
super.onViewCreated(view, savedInstanceState);
if (savedInstanceState != null) {
mHeaderDisplay = savedInstanceState
.getInt(KEY_HEADER_POSITIONING,
getResources().getInteger(R.integer.default_header_display));
mAreMarginsFixed = savedInstanceState
.getBoolean(KEY_MARGINS_FIXED,
getResources().getBoolean(R.bool.default_margins_fixed));
} else {
mHeaderDisplay = getResources().getInteger(R.integer.default_header_display);
mAreMarginsFixed = getResources().getBoolean(R.bool.default_margins_fixed);
}
mRecyclerView = (RecyclerView) view.findViewById(R.id.recycler_view);
ItemDecorator decor = new ItemDecorator.Builder(getActivity())
.setDrawableBelow(R.drawable.divider_horizontal, ItemDecorator.INTERNAL)
.decorateSlm(LinearSLM.ID)
.decorateSlm(GridSLM.ID)
.build();
mRecyclerView.addItemDecoration(decor);
mAdapter = new CountryNamesAdapter(getActivity(), mHeaderDisplay);
LayoutManager layoutManager = new LayoutManager.Builder(getActivity())
.addAdapter(mAdapter)
.build();
mRecyclerView.setLayoutManager(layoutManager);
mAdapter.setMarginsFixed(mAreMarginsFixed);
mAdapter.setHeaderDisplay(mHeaderDisplay);
mRecyclerView.setAdapter(mAdapter);
}
开发者ID:dingdingyr,项目名称:SuperSLiM-,代码行数:37,代码来源:CountriesFragment.java
示例5: onBindViewHolder
import com.tonicartos.superslim.GridSLM; //导入依赖的package包/类
@Override
public void onBindViewHolder(CountryViewHolder holder, int position) {
final LineItem item = mSectionGraph.getItem(position);
final View itemView = holder.itemView;
holder.bindItem(item.text);
final GridSLM.LayoutParams lp = new GridSLM.LayoutParams(
itemView.getLayoutParams());
// Overrides xml attrs, could use different layouts too.
if (item.isHeader) {
lp.headerDisplay = mHeaderDisplay;
if (lp.isHeaderInline() || (mMarginsFixed && !lp.isHeaderOverlay())) {
lp.width = ViewGroup.LayoutParams.MATCH_PARENT;
} else {
lp.width = ViewGroup.LayoutParams.WRAP_CONTENT;
}
}
if (position == item.sectionFirstPosition) {
lp.setSlm(item.sectionManager == LINEAR ? LinearSLM.ID : GridSLM.ID);
lp.marginEnd = mMarginsFixed ? mContext.getResources()
.getDimensionPixelSize(R.dimen.default_section_marginEnd)
: LayoutManager.LayoutParams.MARGIN_AUTO;
lp.marginStart = mMarginsFixed ? mContext.getResources()
.getDimensionPixelSize(R.dimen.default_section_marginStart)
: LayoutManager.LayoutParams.MARGIN_AUTO;
lp.setColumnWidth(mContext.getResources().getDimensionPixelSize(R.dimen.grid_column_width));
}
itemView.setLayoutParams(lp);
}
开发者ID:dingdingyr,项目名称:SuperSLiM-,代码行数:33,代码来源:CountryNamesAdapter.java
示例6: onBindViewHolder
import com.tonicartos.superslim.GridSLM; //导入依赖的package包/类
@Override
public void onBindViewHolder(TimelineViewHolder holder, int position) {
AdapterBaseRow wrapper = adapterBaseRows.get(position);
final View itemView = holder.itemView;
LayoutManager.LayoutParams params;
float imageHeight;
if(sectionManager == LINEAR){
imageHeight = mContext.getResources().getDimension(R.dimen.list_item_height);
params = (LayoutManager.LayoutParams) itemView.getLayoutParams();
params.setSlm(LinearSLM.ID);
}else {
imageHeight = mContext.getResources().getDimension(R.dimen.grid_item_height);
params = GridSLM.LayoutParams.from(itemView.getLayoutParams());
params.setSlm(GridSLM.ID);
((GridSLM.LayoutParams)params ).setNumColumns(3);
((GridSLM.LayoutParams)params ).setColumnWidth(R.dimen.column_width);
}
if(wrapper instanceof AdapterRowHeader){
AdapterRowHeader adapterRowHeader = (AdapterRowHeader) wrapper;
holder.header.setText("" + adapterRowHeader.getUser().getName());
} else {
AdapterRowPicture adapterRowPicture = (AdapterRowPicture) wrapper;
holder.image.getLayoutParams().height = (int)imageHeight;
holder.image.setImageResource(adapterRowPicture.getImage().getPictureResource());
}
params.setFirstPosition(wrapper.sectionFirstPosition);
itemView.setLayoutParams(params);
}
开发者ID:andersonkxiass,项目名称:SuperSlimDemo,代码行数:48,代码来源:TimelineAdapter.java
注:本文中的com.tonicartos.superslim.GridSLM类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论