use of android.support.v7.widget.LinearLayoutManager 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);
}
use of android.support.v7.widget.LinearLayoutManager in project android-oss by kickstarter.
the class ViewPledgeActivity method onCreate.
@Override
public void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.view_pledge_layout);
ButterKnife.bind(this);
final RewardsItemAdapter rewardsItemAdapter = new RewardsItemAdapter();
rewardsItemRecyclerView.setAdapter(rewardsItemAdapter);
final LinearLayoutManager layoutManager = new LinearLayoutManager(this);
rewardsItemRecyclerView.setLayoutManager(layoutManager);
final Environment environment = environment();
ksString = environment.ksString();
RxView.clicks(projectContextView).compose(bindToLifecycle()).observeOn(mainThread()).subscribe(__ -> viewModel.inputs.projectClicked());
viewModel.outputs.backerNameTextViewText().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(backerNameTextView::setText);
viewModel.outputs.backerNumberTextViewText().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(this::setBackerNumberTextViewText);
viewModel.outputs.backingAmountAndDateTextViewText().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(ad -> setBackingAmountAndDateTextViewText(ad.first, ad.second));
viewModel.outputs.backingStatus().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(this::setBackingStatusTextViewText);
viewModel.outputs.creatorNameTextViewText().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(this::setCreatorNameTextViewText);
viewModel.outputs.goBack().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(__ -> back());
viewModel.outputs.loadBackerAvatar().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(this::loadBackerAvatar);
viewModel.outputs.loadProjectPhoto().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(url -> Picasso.with(this).load(url).into(projectContextPhotoImageView));
viewModel.outputs.projectNameTextViewText().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(projectContextProjectNameTextView::setText);
viewModel.outputs.rewardsItems().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(rewardsItemAdapter::rewardsItems);
viewModel.outputs.rewardsItemsAreHidden().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(ViewUtils.setGone(rewardsItemSection));
viewModel.outputs.rewardMinimumAndDescriptionTextViewText().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(md -> setRewardMinimumAndDescriptionTextViewText(md.first, md.second));
viewModel.outputs.shippingAmountTextViewText().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(shippingAmountTextView::setText);
viewModel.outputs.shippingLocationTextViewText().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(shippingLocationTextView::setText);
viewModel.outputs.shippingSectionIsHidden().compose(bindToLifecycle()).observeOn(mainThread()).subscribe(ViewUtils.setGone(shippingSection));
}
use of android.support.v7.widget.LinearLayoutManager in project android-oss by kickstarter.
the class ProfileActivity method loadProjects.
private void loadProjects(@NonNull final List<Project> projects) {
if (projects.size() == 0) {
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerView.setPadding(0, recyclerView.getPaddingTop(), recyclerView.getPaddingRight(), recyclerView.getPaddingBottom());
if (ViewUtils.isPortrait(this)) {
disableNestedScrolling();
}
}
adapter.takeProjects(projects);
}
use of android.support.v7.widget.LinearLayoutManager in project android-oss by kickstarter.
the class ProjectActivity method onCreate.
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.project_layout);
ButterKnife.bind(this);
((KSApplication) getApplication()).component().inject(this);
final int bottomButtonVisibility = ViewUtils.isLandscape(this) ? View.GONE : View.VISIBLE;
projectActionButtonsViewGroup.setVisibility(bottomButtonVisibility);
adapter = new ProjectAdapter(viewModel);
projectRecyclerView.setAdapter(adapter);
projectRecyclerView.setLayoutManager(new LinearLayoutManager(this));
this.viewModel.outputs.projectAndUserCountry().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(pc -> this.renderProject(pc.first, pc.second));
this.viewModel.outputs.startCampaignWebViewActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startCampaignWebViewActivity);
this.viewModel.outputs.startCommentsActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startCommentsActivity);
this.viewModel.outputs.startCreatorBioWebViewActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startCreatorBioWebViewActivity);
this.viewModel.outputs.showShareSheet().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startShareIntent);
this.viewModel.outputs.startProjectUpdatesActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startProjectUpdatesActivity);
this.viewModel.outputs.startVideoActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startVideoActivity);
this.viewModel.outputs.startCheckoutActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startCheckoutActivity);
this.viewModel.outputs.startManagePledgeActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startManagePledge);
this.viewModel.outputs.startViewPledgeActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startViewPledgeActivity);
this.viewModel.outputs.showStarredPrompt().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> this.showStarToast());
this.viewModel.outputs.startLoginToutActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> this.startLoginToutActivity());
}
use of android.support.v7.widget.LinearLayoutManager in project android-oss by kickstarter.
the class ActivityFeedActivity method onCreate.
@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
((KSApplication) getApplication()).component().inject(this);
setContentView(R.layout.activity_feed_layout);
ButterKnife.bind(this);
adapter = new ActivityFeedAdapter(viewModel.inputs);
recyclerView.setAdapter(adapter);
recyclerView.setLayoutManager(new LinearLayoutManager(this));
recyclerViewPaginator = new RecyclerViewPaginator(recyclerView, viewModel.inputs::nextPage);
swipeRefresher = new SwipeRefresher(this, swipeRefreshLayout, viewModel.inputs::refresh, viewModel.outputs::isFetchingActivities);
// Only allow refreshing if there's a current user
currentUser.observable().map(ObjectUtils::isNotNull).compose(bindToLifecycle()).compose(observeForUI()).subscribe(swipeRefreshLayout::setEnabled);
viewModel.outputs.activities().compose(bindToLifecycle()).compose(observeForUI()).subscribe(this::showActivities);
viewModel.outputs.loggedOutEmptyStateIsVisible().compose(bindToLifecycle()).compose(observeForUI()).subscribe(adapter::showLoggedOutEmptyState);
viewModel.outputs.loggedInEmptyStateIsVisible().compose(bindToLifecycle()).compose(observeForUI()).subscribe(adapter::showLoggedInEmptyState);
viewModel.outputs.goToDiscovery().compose(bindToLifecycle()).compose(observeForUI()).subscribe(__ -> resumeDiscoveryActivity());
viewModel.outputs.goToLogin().compose(bindToLifecycle()).compose(observeForUI()).subscribe(__ -> startActivityFeedLogin());
viewModel.outputs.goToProject().compose(bindToLifecycle()).compose(observeForUI()).subscribe(this::startProjectActivity);
viewModel.outputs.goToProjectUpdate().compose(bindToLifecycle()).compose(observeForUI()).subscribe(this::startProjectUpdateActivity);
}
Aggregations