Search in sources :

Example 1 with PhilmUserProfile

use of app.philm.in.model.PhilmUserProfile in project philm by chrisbanes.

the class MovieController method populateCheckinUi.

private void populateCheckinUi(MovieCheckinUi ui) {
    final PhilmMovie movie = mMoviesState.getMovie(ui.getRequestParameter());
    final PhilmUserProfile userProfile = mMoviesState.getUserProfile();
    if (movie != null) {
        ui.setMovie(movie);
        ui.showFacebookShare(userProfile != null && userProfile.isFacebookConnected());
        ui.showTwitterShare(userProfile != null && userProfile.isTwitterConnected());
        ui.showTumblrShare(userProfile != null && userProfile.isTumblrConnected());
        ui.showPathShare(userProfile != null && userProfile.isPathConnected());
        if (userProfile != null && userProfile.getDefaultShareMessage() != null) {
            ui.setShareText(userProfile.getDefaultShareMessage().replace(Constants.TRAKT_MESSAGE_ITEM_REPLACE, movie.getTitle()));
        }
    }
}
Also used : PhilmMovie(app.philm.in.model.PhilmMovie) PhilmUserProfile(app.philm.in.model.PhilmUserProfile)

Example 2 with PhilmUserProfile

use of app.philm.in.model.PhilmUserProfile 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 3 with PhilmUserProfile

use of app.philm.in.model.PhilmUserProfile in project philm by chrisbanes.

the class UserController method onAccountChanged.

@Subscribe
public void onAccountChanged(UserState.AccountChangedEvent event) {
    PhilmAccount currentAccount = mUserState.getCurrentAccount();
    if (currentAccount != null) {
        final String username = currentAccount.getAccountName();
        mUserState.setUsername(username);
        mTraktClient.setAuthentication(username, currentAccount.getPassword());
        mDbHelper.getUserProfile(username, new UserProfileDbLoadCallback());
    } else {
        mUserState.setUsername(null);
        mTraktClient.setAuthentication(null, null);
        final PhilmUserProfile currentUserProfile = mUserState.getUserProfile();
        if (currentUserProfile != null) {
            mUserState.setUserProfile(null);
            mDbHelper.delete(currentUserProfile);
        }
    // TODO: Also nuke rest of state
    }
    mLogger.d(LOG_TAG, "onAccountChanged: " + mUserState.getUsername());
}
Also used : PhilmUserProfile(app.philm.in.model.PhilmUserProfile) PhilmAccount(app.philm.in.model.PhilmAccount) Subscribe(com.squareup.otto.Subscribe)

Aggregations

PhilmUserProfile (app.philm.in.model.PhilmUserProfile)3 PhilmAccount (app.philm.in.model.PhilmAccount)1 PhilmMovie (app.philm.in.model.PhilmMovie)1 WatchingMovie (app.philm.in.model.WatchingMovie)1 Subscribe (com.squareup.otto.Subscribe)1