use of android.support.v7.widget.StaggeredGridLayoutManager.LayoutParams in project quran_android by quran.
the class AyahToolBar method init.
private void init(Context context) {
this.context = context;
final Resources resources = context.getResources();
itemWidth = resources.getDimensionPixelSize(R.dimen.toolbar_item_width);
final int toolBarHeight = resources.getDimensionPixelSize(R.dimen.toolbar_height);
pipHeight = resources.getDimensionPixelSize(R.dimen.toolbar_pip_height);
pipWidth = resources.getDimensionPixelSize(R.dimen.toolbar_pip_width);
final int background = ContextCompat.getColor(context, R.color.toolbar_background);
menuLayout = new LinearLayout(context);
menuLayout.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, toolBarHeight));
menuLayout.setBackgroundColor(background);
addView(menuLayout);
pipPosition = PipPosition.DOWN;
toolBarPip = new AyahToolBarPip(context);
toolBarPip.setLayoutParams(new LayoutParams(LayoutParams.WRAP_CONTENT, pipHeight));
addView(toolBarPip);
// used to use MenuBuilder, but now it has @RestrictTo, so using this clever trick from
// StackOverflow - PopupMenu generates a new MenuBuilder internally, so this just lets us
// get that menu and do whatever we want with it.
menu = new PopupMenu(this.context, this).getMenu();
final MenuInflater inflater = new MenuInflater(this.context);
inflater.inflate(ayahMenu, menu);
showMenu(menu);
}
use of android.support.v7.widget.StaggeredGridLayoutManager.LayoutParams in project FastHub by k0shk0sh.
the class IssuesTimelineAdapter method onBindView.
@Override
protected void onBindView(BaseViewHolder holder, int position) {
TimelineModel model = getItem(position);
if (model.getType() == TimelineModel.HEADER) {
((IssueDetailsViewHolder) holder).bind(model);
} else if (model.getType() == TimelineModel.EVENT) {
((IssueTimelineViewHolder) holder).bind(model);
} else if (model.getType() == TimelineModel.COMMENT) {
((TimelineCommentsViewHolder) holder).bind(model);
} else if (model.getType() == TimelineModel.GROUP) {
((GroupedReviewsViewHolder) holder).bind(model);
} else if (model.getType() == TimelineModel.REVIEW) {
((ReviewsViewHolder) holder).bind(model);
} else if (model.getType() == TimelineModel.COMMIT_COMMENTS) {
((CommitThreadViewHolder) holder).bind(model);
} else if (model.getType() == TimelineModel.STATUS && model.getStatus() != null) {
((PullStatusViewHolder) holder).bind(model.getStatus());
}
if (model.getType() != TimelineModel.COMMENT) {
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) holder.itemView.getLayoutParams();
layoutParams.setFullSpan(true);
}
}
use of android.support.v7.widget.StaggeredGridLayoutManager.LayoutParams in project SmartNews by JavenLu.
the class LayoutManagerHelper method handleStaggeredGridNoFullSpan.
public static View handleStaggeredGridNoFullSpan(LayoutInflater inflater, @NonNull ViewGroup parent, int layoutResourceId) {
View view = inflater.inflate(layoutResourceId, parent, false);
if (CommonLibraryApplication.isStaggeredGridLayoutManager) {
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
layoutParams.width = StaggeredGridLayoutManager.LayoutParams.MATCH_PARENT;
layoutParams.setFullSpan(true);
view.setLayoutParams(layoutParams);
}
return view;
}
use of android.support.v7.widget.StaggeredGridLayoutManager.LayoutParams in project SmartNews by JavenLu.
the class LayoutManagerHelper method handleStaggeredGridNoFullSpan.
public static View handleStaggeredGridNoFullSpan(LayoutInflater inflater, @NonNull ViewGroup parent, int layoutResourceId) {
View view = inflater.inflate(layoutResourceId, parent, false);
if (CommonLibraryApplication.isStaggeredGridLayoutManager) {
StaggeredGridLayoutManager.LayoutParams layoutParams = (StaggeredGridLayoutManager.LayoutParams) view.getLayoutParams();
layoutParams.width = StaggeredGridLayoutManager.LayoutParams.MATCH_PARENT;
layoutParams.setFullSpan(true);
view.setLayoutParams(layoutParams);
}
return view;
}
use of android.support.v7.widget.StaggeredGridLayoutManager.LayoutParams in project BlogSource by TeachCourse.
the class RecylerViewAdapter method onCreateViewHolder.
@Override
public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
if (viewType == TYPE_ITEM) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.list_item_text, null);
view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
return new ItemViewHolder(view);
} else // type == TYPE_FOOTER 返回footerView
if (viewType == TYPE_FOOTER) {
View view = LayoutInflater.from(parent.getContext()).inflate(R.layout.footerview, null);
view.setLayoutParams(new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT));
return new FooterViewHolder(view);
}
return null;
}
Aggregations