use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectStateChangedViewHolder method onBind.
@Override
public void onBind() {
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;
}
Picasso.with(context()).load(photo.little()).into(projectPhotoImageView);
switch(activity().category()) {
case Activity.CATEGORY_FAILURE:
titleTextView.setText(ksString.format(projectNotSuccessfullyFundedString, "project_name", project.name()));
break;
case Activity.CATEGORY_CANCELLATION:
titleTextView.setText(ksString.format(projectCanceledByCreatorString, "project_name", project.name()));
break;
case Activity.CATEGORY_SUSPENSION:
titleTextView.setText(ksString.format(projectSuspendedString, "project_name", project.name()));
break;
default:
titleTextView.setText("");
}
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectUpdateViewHolder 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;
}
final Update update = activity().update();
if (update == null) {
return;
}
final DateTime publishedAt = ObjectUtils.coalesce(update.publishedAt(), new DateTime());
projectNameTextView.setText(project.name());
Picasso.with(context).load(photo.little()).into(projectPhotoImageView);
timestampTextView.setText(DateTimeUtils.relative(context, ksString, publishedAt));
updateBodyTextView.setText(update.truncatedBody());
updateSequenceTextView.setText(ksString.format(projectUpdateCountString, "update_count", String.valueOf(update.sequence())));
updateTitleTextView.setText(update.title());
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectFactory method backedProjectWithRewardLimitReached.
@NonNull
public static Project backedProjectWithRewardLimitReached() {
final Project project = project();
final Reward reward = RewardFactory.limitReached();
final Backing backing = Backing.builder().amount(10.0f).backerId(IdFactory.id()).id(IdFactory.id()).sequence(1).reward(reward).rewardId(reward.id()).pledgedAt(DateTime.now()).projectCountry(project.country()).projectId(project.id()).shippingAmount(0.0f).status(Backing.STATUS_PLEDGED).build();
return project.toBuilder().backing(backing).isBacking(true).build();
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectIntentMapperTest method testProject_doesNotEmitFromHttpsProjectUri.
@Test
public void testProject_doesNotEmitFromHttpsProjectUri() {
final Uri uri = Uri.parse("https://www.kickstarter.com/projects/1186238668/skull-graphic-tee");
final Intent intent = new Intent(Intent.ACTION_VIEW, uri);
final TestSubscriber<Project> resultTest = TestSubscriber.create();
ProjectIntentMapper.project(intent, new MockApiClient()).subscribe(resultTest);
resultTest.assertNoValues();
}
use of com.kickstarter.models.Project in project android-oss by kickstarter.
the class ProjectIntentMapperTest method testProject_emitsTwiceFromProjectExtra.
@Test
public void testProject_emitsTwiceFromProjectExtra() {
final Project project = ProjectFactory.project();
final Intent intent = new Intent().putExtra(IntentKey.PROJECT, project);
final TestSubscriber<Project> resultTest = TestSubscriber.create();
ProjectIntentMapper.project(intent, new MockApiClient()).subscribe(resultTest);
resultTest.assertValueCount(2);
}
Aggregations