Search in sources :

Example 1 with WatchingMovie

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();
    }
}
Also used : WatchingMovie(app.philm.in.model.WatchingMovie) PhilmUserProfile(app.philm.in.model.PhilmUserProfile)

Example 2 with WatchingMovie

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);
}
Also used : WatchingMovie(app.philm.in.model.WatchingMovie) Subscribe(com.squareup.otto.Subscribe)

Example 3 with WatchingMovie

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
    }
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) WatchingMovie(app.philm.in.model.WatchingMovie)

Example 4 with WatchingMovie

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);
        }
    }
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) WatchingMovie(app.philm.in.model.WatchingMovie)

Example 5 with WatchingMovie

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();
        }
    };
}
Also used : WatchingMovie(app.philm.in.model.WatchingMovie) Display(app.philm.in.Display)

Aggregations

WatchingMovie (app.philm.in.model.WatchingMovie)5 PhilmMovie (app.philm.in.model.PhilmMovie)2 Display (app.philm.in.Display)1 PhilmUserProfile (app.philm.in.model.PhilmUserProfile)1 Subscribe (com.squareup.otto.Subscribe)1