Search in sources :

Example 6 with CircleTransformation

use of com.kickstarter.libs.transformations.CircleTransformation in project android-oss by kickstarter.

the class ActivitySampleFriendFollowViewHolder method onBind.

public void onBind() {
    final Context context = context();
    final User user = activity.user();
    if (user != null) {
        Picasso.with(context).load(user.avatar().small()).transform(new CircleTransformation()).into(activityImageView);
        activityTitleTextView.setText(ksString.format(categoryFollowingString, "user_name", user.name()));
        activitySubtitleTextView.setText(categoryFollowBackString);
        // temp until followable :
        activitySubtitleTextView.setVisibility(View.GONE);
    }
}
Also used : Context(android.content.Context) CircleTransformation(com.kickstarter.libs.transformations.CircleTransformation) User(com.kickstarter.models.User)

Example 7 with CircleTransformation

use of com.kickstarter.libs.transformations.CircleTransformation in project android-oss by kickstarter.

the class ProfileActivity method onCreate.

@Override
protected void onCreate(@Nullable final Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.profile_layout);
    ButterKnife.bind(this);
    adapter = new ProfileAdapter(viewModel);
    final int spanCount = ViewUtils.isLandscape(this) ? 3 : 2;
    recyclerView.setLayoutManager(new GridLayoutManager(this, spanCount));
    recyclerView.setAdapter(adapter);
    paginator = new RecyclerViewPaginator(recyclerView, viewModel.inputs::nextPage);
    viewModel.outputs.avatarImageViewUrl().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(url -> Picasso.with(this).load(url).transform(new CircleTransformation()).into(avatarImageView));
    viewModel.outputs.backedCountTextViewHidden().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(ViewUtils.setGone(this.backedCountTextView));
    viewModel.outputs.backedCountTextViewText().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this.backedCountTextView::setText);
    viewModel.outputs.backedTextViewHidden().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(ViewUtils.setGone(this.backedTextView));
    viewModel.outputs.createdCountTextViewHidden().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(ViewUtils.setGone(this.createdCountTextView));
    viewModel.outputs.createdCountTextViewText().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this.createdCountTextView::setText);
    viewModel.outputs.createdTextViewHidden().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(ViewUtils.setGone(this.createdTextView));
    viewModel.outputs.dividerViewHidden().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(ViewUtils.setGone(this.dividerView));
    viewModel.outputs.projects().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::loadProjects);
    viewModel.outputs.resumeDiscoveryActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(__ -> resumeDiscoveryActivity());
    viewModel.outputs.startProjectActivity().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this::startProjectActivity);
    viewModel.outputs.userNameTextViewText().compose(bindToLifecycle()).observeOn(AndroidSchedulers.mainThread()).subscribe(this.userNameTextView::setText);
}
Also used : RecyclerViewPaginator(com.kickstarter.libs.RecyclerViewPaginator) ProfileAdapter(com.kickstarter.ui.adapters.ProfileAdapter) CircleTransformation(com.kickstarter.libs.transformations.CircleTransformation) GridLayoutManager(android.support.v7.widget.GridLayoutManager)

Example 8 with CircleTransformation

use of com.kickstarter.libs.transformations.CircleTransformation in project android-oss by kickstarter.

the class FriendFollowViewHolder method onBind.

@Override
public void onBind() {
    final Context context = context();
    final User friend = activity().user();
    if (friend == null) {
        return;
    }
    Picasso.with(context).load(friend.avatar().small()).transform(new CircleTransformation()).into(avatarImageView);
    // TODO: bold username
    titleTextView.setText(new StringBuilder(friend.name()).append(" ").append(isFollowingYouString));
}
Also used : Context(android.content.Context) CircleTransformation(com.kickstarter.libs.transformations.CircleTransformation) User(com.kickstarter.models.User)

Aggregations

CircleTransformation (com.kickstarter.libs.transformations.CircleTransformation)8 Context (android.content.Context)6 User (com.kickstarter.models.User)4 Category (com.kickstarter.models.Category)2 Photo (com.kickstarter.models.Photo)2 Project (com.kickstarter.models.Project)2 GridLayoutManager (android.support.v7.widget.GridLayoutManager)1 RecyclerViewPaginator (com.kickstarter.libs.RecyclerViewPaginator)1 Location (com.kickstarter.models.Location)1 ProfileAdapter (com.kickstarter.ui.adapters.ProfileAdapter)1