use of android.support.v7.app.ActionBar.LayoutParams in project BaseProject by feer921.
the class BaseQuickAdapter method addHeaderView.
/**
* @param header
* @param index
* @param orientation
*/
public int addHeaderView(View header, int index, int orientation) {
if (mHeaderLayout == null) {
mHeaderLayout = new LinearLayout(header.getContext());
if (orientation == LinearLayout.VERTICAL) {
mHeaderLayout.setOrientation(LinearLayout.VERTICAL);
mHeaderLayout.setLayoutParams(new LayoutParams(MATCH_PARENT, WRAP_CONTENT));
} else {
mHeaderLayout.setOrientation(LinearLayout.HORIZONTAL);
mHeaderLayout.setLayoutParams(new LayoutParams(WRAP_CONTENT, MATCH_PARENT));
}
}
final int childCount = mHeaderLayout.getChildCount();
if (index < 0 || index > childCount) {
index = childCount;
}
mHeaderLayout.addView(header, index);
if (mHeaderLayout.getChildCount() == 1) {
int position = getHeaderViewPosition();
if (position != -1) {
notifyItemInserted(position);
}
}
return index;
}
use of android.support.v7.app.ActionBar.LayoutParams in project BaseProject by feer921.
the class BaseQuickAdapter method setEmptyView.
public void setEmptyView(View emptyView) {
boolean insert = false;
if (mEmptyLayout == null) {
mEmptyLayout = new FrameLayout(emptyView.getContext());
final LayoutParams layoutParams = new LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
final ViewGroup.LayoutParams lp = emptyView.getLayoutParams();
if (lp != null) {
layoutParams.width = lp.width;
layoutParams.height = lp.height;
}
mEmptyLayout.setLayoutParams(layoutParams);
insert = true;
}
mEmptyLayout.removeAllViews();
mEmptyLayout.addView(emptyView);
mIsUseEmpty = true;
if (insert) {
if (getEmptyViewCount() == 1) {
int position = 0;
if (mHeadAndEmptyEnable && getHeaderLayoutCount() != 0) {
position++;
}
notifyItemInserted(position);
}
}
}
use of android.support.v7.app.ActionBar.LayoutParams in project AndroidUtilLib by SiberiaDante.
the class SDRecyclerViewAdapter method createSpViewByType.
private View createSpViewByType(ViewGroup parent, int viewType) {
for (ItemView headerView : headers) {
if (headerView.hashCode() == viewType) {
View view = headerView.onCreateView(parent);
StaggeredGridLayoutManager.LayoutParams layoutParams;
if (view.getLayoutParams() != null)
layoutParams = new StaggeredGridLayoutManager.LayoutParams(view.getLayoutParams());
else
layoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setFullSpan(true);
view.setLayoutParams(layoutParams);
return view;
}
}
for (ItemView footerview : footers) {
if (footerview.hashCode() == viewType) {
View view = footerview.onCreateView(parent);
StaggeredGridLayoutManager.LayoutParams layoutParams;
if (view.getLayoutParams() != null)
layoutParams = new StaggeredGridLayoutManager.LayoutParams(view.getLayoutParams());
else
layoutParams = new StaggeredGridLayoutManager.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
layoutParams.setFullSpan(true);
view.setLayoutParams(layoutParams);
return view;
}
}
return null;
}
use of android.support.v7.app.ActionBar.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.app.ActionBar.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);
}
}
Aggregations