use of android.support.v7.widget.GridLayoutManager in project AdMoney by ErnestoGonAr.
the class Deudas method setRecyclerViewLayoutManager.
public void setRecyclerViewLayoutManager(LayoutManagerType layoutManagerType) {
int scrollPosition = 0;
// If a layout manager has already been set, get current scroll position.
if (mRecyclerView.getLayoutManager() != null) {
scrollPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
}
switch(layoutManagerType) {
case GRID_LAYOUT_MANAGER:
mLayoutManager = new GridLayoutManager(getActivity(), SPAN_COUNT);
mCurrentLayoutManagerType = LayoutManagerType.GRID_LAYOUT_MANAGER;
break;
case LINEAR_LAYOUT_MANAGER:
mLayoutManager = new LinearLayoutManager(getActivity());
mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
break;
default:
mLayoutManager = new LinearLayoutManager(getActivity());
mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
}
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.scrollToPosition(scrollPosition);
}
use of android.support.v7.widget.GridLayoutManager in project AdMoney by ErnestoGonAr.
the class Saldo method setRecyclerViewLayoutManager.
public void setRecyclerViewLayoutManager(LayoutManagerType layoutManagerType) {
int scrollPosition = 0;
// If a layout manager has already been set, get current scroll position.
if (mRecyclerView.getLayoutManager() != null) {
scrollPosition = ((LinearLayoutManager) mRecyclerView.getLayoutManager()).findFirstCompletelyVisibleItemPosition();
}
switch(layoutManagerType) {
case GRID_LAYOUT_MANAGER:
mLayoutManager = new GridLayoutManager(getActivity(), SPAN_COUNT);
mCurrentLayoutManagerType = LayoutManagerType.GRID_LAYOUT_MANAGER;
break;
case LINEAR_LAYOUT_MANAGER:
mLayoutManager = new LinearLayoutManager(getActivity());
mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
break;
default:
mLayoutManager = new LinearLayoutManager(getActivity());
mCurrentLayoutManagerType = LayoutManagerType.LINEAR_LAYOUT_MANAGER;
}
mRecyclerView.setLayoutManager(mLayoutManager);
mRecyclerView.scrollToPosition(scrollPosition);
}
use of android.support.v7.widget.GridLayoutManager in project PhotoNoter by yydcdut.
the class MediaPhotoFragment method onViewCreated.
@Override
public void onViewCreated(View view, @Nullable Bundle savedInstanceState) {
mMainActivity = (MainActivity) getActivity();
super.onViewCreated(view, savedInstanceState);
ButterKnife.bind(this, view);
GridLayoutManager gridLayoutManager = new GridLayoutManager(getContext(), 3);
mRecyclerView.setLayoutManager(gridLayoutManager);
mRecyclerView.setItemAnimator(new DefaultItemAnimator());
}
use of android.support.v7.widget.GridLayoutManager in project CloudReader by youlookwhat.
the class BookCustomFragment method onActivityCreated.
@Override
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
showContentView();
bindingView.srlBook.setColorSchemeColors(CommonUtils.getColor(R.color.colorTheme));
bindingView.srlBook.setOnRefreshListener(new SwipeRefreshLayout.OnRefreshListener() {
@Override
public void onRefresh() {
DebugUtil.error("-----onRefresh");
// listTag= Arrays.asList(BookApiUtils.getApiTag(position));
// String tag=BookApiUtils.getRandomTAG(listTag);
// doubanBookPresenter.searchBookByTag(BookReadingFragment.this,tag,false);
bindingView.srlBook.postDelayed(new Runnable() {
@Override
public void run() {
mStart = 0;
loadCustomData();
}
}, 1000);
}
});
// mBookAdapter = new BookAdapter(getActivity());
// mLayoutManager = new StaggeredGridLayoutManager(3, StaggeredGridLayoutManager.VERTICAL);
mLayoutManager = new GridLayoutManager(getActivity(), 3);
bindingView.xrvBook.setLayoutManager(mLayoutManager);
// bindingView.xrvBook.setAdapter(mBookAdapter);
scrollRecycleView();
// 准备就绪
mIsPrepared = true;
/**
* 因为启动时先走loadData()再走onActivityCreated,
* 所以此处要额外调用load(),不然最初不会加载内容
*/
loadData();
}
use of android.support.v7.widget.GridLayoutManager in project wh-app-android by WhiteHouse.
the class FeedItemListFragment method onCreateLayoutManager.
@Override
public RecyclerView.LayoutManager onCreateLayoutManager() {
Resources res = getResources();
int feedGridCols = res.getInteger(R.integer.feed_grid_columns);
int photoGridCols = res.getInteger(R.integer.photo_grid_columns);
switch(mFeedType) {
case TYPE_PHOTOS:
return new StaggeredGridLayoutManager(photoGridCols, VERTICAL);
case TYPE_VIDEOS:
return new GridLayoutManager(getActivity(), feedGridCols);
case TYPE_LIVE:
return new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
case TYPE_ARTICLE:
default:
return new StaggeredGridLayoutManager(feedGridCols, VERTICAL);
}
}
Aggregations