use of com.facebook.model.GraphUser in project Klyph by jonathangerbaud.
the class UserSettingsFragment method fetchUserInfo.
private void fetchUserInfo() {
final Session currentSession = getSession();
if (currentSession != null && currentSession.isOpened()) {
if (currentSession != userInfoSession) {
Request request = Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser me, Response response) {
if (currentSession == getSession()) {
user = me;
updateUI();
}
if (response.getError() != null) {
loginButton.handleError(response.getError().getException());
}
}
});
Bundle parameters = new Bundle();
parameters.putString(FIELDS, REQUEST_FIELDS);
request.setParameters(parameters);
Request.executeBatchAsync(request);
userInfoSession = currentSession;
}
} else {
user = null;
}
}
use of com.facebook.model.GraphUser in project Klyph by jonathangerbaud.
the class LoginFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.fragment_login, container, false);
authButton = (LoginButton) view.findViewById(R.id.authButton);
progressBar = (ProgressBar) view.findViewById(R.id.progressBar);
TextView tv = (TextView) view.findViewById(R.id.app_name_textview);
tv.setText(KlyphFlags.IS_PRO_VERSION == true ? R.string.app_pro_large_name : R.string.app_large_name);
TextView version = (TextView) view.findViewById(R.id.version);
version.setText(getString(R.string.about_version, ApplicationUtil.getAppVersion(getActivity())));
authButton.setReadPermissions(Arrays.asList("read_stream", "friends_about_me", "friends_work_history", "friends_activities", "friends_birthday", "user_checkins", "friends_checkins", "user_education_history", "friends_education_history", "user_events", "friends_events", "user_groups", "friends_groups", "user_hometown", "friends_hometown", "user_interests", "friends_interests", "user_likes", "friends_likes", "user_notes", "friends_notes", "user_online_presence", "friends_online_presence", "user_interests", "friends_interests", "user_likes", "friends_likes", "user_notes", "friends_notes", "user_online_presence", "friends_online_presence", "user_religion_politics", "friends_religion_politics", "user_status", "friends_status", "user_subscriptions", "friends_subscriptions", "user_videos", "friends_videos", "user_website", "friends_website", "user_work_history", "friends_work_history", "read_friendlists", "read_mailbox", "read_requests", "read_stream", "xmpp_login", "email", "user_location", "user_photos", "friends_photos"));
authButton.setUserInfoChangedCallback(new LoginButton.UserInfoChangedCallback() {
@Override
public void onUserInfoFetched(GraphUser user) {
Log.d("LoginFragment", "onUserInfoFetched ");
if (Session.getActiveSession().isOpened() && user != null) {
Log.d("LoginFragment", "onUserInfoFetched2 ");
User u = new User();
u.setUid(user.getId());
u.setName(user.getName());
u.setFirst_name(user.getFirstName());
u.setMiddle_name(user.getMiddleName());
u.setLast_name(user.getLastName());
u.setBirthday(user.getBirthday());
u.setEmail((String) user.getProperty("email"));
u.setSex((String) user.getProperty("gender"));
// u.setIn((String)
// user.getProperty("interested_in"));
u.setLocale((String) user.getProperty("locale"));
u.setRelationship_status((String) user.getProperty("relationship_status"));
u.setUsername((String) user.getProperty("username"));
try {
u.setTimezone(((Double) user.getProperty("timezone")).intValue());
} catch (Exception e) {
}
KlyphSession.setSessionUser(u);
if (getActivity() != null) {
((LoginFragmentCallBack) getActivity()).onUserInfoFetched(u);
}
}
}
});
authButton.setFragment(this);
return view;
}
use of com.facebook.model.GraphUser in project facebook-api-android-maven by avianey.
the class TestSession method populateTestAccounts.
private static synchronized void populateTestAccounts(Collection<TestAccount> testAccounts, GraphObject userAccountsMap) {
for (TestAccount testAccount : testAccounts) {
GraphUser testUser = userAccountsMap.getPropertyAs(testAccount.getId(), GraphUser.class);
testAccount.setName(testUser.getName());
storeTestAccount(testAccount);
}
}
use of com.facebook.model.GraphUser in project facebook-api-android-maven by avianey.
the class UserSettingsFragment method fetchUserInfo.
private void fetchUserInfo() {
final Session currentSession = getSession();
if (currentSession != null && currentSession.isOpened()) {
if (currentSession != userInfoSession) {
Request request = Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser me, Response response) {
if (currentSession == getSession()) {
user = me;
updateUI();
}
if (response.getError() != null) {
loginButton.handleError(response.getError().getException());
}
}
});
Bundle parameters = new Bundle();
parameters.putString(FIELDS, REQUEST_FIELDS);
request.setParameters(parameters);
Request.executeBatchAsync(request);
userInfoSession = currentSession;
}
} else {
user = null;
}
}
use of com.facebook.model.GraphUser in project phonegap-facebook-plugin by Wizcorp.
the class UserSettingsFragment method fetchUserInfo.
private void fetchUserInfo() {
final Session currentSession = getSession();
if (currentSession != null && currentSession.isOpened()) {
if (currentSession != userInfoSession) {
Request request = Request.newMeRequest(currentSession, new Request.GraphUserCallback() {
@Override
public void onCompleted(GraphUser me, Response response) {
if (currentSession == getSession()) {
user = me;
updateUI();
}
if (response.getError() != null) {
loginButton.handleError(response.getError().getException());
}
}
});
Bundle parameters = new Bundle();
parameters.putString(FIELDS, REQUEST_FIELDS);
request.setParameters(parameters);
Request.executeBatchAsync(request);
userInfoSession = currentSession;
}
} else {
user = null;
}
}
Aggregations