use of android.support.v7.widget.RecyclerView.LayoutManager in project Onboarding by eoinfogarty.
the class SceneThreeFragment method scrollRecycleViewTo.
private void scrollRecycleViewTo(RecyclerView recyclerView, int offset) {
LinearLayoutManager layoutManager = ((LinearLayoutManager) recyclerView.getLayoutManager());
layoutManager.scrollToPositionWithOffset(2, offset);
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project MultiType by drakeet.
the class MultiSelectActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_multi_select);
RecyclerView recyclerView = (RecyclerView) findViewById(R.id.list);
final GridLayoutManager layoutManager = new GridLayoutManager(this, SPAN_COUNT);
layoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return (items.get(position) instanceof Category) ? SPAN_COUNT : 1;
}
});
selectedSet = new TreeSet<>();
recyclerView.setLayoutManager(layoutManager);
adapter = new MultiTypeAdapter();
adapter.applyGlobalMultiTypePool();
adapter.register(Square.class, new SquareViewBinder(selectedSet));
loadData();
assertAllRegistered(adapter, items);
recyclerView.setAdapter(adapter);
setupFAB();
}
use of android.support.v7.widget.RecyclerView.LayoutManager 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);
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project baseAdapter by hongyangAndroid.
the class WrapperUtils method onAttachedToRecyclerView.
public static void onAttachedToRecyclerView(RecyclerView.Adapter innerAdapter, RecyclerView recyclerView, final SpanSizeCallback callback) {
innerAdapter.onAttachedToRecyclerView(recyclerView);
RecyclerView.LayoutManager layoutManager = recyclerView.getLayoutManager();
if (layoutManager instanceof GridLayoutManager) {
final GridLayoutManager gridLayoutManager = (GridLayoutManager) layoutManager;
final GridLayoutManager.SpanSizeLookup spanSizeLookup = gridLayoutManager.getSpanSizeLookup();
gridLayoutManager.setSpanSizeLookup(new GridLayoutManager.SpanSizeLookup() {
@Override
public int getSpanSize(int position) {
return callback.getSpanSize(gridLayoutManager, spanSizeLookup, position);
}
});
gridLayoutManager.setSpanCount(gridLayoutManager.getSpanCount());
}
}
use of android.support.v7.widget.RecyclerView.LayoutManager in project android-oss by kickstarter.
the class ThanksActivity method onCreate.
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.thanks_layout);
ButterKnife.bind(this);
((KSApplication) getApplication()).component().inject(this);
shareDialog = new ShareDialog(this);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
layoutManager.setOrientation(LinearLayoutManager.HORIZONTAL);
recommendedProjectsRecyclerView.setLayoutManager(layoutManager);
adapter = new ThanksAdapter(viewModel);
recommendedProjectsRecyclerView.setAdapter(adapter);
Observable.timer(500L, TimeUnit.MILLISECONDS, Schedulers.newThread()).compose(ignoreValues()).compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> animateBackground());
RxView.clicks(shareButton).compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> viewModel.inputs.shareClick());
RxView.clicks(shareOnFacebookButton).compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> viewModel.inputs.shareOnFacebookClick());
RxView.clicks(shareOnTwitterButton).compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> viewModel.inputs.shareOnTwitterClick());
viewModel.outputs.projectName().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::showBackedProject);
viewModel.outputs.showConfirmGamesNewsletterDialog().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> showConfirmGamesNewsletterDialog());
viewModel.outputs.showGamesNewsletterDialog().compose(bindToLifecycle()).take(1).delay(700L, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> showGamesNewsletterDialog());
viewModel.outputs.showRatingDialog().compose(bindToLifecycle()).take(1).delay(700L, TimeUnit.MILLISECONDS).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> showRatingDialog());
viewModel.outputs.showRecommendations().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::showRecommendations);
viewModel.outputs.startDiscovery().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startDiscovery);
viewModel.outputs.startProject().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startProject);
viewModel.outputs.startShare().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startShare);
viewModel.outputs.startShareOnFacebook().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startShareOnFacebook);
viewModel.outputs.startShareOnTwitter().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startShareOnTwitter);
}
Aggregations