use of com.kickstarter.models.Photo in project android-oss by kickstarter.
the class ProjectCardViewHolder method onBind.
public void onBind() {
backersCountTextView.setText(NumberUtils.format(project.backersCount()));
blurbTextView.setText(project.blurb());
final Category category = project.category();
if (category != null) {
categoryTextView.setText(category.name());
} else {
categoryTextView.setText("");
}
deadlineCountdownTextView.setText(NumberUtils.format(ProjectUtils.deadlineCountdownValue(project)));
deadlineCountdownUnitTextView.setText(ProjectUtils.deadlineCountdownDetail(project, context, ksString));
nameTextView.setText(project.name());
percentTextView.setText(NumberUtils.flooredPercentage(project.percentageFunded()));
percentageFundedProgressBar.setProgress(ProgressBarUtils.progress(project.percentageFunded()));
final Photo photo = project.photo();
if (photo != null) {
photoImageView.setVisibility(View.VISIBLE);
final int targetImageWidth = (int) (getScreenWidthDp(context) * getScreenDensity(context) - grid4Dimen);
final int targetImageHeight = ProjectUtils.photoHeightFromWidthRatio(targetImageWidth);
photoImageView.setMaxHeight(targetImageHeight);
Picasso.with(context).load(photo.full()).resize(targetImageWidth, // required to fit properly into apis < 18
targetImageHeight).centerCrop().placeholder(grayGradientDrawable).into(photoImageView);
} else {
photoImageView.setVisibility(View.INVISIBLE);
}
setProjectMetadataView();
setProjectStateView(context);
}
use of com.kickstarter.models.Photo in project android-oss by kickstarter.
the class ProjectContextViewHolder method onBind.
public void onBind() {
final Photo photo = project.photo();
if (photo != null) {
projectContextImageView.setVisibility(View.VISIBLE);
Picasso.with(context).load(photo.full()).into(projectContextImageView);
} else {
projectContextImageView.setVisibility(View.INVISIBLE);
}
projectNameTextView.setText(project.name());
creatorNameTextView.setText(ksString.format(projectCreatorByCreatorString, "creator_name", project.creator().name()));
}
use of com.kickstarter.models.Photo in project android-oss by kickstarter.
the class ProjectSearchResultViewHolder method onBind.
public void onBind() {
final Context context = context();
creatorNameTextView.setText(ksString.format(byCreatorString, "creator_name", project.creator().name()));
projectNameTextView.setText(project.name());
final Photo photo = project.photo();
if (photo != null) {
projectImageView.setVisibility(View.VISIBLE);
Picasso.with(context).load(photo.small()).into(projectImageView);
} else {
projectImageView.setVisibility(View.INVISIBLE);
}
}
use of com.kickstarter.models.Photo in project android-oss by kickstarter.
the class ProjectStateChangedPositiveViewHolder method onBind.
@Override
public void onBind() {
final Context context = context();
final Project project = activity().project();
if (project == null) {
return;
}
final User user = activity().user();
if (user == null) {
return;
}
final Photo photo = project.photo();
if (photo == null) {
return;
}
switch(activity().category()) {
case Activity.CATEGORY_LAUNCH:
final DateTime launchedAt = coalesce(project.launchedAt(), new DateTime());
cardView.setCardBackgroundColor(blueDarken10Color);
leftStatFirstTextView.setText(ksCurrency.format(project.goal(), project));
leftStatSecondTextView.setText(goalString);
rightStatFirstTextView.setText(launchedString);
rightStatSecondTextView.setText(DateTimeUtils.mediumDate(launchedAt));
titleTextView.setText(ksString.format(creatorLaunchedProjectString, "creator_name", user.name(), "project_name", project.name()));
break;
case Activity.CATEGORY_SUCCESS:
cardView.setCardBackgroundColor(greenDarken10Color);
leftStatFirstTextView.setText(ksCurrency.format(project.pledged(), project));
leftStatSecondTextView.setText(ksString.format(pledgedOfGoalString, "goal", ksCurrency.format(project.goal(), project, true)));
rightStatFirstTextView.setText(fundedString);
rightStatSecondTextView.setText(DateTimeUtils.mediumDate(activity().createdAt()));
titleTextView.setText(ksString.format(projectSuccessfullyFundedString, "project_name", project.name()));
break;
default:
cardView.setCardBackgroundColor(greenDarken10Color);
leftStatFirstTextView.setText("");
leftStatSecondTextView.setText("");
rightStatFirstTextView.setText("");
rightStatSecondTextView.setText("");
titleTextView.setText("");
}
// TODO: Switch to "You launched a project" if current user launched
//return context.getString(R.string.creator_launched_a_project, activity.user().name(), activity.project().name());
Picasso.with(context).load(photo.full()).into(projectPhotoImageView);
}
use of com.kickstarter.models.Photo in project android-oss by kickstarter.
the class ThanksProjectViewHolder method onBind.
public void onBind() {
nameTextView.setText(project.name());
if (project.isLive()) {
timeToGoTextView.setText(ksString.format(timeLeftToGoString, "time_left", ProjectUtils.deadlineCountdown(project, context)));
timeToGoTextView.setVisibility(View.VISIBLE);
} else {
timeToGoTextView.setVisibility(View.GONE);
}
final Photo photo = project.photo();
if (photo != null) {
photoImageView.setVisibility(View.VISIBLE);
Picasso.with(context).load(photo.med()).into(photoImageView);
} else {
photoImageView.setVisibility(View.INVISIBLE);
}
}
Aggregations