use of app.philm.in.model.PhilmPerson in project philm by chrisbanes.
the class FetchTmdbPersonRunnable method onSuccess.
@Override
public void onSuccess(Person result) {
PhilmPerson person = getTmdbPersonEntityMapper().map(result);
if (person != null && result.movie_credits != null) {
if (!PhilmCollections.isEmpty(result.movie_credits.cast)) {
List<PhilmPersonCredit> credits = new ArrayList<>();
for (PersonCastCredit credit : result.movie_credits.cast) {
credits.add(new PhilmPersonCredit(credit));
}
Collections.sort(credits, PhilmPersonCredit.COMPARATOR_SORT_DATE);
person.setCastCredits(credits);
}
if (!PhilmCollections.isEmpty(result.movie_credits.crew)) {
List<PhilmPersonCredit> credits = new ArrayList<>();
for (PersonCrewCredit credit : result.movie_credits.crew) {
credits.add(new PhilmPersonCredit(credit));
}
Collections.sort(credits, PhilmPersonCredit.COMPARATOR_SORT_DATE);
person.setCrewCredits(credits);
}
person.setFetchedCredits(true);
getEventBus().post(new MoviesState.PersonChangedEvent(getCallingId(), person));
}
}
use of app.philm.in.model.PhilmPerson in project philm by chrisbanes.
the class FetchTmdbPersonRunnable method onError.
@Override
public void onError(RetrofitError re) {
super.onError(re);
PhilmPerson person = mMoviesState.getPerson(mId);
if (person != null) {
getEventBus().post(new MoviesState.PersonChangedEvent(getCallingId(), person));
}
}
use of app.philm.in.model.PhilmPerson in project philm by chrisbanes.
the class MovieController method fetchPersonIfNeeded.
private void fetchPersonIfNeeded(final int callingId, String id) {
Preconditions.checkNotNull(id, "id cannot be null");
PhilmPerson person = mMoviesState.getPerson(id);
if (person == null || !person.hasFetchedCredits()) {
fetchPerson(callingId, Integer.parseInt(id));
}
}
use of app.philm.in.model.PhilmPerson in project philm by chrisbanes.
the class FetchTmdbPersonCreditsRunnable method onError.
@Override
public void onError(RetrofitError re) {
super.onError(re);
PhilmPerson person = mMoviesState.getPerson(mId);
if (person != null) {
getEventBus().post(new MoviesState.PersonChangedEvent(getCallingId(), person));
}
}
use of app.philm.in.model.PhilmPerson in project philm by chrisbanes.
the class TmdbCrewEntityMapper method map.
@Override
public PhilmPerson map(CrewMember entity) {
PhilmPerson item = getEntity(String.valueOf(entity.id));
if (item == null) {
// No item, so create one
item = new PhilmPerson();
}
// We already have a movie, so just update it wrapped value
item.setFromTmdb(entity);
putEntity(item);
return item;
}
Aggregations