Search in sources :

Example 71 with LayoutParams

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

Example 72 with LayoutParams

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);
    }
}
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)

Example 73 with LayoutParams

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

Example 74 with LayoutParams

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

Example 75 with LayoutParams

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;
}
Also used : LayoutParams(android.view.ViewGroup.LayoutParams) RecyclerView(android.support.v7.widget.RecyclerView) TextView(android.widget.TextView) View(android.view.View)

Aggregations

View (android.view.View)138 RecyclerView (android.support.v7.widget.RecyclerView)128 TextView (android.widget.TextView)52 ImageView (android.widget.ImageView)36 LinearLayout (android.widget.LinearLayout)32 ViewGroup (android.view.ViewGroup)31 LayoutParams (android.support.v7.widget.RecyclerView.LayoutParams)16 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)15 FrameLayout (android.widget.FrameLayout)15 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)13 Paint (android.graphics.Paint)12 RelativeLayout (android.widget.RelativeLayout)12 BindView (butterknife.BindView)12 Rect (android.graphics.Rect)11 Toolbar (android.support.v7.widget.Toolbar)11 EditText (android.widget.EditText)10 DialogInterface (android.content.DialogInterface)9 Handler (android.os.Handler)9 AdapterView (android.widget.AdapterView)9 Intent (android.content.Intent)8