com.facebook.model.GraphUser Java Examples
The following examples show how to use
com.facebook.model.GraphUser.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: UserSettingsFragment.java From HypFacebook with BSD 2-Clause "Simplified" License | 6 votes |
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; } }
Example #2
Source File: FragmentSocialTimeline.java From aptoide-client with GNU General Public License v2.0 | 6 votes |
private void startLogin(GraphUser user, Session session) { try { loginMode = true; Fragment fragment = new FragmentSignIn(); Bundle args = new Bundle(); args.putInt(FragmentSignIn.LOGIN_MODE_ARG, LoginActivity.Mode.FACEBOOK.ordinal()); args.putString(FragmentSignIn.LOGIN_PASSWORD_OR_TOKEN_ARG, session.getAccessToken()); args.putString(FragmentSignIn.LOGIN_USERNAME_ARG, (String) user.getProperty("email")); fragment.setArguments(args); getChildFragmentManager().beginTransaction().replace(R.id.fragment_container, fragment, "tag").setTransition(FragmentTransaction.TRANSIT_FRAGMENT_FADE).commit(); Analytics.SocialTimeline.login(); } catch (Exception e) { e.printStackTrace(); } }
Example #3
Source File: UserSettingsFragment.java From platform-friends-android with BSD 2-Clause "Simplified" License | 6 votes |
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; } }
Example #4
Source File: FriendPickerFragment.java From Klyph with MIT License | 6 votes |
@Override protected void onLoadFinished(GraphObjectPagingLoader<GraphUser> loader, SimpleGraphObjectCursor<GraphUser> data) { super.onLoadFinished(loader, data); // We could be called in this state if we are clearing data or if we are being re-attached // in the middle of a query. if (data == null || loader.isLoading()) { return; } if (data.areMoreObjectsAvailable()) { // We got results, but more are available. followNextLink(); } else { // We finished loading results. hideActivityCircle(); // If this was from the cache, schedule a delayed refresh query (unless we got no results // at all, in which case refresh immediately. if (data.isFromCache()) { loader.refreshOriginalRequest(data.getCount() == 0 ? CACHED_RESULT_REFRESH_DELAY : 0); } } }
Example #5
Source File: FriendPickerFragment.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 6 votes |
@Override PickerFragmentAdapter<GraphUser> createAdapter() { PickerFragmentAdapter<GraphUser> adapter = new PickerFragmentAdapter<GraphUser>( this.getActivity()) { @Override protected int getGraphObjectRowLayoutId(GraphUser graphObject) { return R.layout.com_facebook_picker_list_row; } @Override protected int getDefaultPicture() { return R.drawable.com_facebook_profile_default_icon; } }; adapter.setShowCheckbox(true); adapter.setShowPicture(getShowPictures()); adapter.setSortFields(Arrays.asList(new String[]{NAME})); adapter.setGroupByField(NAME); return adapter; }
Example #6
Source File: FriendPickerFragment.java From KlyphMessenger with MIT License | 6 votes |
@Override protected void onLoadFinished(GraphObjectPagingLoader<GraphUser> loader, SimpleGraphObjectCursor<GraphUser> data) { super.onLoadFinished(loader, data); // We could be called in this state if we are clearing data or if we are being re-attached // in the middle of a query. if (data == null || loader.isLoading()) { return; } if (data.areMoreObjectsAvailable()) { // We got results, but more are available. followNextLink(); } else { // We finished loading results. hideActivityCircle(); // If this was from the cache, schedule a delayed refresh query (unless we got no results // at all, in which case refresh immediately. if (data.isFromCache()) { loader.refreshOriginalRequest(data.getCount() == 0 ? CACHED_RESULT_REFRESH_DELAY : 0); } } }
Example #7
Source File: FriendPickerFragment.java From facebook-api-android-maven with Apache License 2.0 | 6 votes |
@Override PickerFragmentAdapter<GraphUser> createAdapter() { PickerFragmentAdapter<GraphUser> adapter = new PickerFragmentAdapter<GraphUser>( this.getActivity()) { @Override protected int getGraphObjectRowLayoutId(GraphUser graphObject) { return R.layout.com_facebook_picker_list_row; } @Override protected int getDefaultPicture() { return R.drawable.com_facebook_profile_default_icon; } }; adapter.setShowCheckbox(true); adapter.setShowPicture(getShowPictures()); adapter.setSortFields(Arrays.asList(new String[]{NAME})); adapter.setGroupByField(NAME); return adapter; }
Example #8
Source File: HelloFacebookSampleActivity.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 6 votes |
private void onFriendPickerDone(FriendPickerFragment fragment) { FragmentManager fm = getSupportFragmentManager(); fm.popBackStack(); String results = ""; Collection<GraphUser> selection = fragment.getSelection(); if (selection != null && selection.size() > 0) { ArrayList<String> names = new ArrayList<String>(); for (GraphUser user : selection) { names.add(user.getName()); } results = TextUtils.join(", ", names); } else { results = getString(R.string.no_friends_selected); } showAlert(getString(R.string.you_picked), results); }
Example #9
Source File: UserSettingsFragment.java From Klyph with MIT License | 6 votes |
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; } }
Example #10
Source File: FriendPickerFragment.java From Klyph with MIT License | 6 votes |
@Override PickerFragmentAdapter<GraphUser> createAdapter() { PickerFragmentAdapter<GraphUser> adapter = new PickerFragmentAdapter<GraphUser>( this.getActivity()) { @Override protected int getGraphObjectRowLayoutId(GraphUser graphObject) { return R.layout.com_facebook_picker_list_row; } @Override protected int getDefaultPicture() { return R.drawable.com_facebook_profile_default_icon; } }; adapter.setShowCheckbox(true); adapter.setShowPicture(getShowPictures()); adapter.setSortFields(Arrays.asList(new String[]{NAME})); adapter.setGroupByField(NAME); return adapter; }
Example #11
Source File: UserSettingsFragment.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 6 votes |
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; } }
Example #12
Source File: FriendPickerFragment.java From barterli_android with Apache License 2.0 | 6 votes |
@Override PickerFragmentAdapter<GraphUser> createAdapter() { PickerFragmentAdapter<GraphUser> adapter = new PickerFragmentAdapter<GraphUser>( this.getActivity()) { @Override protected int getGraphObjectRowLayoutId(GraphUser graphObject) { return R.layout.com_facebook_picker_list_row; } @Override protected int getDefaultPicture() { return R.drawable.com_facebook_profile_default_icon; } }; adapter.setShowCheckbox(true); adapter.setShowPicture(getShowPictures()); adapter.setSortFields(Arrays.asList(new String[]{NAME})); adapter.setGroupByField(NAME); return adapter; }
Example #13
Source File: FriendPickerFragment.java From barterli_android with Apache License 2.0 | 6 votes |
@Override protected void onLoadFinished(GraphObjectPagingLoader<GraphUser> loader, SimpleGraphObjectCursor<GraphUser> data) { super.onLoadFinished(loader, data); // We could be called in this state if we are clearing data or if we are being re-attached // in the middle of a query. if (data == null || loader.isLoading()) { return; } if (data.areMoreObjectsAvailable()) { // We got results, but more are available. followNextLink(); } else { // We finished loading results. hideActivityCircle(); // If this was from the cache, schedule a delayed refresh query (unless we got no results // at all, in which case refresh immediately. if (data.isFromCache()) { loader.refreshOriginalRequest(data.getCount() == 0 ? CACHED_RESULT_REFRESH_DELAY : 0); } } }
Example #14
Source File: FriendPickerFragment.java From Abelana-Android with Apache License 2.0 | 6 votes |
@Override protected void onLoadFinished(GraphObjectPagingLoader<GraphUser> loader, SimpleGraphObjectCursor<GraphUser> data) { super.onLoadFinished(loader, data); // We could be called in this state if we are clearing data or if we are being re-attached // in the middle of a query. if (data == null || loader.isLoading()) { return; } if (data.areMoreObjectsAvailable()) { // We got results, but more are available. followNextLink(); } else { // We finished loading results. hideActivityCircle(); // If this was from the cache, schedule a delayed refresh query (unless we got no results // at all, in which case refresh immediately. if (data.isFromCache()) { loader.refreshOriginalRequest(data.getCount() == 0 ? CACHED_RESULT_REFRESH_DELAY : 0); } } }
Example #15
Source File: FriendPickerFragment.java From HypFacebook with BSD 2-Clause "Simplified" License | 6 votes |
@Override PickerFragmentAdapter<GraphUser> createAdapter() { PickerFragmentAdapter<GraphUser> adapter = new PickerFragmentAdapter<GraphUser>( this.getActivity()) { @Override protected int getGraphObjectRowLayoutId(GraphUser graphObject) { return ::APP_PACKAGE::.R.layout.com_facebook_picker_list_row; } @Override protected int getDefaultPicture() { return ::APP_PACKAGE::.R.drawable.com_facebook_profile_default_icon; } }; adapter.setShowCheckbox(true); adapter.setShowPicture(getShowPictures()); adapter.setSortFields(Arrays.asList(new String[]{NAME})); adapter.setGroupByField(NAME); return adapter; }
Example #16
Source File: FriendPickerFragment.java From Abelana-Android with Apache License 2.0 | 6 votes |
@Override PickerFragmentAdapter<GraphUser> createAdapter() { PickerFragmentAdapter<GraphUser> adapter = new PickerFragmentAdapter<GraphUser>( this.getActivity()) { @Override protected int getGraphObjectRowLayoutId(GraphUser graphObject) { return R.layout.com_facebook_picker_list_row; } @Override protected int getDefaultPicture() { return R.drawable.com_facebook_profile_default_icon; } }; adapter.setShowCheckbox(true); adapter.setShowPicture(getShowPictures()); adapter.setSortFields(Arrays.asList(new String[]{NAME})); adapter.setGroupByField(NAME); return adapter; }
Example #17
Source File: FriendPickerFragment.java From android-skeleton-project with MIT License | 6 votes |
@Override PickerFragmentAdapter<GraphUser> createAdapter() { PickerFragmentAdapter<GraphUser> adapter = new PickerFragmentAdapter<GraphUser>( this.getActivity()) { @Override protected int getGraphObjectRowLayoutId(GraphUser graphObject) { return R.layout.com_facebook_picker_list_row; } @Override protected int getDefaultPicture() { return R.drawable.com_facebook_profile_default_icon; } }; adapter.setShowCheckbox(true); adapter.setShowPicture(getShowPictures()); adapter.setSortFields(Arrays.asList(new String[]{NAME})); adapter.setGroupByField(NAME); return adapter; }
Example #18
Source File: FriendPickerFragment.java From android-skeleton-project with MIT License | 6 votes |
@Override protected void onLoadFinished(GraphObjectPagingLoader<GraphUser> loader, SimpleGraphObjectCursor<GraphUser> data) { super.onLoadFinished(loader, data); // We could be called in this state if we are clearing data or if we are being re-attached // in the middle of a query. if (data == null || loader.isLoading()) { return; } if (data.areMoreObjectsAvailable()) { // We got results, but more are available. followNextLink(); } else { // We finished loading results. hideActivityCircle(); // If this was from the cache, schedule a delayed refresh query (unless we got no results // at all, in which case refresh immediately. if (data.isFromCache()) { loader.refreshOriginalRequest(data.getCount() == 0 ? CACHED_RESULT_REFRESH_DELAY : 0); } } }
Example #19
Source File: SettingsFragment.java From FacebookNewsfeedSample-Android with Apache License 2.0 | 6 votes |
public void updateViewForUser(GraphUser user) { if (slotManager == null) { // Fragment has not had onCreate called yet. return; } if (user != null) { Slot s = slotManager.getSelectedSlot(); if (s != null) { s.update(user); } } else { // If the user is null, then there isn't an actively selected // user. This can happen if the user cancelled a login. So make sure that // SlotManager is updated properly. slotManager.setSelectedSlotNumber(SlotManager.NO_SLOT); } updateListView(); }
Example #20
Source File: UserSettingsFragment.java From FacebookImageShareIntent with MIT License | 6 votes |
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; } }
Example #21
Source File: FriendPickerFragment.java From facebook-api-android-maven with Apache License 2.0 | 6 votes |
@Override protected void onLoadFinished(GraphObjectPagingLoader<GraphUser> loader, SimpleGraphObjectCursor<GraphUser> data) { super.onLoadFinished(loader, data); // We could be called in this state if we are clearing data or if we are being re-attached // in the middle of a query. if (data == null || loader.isLoading()) { return; } if (data.areMoreObjectsAvailable()) { // We got results, but more are available. followNextLink(); } else { // We finished loading results. hideActivityCircle(); // If this was from the cache, schedule a delayed refresh query (unless we got no results // at all, in which case refresh immediately. if (data.isFromCache()) { loader.refreshOriginalRequest(data.getCount() == 0 ? CACHED_RESULT_REFRESH_DELAY : 0); } } }
Example #22
Source File: FacebookContactMatcher.java From buddycloud-android with Apache License 2.0 | 6 votes |
private void matchContacts(final Context context, final GraphUser user, Response response, final ModelCallback<JSONArray> callback) { JSONArray friends = response.getGraphObject() .getInnerJSONObject().optJSONArray("data"); JSONArray friendsHashes = new JSONArray(); for (int i = 0; i < friends.length(); i++) { String friendId = friends.optString(i, "id"); String friendHash = ContactMatcherUtils.hash(NAME, friendId); friendsHashes.put(friendHash); } JSONArray myHashes = new JSONArray(); myHashes.put(user.getId()); ContactMatcherUtils.reportToFriendFinder(context, callback, friendsHashes, myHashes); }
Example #23
Source File: BatchRequestTests.java From FacebookImageShareIntent with MIT License | 6 votes |
@LargeTest public void testTwoDifferentAccessTokens() { TestSession session1 = openTestSessionWithSharedUser(); TestSession session2 = openTestSessionWithSharedUser(SECOND_TEST_USER_TAG); Request request1 = Request.newMeRequest(session1, null); Request request2 = Request.newMeRequest(session2, null); List<Response> responses = Request.executeBatchAndWait(request1, request2); assertNotNull(responses); assertEquals(2, responses.size()); GraphUser user1 = responses.get(0).getGraphObjectAs(GraphUser.class); GraphUser user2 = responses.get(1).getGraphObjectAs(GraphUser.class); assertNotNull(user1); assertNotNull(user2); assertFalse(user1.getId().equals(user2.getId())); assertEquals(session1.getTestUserId(), user1.getId()); assertEquals(session2.getTestUserId(), user2.getId()); }
Example #24
Source File: BatchRequestTests.java From FacebookImageShareIntent with MIT License | 6 votes |
@LargeTest public void testBatchWithValidSessionAndNoSession() { TestSession session = openTestSessionWithSharedUser(); Request request1 = new Request(session, "me"); Request request2 = new Request(null, "me"); List<Response> responses = Request.executeBatchAndWait(request1, request2); assertNotNull(responses); assertEquals(2, responses.size()); GraphUser user1 = responses.get(0).getGraphObjectAs(GraphUser.class); GraphUser user2 = responses.get(1).getGraphObjectAs(GraphUser.class); assertNotNull(user1); assertNull(user2); assertEquals(session.getTestUserId(), user1.getId()); }
Example #25
Source File: BatchRequestTests.java From FacebookImageShareIntent with MIT License | 6 votes |
@LargeTest public void testBatchWithNoSessionAndValidSession() { TestSession session = openTestSessionWithSharedUser(); Request request1 = new Request(null, "me"); Request request2 = new Request(session, "me"); List<Response> responses = Request.executeBatchAndWait(request1, request2); assertNotNull(responses); assertEquals(2, responses.size()); GraphUser user1 = responses.get(0).getGraphObjectAs(GraphUser.class); GraphUser user2 = responses.get(1).getGraphObjectAs(GraphUser.class); assertNull(user1); assertNotNull(user2); assertEquals(session.getTestUserId(), user2.getId()); }
Example #26
Source File: BatchRequestTests.java From FacebookImageShareIntent with MIT License | 6 votes |
@LargeTest public void testBatchWithTwoSessionlessRequestsAndDefaultAppID() { TestSession session = getTestSessionWithSharedUser(null); String appId = session.getApplicationId(); Request.setDefaultBatchApplicationId(appId); Request request1 = new Request(null, "me"); Request request2 = new Request(null, "me"); List<Response> responses = Request.executeBatchAndWait(request1, request2); assertNotNull(responses); assertEquals(2, responses.size()); GraphUser user1 = responses.get(0).getGraphObjectAs(GraphUser.class); GraphUser user2 = responses.get(1).getGraphObjectAs(GraphUser.class); assertNull(user1); assertNull(user2); }
Example #27
Source File: UserSettingsFragment.java From facebook-api-android-maven with Apache License 2.0 | 6 votes |
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; } }
Example #28
Source File: FriendPickerFragment.java From aws-mobile-self-paced-labs-samples with Apache License 2.0 | 6 votes |
@Override PickerFragmentAdapter<GraphUser> createAdapter() { PickerFragmentAdapter<GraphUser> adapter = new PickerFragmentAdapter<GraphUser>( this.getActivity()) { @Override protected int getGraphObjectRowLayoutId(GraphUser graphObject) { return R.layout.com_facebook_picker_list_row; } @Override protected int getDefaultPicture() { return R.drawable.com_facebook_profile_default_icon; } }; adapter.setShowCheckbox(true); adapter.setShowPicture(getShowPictures()); adapter.setSortFields(Arrays.asList(new String[]{NAME})); adapter.setGroupByField(NAME); return adapter; }
Example #29
Source File: FriendPickerFragment.java From aws-mobile-self-paced-labs-samples with Apache License 2.0 | 6 votes |
@Override protected void onLoadFinished(GraphObjectPagingLoader<GraphUser> loader, SimpleGraphObjectCursor<GraphUser> data) { super.onLoadFinished(loader, data); // We could be called in this state if we are clearing data or if we are being re-attached // in the middle of a query. if (data == null || loader.isLoading()) { return; } if (data.areMoreObjectsAvailable()) { // We got results, but more are available. followNextLink(); } else { // We finished loading results. hideActivityCircle(); // If this was from the cache, schedule a delayed refresh query (unless we got no results // at all, in which case refresh immediately. if (data.isFromCache()) { loader.refreshOriginalRequest(data.getCount() == 0 ? CACHED_RESULT_REFRESH_DELAY : 0); } } }
Example #30
Source File: LoginActivity.java From aws-mobile-self-paced-labs-samples with Apache License 2.0 | 6 votes |
@Override public void call(Session session, SessionState state, Exception exception) { if (session.isOpened()) { setFacebookSession(session); // make request to the /me API Request.newMeRequest(session, new Request.GraphUserCallback() { // callback after Graph API response with user object @Override public void onCompleted(GraphUser user, Response response) { if (user != null) { Toast.makeText(LoginActivity.this, "Hello " + user.getName(), Toast.LENGTH_LONG) .show(); } } }).executeAsync(); } }