Search in sources :

Example 1 with RewardsItemAdapter

use of com.kickstarter.ui.adapters.RewardsItemAdapter 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));
}
Also used : Environment(com.kickstarter.libs.Environment) RewardsItemAdapter(com.kickstarter.ui.adapters.RewardsItemAdapter) LinearLayoutManager(android.support.v7.widget.LinearLayoutManager)

Aggregations

LinearLayoutManager (android.support.v7.widget.LinearLayoutManager)1 Environment (com.kickstarter.libs.Environment)1 RewardsItemAdapter (com.kickstarter.ui.adapters.RewardsItemAdapter)1