Search in sources :

Example 1 with CircleTransformation

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

the class ProjectViewHolder method onBind.

public void onBind() {
    final Photo photo = project.photo();
    if (photo != null) {
        final int targetImageWidth = (int) (getScreenWidthDp(context) * getScreenDensity(context));
        final int targetImageHeight = ProjectUtils.photoHeightFromWidthRatio(targetImageWidth);
        photoImageView.setMaxHeight(targetImageHeight);
        Picasso.with(context).load(photo.full()).resize(targetImageWidth, targetImageHeight).centerCrop().placeholder(grayGradientDrawable).into(photoImageView);
    }
    if (project.hasVideo()) {
        playButton.setVisibility(View.VISIBLE);
    } else {
        playButton.setVisibility(View.GONE);
    }
    /* Project */
    blurbTextView.setText(Html.fromHtml(ksString.format(blurbReadMoreString, "blurb", TextUtils.htmlEncode(project.blurb()), "space", " ")));
    creatorNameTextView.setText(Html.fromHtml(ksString.format(byCreatorString, "creator_name", TextUtils.htmlEncode(project.creator().name()))));
    if (project.isBacking()) {
        backerLabelLinearLayout.setVisibility(View.VISIBLE);
    } else {
        backerLabelLinearLayout.setVisibility(View.GONE);
    }
    projectNameTextView.setText(project.name());
    final Category category = project.category();
    if (category != null) {
        categoryTextView.setText(category.name());
    }
    final Location location = project.location();
    if (location != null) {
        locationTextView.setText(location.displayableName());
    }
    percentageFundedProgressBar.setProgress(ProgressBarUtils.progress(project.percentageFunded()));
    deadlineCountdownTextView.setText(NumberUtils.format(ProjectUtils.deadlineCountdownValue(project)));
    deadlineCountdownUnitTextView.setText(ProjectUtils.deadlineCountdownDetail(project, context, ksString));
    backersCountTextView.setText(NumberUtils.format(project.backersCount()));
    /* Creator */
    Picasso.with(context).load(project.creator().avatar().medium()).transform(new CircleTransformation()).into(avatarImageView);
    avatarNameTextView.setText(project.creator().name());
    final Integer updatesCount = project.updatesCount();
    updatesCountTextView.setText(updatesCount != null ? NumberUtils.format(updatesCount) : null);
    final Integer commentsCount = project.commentsCount();
    commentsCountTextView.setText(commentsCount != null ? NumberUtils.format(commentsCount) : null);
    setConvertedUsdView();
    setLandscapeActionButton();
    setLandscapeOverlayText();
    setPledgedOfGoalView();
    setProjectDisclaimerView();
    setProjectSocialClick();
    setProjectStateView();
    setSocialView();
    setStatsContentDescription();
}
Also used : CircleTransformation(com.kickstarter.libs.transformations.CircleTransformation) Category(com.kickstarter.models.Category) Photo(com.kickstarter.models.Photo) Location(com.kickstarter.models.Location)

Example 2 with CircleTransformation

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

the class CommentViewHolder method onBind.

public void onBind() {
    final Context context = context();
    creatorLabelTextView.setVisibility(View.GONE);
    userLabelTextView.setVisibility(View.GONE);
    if (CommentUtils.isUserAuthor(comment, project.creator())) {
        creatorLabelTextView.setVisibility(View.VISIBLE);
    } else if (CommentUtils.isUserAuthor(comment, currentUser.getUser())) {
        userLabelTextView.setVisibility(View.VISIBLE);
    }
    Picasso.with(context).load(comment.author().avatar().small()).transform(new CircleTransformation()).into(avatarImageView);
    nameTextView.setText(comment.author().name());
    postDateTextView.setText(DateTimeUtils.relative(context, ksString, comment.createdAt()));
    if (CommentUtils.isDeleted(comment)) {
        commentBodyTextView.setTextColor(textSecondaryColor);
        commentBodyTextView.setTypeface(commentBodyTextView.getTypeface(), Typeface.ITALIC);
    } else {
        commentBodyTextView.setTextColor(textPrimaryColor);
        commentBodyTextView.setTypeface(commentBodyTextView.getTypeface(), Typeface.NORMAL);
    }
    commentBodyTextView.setText(comment.body());
}
Also used : Context(android.content.Context) CircleTransformation(com.kickstarter.libs.transformations.CircleTransformation)

Example 3 with CircleTransformation

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

the class FriendBackingViewHolder method onBind.

@Override
public void onBind() {
    final Context context = context();
    final User activityUser = activity().user();
    if (activityUser == null) {
        return;
    }
    final Project activityProject = activity().project();
    if (activityProject == null) {
        return;
    }
    final User projectCreator = activityProject.creator();
    if (projectCreator == null) {
        return;
    }
    final Category projectCategory = activityProject.category();
    if (projectCategory == null) {
        return;
    }
    final Photo projectPhoto = activityProject.photo();
    if (projectPhoto == null) {
        return;
    }
    Picasso.with(context).load(activityUser.avatar().small()).transform(new CircleTransformation()).into(avatarImageView);
    creatorNameTextView.setText(ksString.format(projectByCreatorString, "creator_name", projectCreator.name()));
    projectNameTextView.setText(activityProject.name());
    Picasso.with(context).load(projectPhoto.little()).into(projectPhotoImageView);
    titleTextView.setText(SocialUtils.friendBackingActivityTitle(context, activityUser.name(), projectCategory.rootId(), ksString));
}
Also used : Context(android.content.Context) Project(com.kickstarter.models.Project) CircleTransformation(com.kickstarter.libs.transformations.CircleTransformation) User(com.kickstarter.models.User) Category(com.kickstarter.models.Category) Photo(com.kickstarter.models.Photo)

Example 4 with CircleTransformation

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

the class LoggedInViewHolder method onBind.

@Override
public void onBind() {
    final Context context = context();
    userNameTextView.setText(user.name());
    Picasso.with(context).load(user.avatar().medium()).transform(new CircleTransformation()).into(userImageView);
}
Also used : Context(android.content.Context) CircleTransformation(com.kickstarter.libs.transformations.CircleTransformation)

Example 5 with CircleTransformation

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

the class ActivitySampleFriendBackingViewHolder method onBind.

public void onBind() {
    final Context context = context();
    final User user = activity.user();
    final Project project = activity.project();
    if (user != null && project != null) {
        activityTitleTextView.setVisibility(View.GONE);
        Picasso.with(context).load(user.avatar().small()).transform(new CircleTransformation()).into(activityImageView);
        activitySubtitleTextView.setText(Html.fromHtml(ksString.format(categoryBackingString, "friend_name", user.name(), "project_name", project.name(), "creator_name", project.creator().name())));
    }
}
Also used : Context(android.content.Context) Project(com.kickstarter.models.Project) 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