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()));
}
}
}
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();
}
}
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());
}
Aggregations