Search in sources :

Example 36 with LayoutParams

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;
}
Also used : LayoutParams(android.support.v7.widget.RecyclerView.LayoutParams) LinearLayout(android.widget.LinearLayout) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 37 with LayoutParams

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);
        }
    }
}
Also used : LayoutParams(android.support.v7.widget.RecyclerView.LayoutParams) ViewGroup(android.view.ViewGroup) FrameLayout(android.widget.FrameLayout) SuppressLint(android.annotation.SuppressLint) Point(android.graphics.Point)

Example 38 with LayoutParams

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;
}
Also used : StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) SDRecyclerView(com.siberiadante.androidutil.widget.recyclerview.SDRecyclerView) View(android.view.View)

Example 39 with LayoutParams

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);
}
Also used : MenuInflater(android.view.MenuInflater) Resources(android.content.res.Resources) LinearLayout(android.widget.LinearLayout) PopupMenu(android.support.v7.widget.PopupMenu)

Example 40 with LayoutParams

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);
    }
}
Also used : IssueDetailsViewHolder(com.fastaccess.ui.adapter.viewholder.IssueDetailsViewHolder) PullStatusViewHolder(com.fastaccess.ui.adapter.viewholder.PullStatusViewHolder) TimelineCommentsViewHolder(com.fastaccess.ui.adapter.viewholder.TimelineCommentsViewHolder) StaggeredGridLayoutManager(android.support.v7.widget.StaggeredGridLayoutManager) ReviewsViewHolder(com.fastaccess.ui.adapter.viewholder.ReviewsViewHolder) GroupedReviewsViewHolder(com.fastaccess.ui.adapter.viewholder.GroupedReviewsViewHolder) TimelineModel(com.fastaccess.data.dao.TimelineModel)

Aggregations

View (android.view.View)140 RecyclerView (android.support.v7.widget.RecyclerView)127 TextView (android.widget.TextView)46 ImageView (android.widget.ImageView)38 ViewGroup (android.view.ViewGroup)33 LinearLayout (android.widget.LinearLayout)27 LayoutParams (android.support.v7.widget.RecyclerView.LayoutParams)17 Paint (android.graphics.Paint)15 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)15 FrameLayout (android.widget.FrameLayout)15 BindView (butterknife.BindView)12 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)11 Toolbar (android.support.v7.widget.Toolbar)11 Rect (android.graphics.Rect)9 EditText (android.widget.EditText)9 OrientationHelperEx (com.alibaba.android.vlayout.OrientationHelperEx)9 AdapterView (android.widget.AdapterView)8 RelativeLayout (android.widget.RelativeLayout)8 VirtualLayoutManager (com.alibaba.android.vlayout.VirtualLayoutManager)8 SuppressLint (android.annotation.SuppressLint)7