Search in sources :

Example 1 with GridLayoutManager

use of android.support.v7.widget.GridLayoutManager in project photo-picker-plus-android by chute.

the class FragmentRoot method initView.

private void initView(View view) {
    recyclerView = (RecyclerView) view.findViewById(R.id.gcRecyclerViewAssets);
    recyclerView.setHasFixedSize(true);
    if (displayType == DisplayType.LIST && filterType == PhotoFilterType.SOCIAL_MEDIA) {
        final LinearLayoutManager linearLayoutManager = new LinearLayoutManager(getActivity());
        recyclerView.setLayoutManager(linearLayoutManager);
    } else {
        final GridLayoutManager gridLayoutManager = new GridLayoutManager(getActivity(), getResources().getInteger(R.integer.grid_columns_assets));
        recyclerView.setLayoutManager(gridLayoutManager);
    }
    progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Example 2 with GridLayoutManager

use of android.support.v7.widget.GridLayoutManager in project kickmaterial by byoutline.

the class ProjectsListFragment method setUpAdapters.

private void setUpAdapters() {
    /** NEW ADAPTER **/
    layoutManager = new GridLayoutManager(getActivity(), 2);
    final boolean showHeader = sharedPreferences.getBoolean(PREFS_SHOW_HEADER, true);
    // TODO: decide when to hide it.
    sharedPreferences.edit().putBoolean(PREFS_SHOW_HEADER, false).apply();
    final ProjectsAdapter.ItemViewTypeProvider itemViewTypeProvider = new ProjectsAdapter.ItemViewTypeProvider(showHeader);
    layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {

        @Override
        public int getSpanSize(int position) {
            if (itemViewTypeProvider.getViewType(position) == ProjectsAdapter.NORMAL_ITEM) {
                return 1;
            }
            return 2;
        }
    });
    projectListRv.setEndlessScrollListener(this);
    projectListRv.setLayoutManager(layoutManager);
    adapter = new ProjectsAdapter(getActivity(), this, showHeader, itemViewTypeProvider);
    projectListRv.setAdapter(adapter);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) ProjectsAdapter(com.byoutline.kickmaterial.adapters.ProjectsAdapter)

Example 3 with GridLayoutManager

use of android.support.v7.widget.GridLayoutManager in project PhotoView by chrisbanes.

the class ActivityTransitionActivity method onCreate.

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.activity_transition);
    RecyclerView list = (RecyclerView) findViewById(R.id.list);
    list.setLayoutManager(new GridLayoutManager(this, 2));
    ImageAdapter imageAdapter = new ImageAdapter(new ImageAdapter.Listener() {

        @Override
        public void onImageClicked(View view) {
            transition(view);
        }
    });
    list.setAdapter(imageAdapter);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager) RecyclerView(android.support.v7.widget.RecyclerView) RecyclerView(android.support.v7.widget.RecyclerView) View(android.view.View)

Example 4 with GridLayoutManager

use of android.support.v7.widget.GridLayoutManager in project philm by chrisbanes.

the class MovieDetailFragment method populateUi.

private void populateUi() {
    if (mMovie == null) {
        return;
    }
    if (mBackdropImageView != null) {
        if (mMovie.hasBackdropUrl()) {
            mBackdropImageView.loadBackdrop(mMovie);
        }
    }
    if (mCollapsingToolbarLayout != null) {
        mCollapsingToolbarLayout.setTitle(mMovie.getTitle());
    }
    mAdapter = new GroupAdapter();
    mAdapter.add(new TitleItem());
    mAdapter.add(new ButtonsItem());
    if (!TextUtils.isEmpty(mMovie.getOverview())) {
        mAdapter.add(new SummaryItem());
    }
    mAdapter.add(new RatingItem());
    mAdapter.add(new DetailsGroup());
    //
    //        if (!PhilmCollections.isEmpty(mMovie.getTrailers())) {
    //            mItems.add(DetailItemType.TRAILERS);
    //        }
    //
    //        if (!PhilmCollections.isEmpty(mMovie.getCast())) {
    //            mItems.add(DetailItemType.CAST);
    //        }
    //
    //        if (!PhilmCollections.isEmpty(mMovie.getCrew())) {
    //            mItems.add(DetailItemType.CREW);
    //        }
    //
    //        if (!PhilmCollections.isEmpty(mMovie.getRelated())) {
    //            mItems.add(DetailItemType.RELATED);
    //        }
    GridLayoutManager layoutManager = new GridLayoutManager(getContext(), mAdapter.getSpanCount());
    layoutManager.setSpanSizeLookup(mAdapter.getSpanSizeLookup());
    mRecyclerView.setLayoutManager(layoutManager);
    mRecyclerView.setAdapter(mAdapter);
}
Also used : GroupAdapter(com.genius.groupie.GroupAdapter) GridLayoutManager(android.support.v7.widget.GridLayoutManager)

Example 5 with GridLayoutManager

use of android.support.v7.widget.GridLayoutManager in project UltimateRecyclerView by cymcsg.

the class catelogGrid method renderviewlayout.

protected void renderviewlayout(View view) throws Exception {
    listview_layout = (UltimateRecyclerView) view.findViewById(getUltimate_recycler_viewResId());
    listview_layout.setHasFixedSize(true);
    listview_layout.setSaveEnabled(true);
    if (mLayoutManager == null) {
        mLayoutManager = new GridLayoutManager(view.getContext(), getColumn(), LinearLayoutManager.VERTICAL, false);
    }
    listview_layout.setLayoutManager(mLayoutManager);
    getProgressbar(view);
    listview_layout.setAdapter(madapter = getAdatperWithdata());
    setUltimateRecyclerViewExtra(listview_layout, madapter);
}
Also used : GridLayoutManager(android.support.v7.widget.GridLayoutManager)

Aggregations

GridLayoutManager (android.support.v7.widget.GridLayoutManager)264 RecyclerView (android.support.v7.widget.RecyclerView)118 LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)68 View (android.view.View)60 StaggeredGridLayoutManager (android.support.v7.widget.StaggeredGridLayoutManager)38 TextView (android.widget.TextView)32 DefaultItemAnimator (android.support.v7.widget.DefaultItemAnimator)15 MaterialViewPagerHeaderDecorator (com.github.florent37.materialviewpager.header.MaterialViewPagerHeaderDecorator)14 BindView (butterknife.BindView)13 ArrayList (java.util.ArrayList)13 Handler (android.os.Handler)12 Toolbar (android.support.v7.widget.Toolbar)12 ImageView (android.widget.ImageView)12 Context (android.content.Context)11 Intent (android.content.Intent)11 Point (android.graphics.Point)9 Nullable (android.support.annotation.Nullable)9 SwipeRefreshLayout (android.support.v4.widget.SwipeRefreshLayout)9 SuppressLint (android.annotation.SuppressLint)8 AdapterView (android.widget.AdapterView)8