use of app.philm.in.model.WatchingMovie in project philm by chrisbanes.
the class MainController method populateUi.
private void populateUi(SideMenuUi ui) {
ui.setSideMenuItems(getEnabledSideMenuItems(), mState.getSelectedSideMenuItem());
PhilmUserProfile profile = mState.getUserProfile();
if (profile != null) {
ui.showUserProfile(profile);
} else {
ui.showAddAccountButton();
}
WatchingMovie checkin = mState.getWatchingMovie();
if (checkin != null) {
ui.showMovieCheckin(checkin);
} else {
ui.hideMovieCheckin();
}
}
use of app.philm.in.model.WatchingMovie in project philm by chrisbanes.
the class MovieController method onMovieWatchingChanged.
@Subscribe
public void onMovieWatchingChanged(MoviesState.WatchingMovieUpdatedEvent event) {
WatchingMovie watching = mMoviesState.getWatchingMovie();
if (watching != null && watching.movie != null) {
fetchDetailMovieIfNeeded(0, watching.movie.getImdbId());
}
populateUiFromQueryType(MovieQueryType.MOVIE_DETAIL);
}
use of app.philm.in.model.WatchingMovie in project philm by chrisbanes.
the class CheckinTraktRunnable method onSuccess.
@Override
public void onSuccess(CheckinResponse result) {
if (RESULT_TRAKT_SUCCESS.equals(result.status)) {
PhilmMovie movie = getTraktMovieEntityMapper().map(result.movie);
if (movie != null) {
long startTime = 0;
int duration = 0;
if (result.timestamps != null) {
startTime = result.timestamps.start.getTime();
duration = result.timestamps.active_for * 1000;
}
WatchingMovie watchingMovie = new WatchingMovie(movie, WatchingMovie.Type.CHECKIN, startTime, duration);
mMoviesState.setWatchingMovie(watchingMovie);
}
} else if (RESULT_TRAKT_FAILURE.equals(result.status)) {
// TODO Check time out, etc
}
}
use of app.philm.in.model.WatchingMovie in project philm by chrisbanes.
the class FetchTraktWatchingRunnable method onSuccess.
@Override
public void onSuccess(WatchingBase result) {
if (result.type == ActivityType.Movie && WatchingMovie.validAction(result.action)) {
PhilmMovie movie = getTraktMovieEntityMapper().map(result.movie);
if (movie != null) {
// TODO Fix timestamps
WatchingMovie watching = new WatchingMovie(movie, WatchingMovie.from(result.action), 0, 0);
mMoviesState.setWatchingMovie(watching);
}
}
}
use of app.philm.in.model.WatchingMovie in project philm by chrisbanes.
the class MainController method createUiCallbacks.
@Override
protected MainControllerUiCallbacks createUiCallbacks(final MainControllerUi ui) {
return new MainControllerUiCallbacks() {
@Override
public void onSideMenuItemSelected(SideMenuItem item) {
Display display = getDisplay();
if (display != null) {
showUiItem(display, item);
display.closeDrawerLayout();
}
}
@Override
public void addAccountRequested() {
Display display = getDisplay();
if (display != null) {
display.startAddAccountActivity();
display.closeDrawerLayout();
}
}
@Override
public void showMovieCheckin() {
Display display = getDisplay();
WatchingMovie checkin = mState.getWatchingMovie();
if (display != null && checkin != null) {
display.closeDrawerLayout();
display.startMovieDetailActivity(checkin.movie.getImdbId(), null);
}
}
@Override
public void setShownLoginPrompt() {
mPreferences.setShownTraktLoginPrompt();
}
};
}
Aggregations