@Override public void populateUi(MovieImagesView view, String parameter) { final MovieWrapper movie = MMoviesApp.get().getState().getMovie(parameter); if (movie != null && !MoviesCollections.isEmpty(movie.getBackdropImages())) { view.setData(Collections.unmodifiableList(movie.getBackdropImages())); } }
private void fetchMovieImagesIfNeeded(final int callingId, String parameter) { Preconditions.checkNotNull(parameter, "id cannot be null"); MovieWrapper movie = MMoviesApp.get().getState().getMovie(parameter); if (movie != null && MoviesCollections.isEmpty(movie.getBackdropImages())) { fetchMovieImages(callingId, parameter); } }
@Override public String getUiTitle(String parameter) { final MovieWrapper movie = MMoviesApp.get().getState().getMovie(parameter); if (movie != null) { return movie.getTitle(); } return null; }
private void fetchMovieImages(final int callingId, String parameter) { Preconditions.checkNotNull(parameter, "id cannot be null"); MovieWrapper movie = MMoviesApp.get().getState().getMovie(parameter); if (movie != null && movie.getTmdbId() != null) { executeNetworkTask(new FetchMovieImagesRunnable(callingId, movie.getTmdbId())); } }
@Override public <BR> void executeNetworkTask(BaseRunnable<BR> task) { MMoviesApp.get().inject(task); MMoviesApp.get().getBackgroundExecutor().execute(task); }
@Override public void onDestroy() { super.onDestroy(); MMoviesApp.get().getState().unregisterForEvents(this); }
public MovieImagesPresenter() { super(); MMoviesApp.get().getState().registerForEvents(this); }