本文整理匯總了Java中com.facebook.model.GraphPlace類的典型用法代碼示例。如果您正苦於以下問題:Java GraphPlace類的具體用法?Java GraphPlace怎麽用?Java GraphPlace使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
GraphPlace類屬於com.facebook.model包,在下文中一共展示了GraphPlace類的12個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: onLoadFinished
import com.facebook.model.GraphPlace; //導入依賴的package包/類
@Override
protected void onLoadFinished(GraphObjectPagingLoader<GraphPlace> loader,
SimpleGraphObjectCursor<GraphPlace> 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;
}
hideActivityCircle();
if (data.isFromCache()) {
// Only the first page can be cached, since all subsequent pages will be round-tripped. Force
// a refresh of the first page before we allow paging to begin. If the first page produced
// no data, launch the refresh immediately, otherwise schedule it for later.
loader.refreshOriginalRequest(data.areMoreObjectsAvailable() ? CACHED_RESULT_REFRESH_DELAY : 0);
}
}
示例2: onPlacePickerDone
import com.facebook.model.GraphPlace; //導入依賴的package包/類
private void onPlacePickerDone(PlacePickerFragment fragment) {
FragmentManager fm = getSupportFragmentManager();
fm.popBackStack();
String result = "";
GraphPlace selection = fragment.getSelection();
if (selection != null) {
result = selection.getName();
} else {
result = getString(R.string.no_place_selected);
}
place = selection;
showAlert(getString(R.string.you_picked), result);
}
示例3: newStatusUpdateRequest
import com.facebook.model.GraphPlace; //導入依賴的package包/類
public static Request newStatusUpdateRequest(Session paramSession, String paramString, GraphPlace paramGraphPlace, List<GraphUser> paramList, Callback paramCallback)
{
ArrayList localArrayList = null;
if (paramList != null)
{
localArrayList = new ArrayList(paramList.size());
Iterator localIterator = paramList.iterator();
while (localIterator.hasNext())
localArrayList.add(((GraphUser)localIterator.next()).getId());
}
String str;
if (paramGraphPlace == null)
str = null;
else
str = paramGraphPlace.getId();
return newStatusUpdateRequest(paramSession, paramString, str, localArrayList, paramCallback);
}
示例4: testExecuteSingleGetUsingHttpURLConnection
import com.facebook.model.GraphPlace; //導入依賴的package包/類
@MediumTest
@LargeTest
public void testExecuteSingleGetUsingHttpURLConnection() {
Request request = new Request(null, "TourEiffel", null, null, new ExpectSuccessCallback() {
@Override
protected void performAsserts(Response response) {
assertNotNull(response);
GraphPlace graphPlace = response.getGraphObjectAs(GraphPlace.class);
assertEquals("Paris", graphPlace.getLocation().getCity());
}
});
HttpURLConnection connection = Request.toHttpConnection(request);
TestRequestAsyncTask task = new TestRequestAsyncTask(connection, Arrays.asList(new Request[] { request }));
task.executeOnBlockerThread();
// Wait on 2 signals: request and task will both signal.
waitAndAssertSuccess(2);
}
示例5: testExecuteSingleGet
import com.facebook.model.GraphPlace; //導入依賴的package包/類
@MediumTest
@LargeTest
public void testExecuteSingleGet() {
final TestSession session = openTestSessionWithSharedUser();
Request request = new Request(session, "TourEiffel", null, null, new ExpectSuccessCallback() {
@Override
protected void performAsserts(Response response) {
assertNotNull(response);
GraphPlace graphPlace = response.getGraphObjectAs(GraphPlace.class);
assertEquals("Paris", graphPlace.getLocation().getCity());
}
});
TestRequestAsyncTask task = new TestRequestAsyncTask(request);
task.executeOnBlockerThread();
// Wait on 2 signals: request and task will both signal.
waitAndAssertSuccess(2);
}
示例6: onLoadFinished
import com.facebook.model.GraphPlace; //導入依賴的package包/類
protected void onLoadFinished(GraphObjectPagingLoader<GraphPlace> paramGraphObjectPagingLoader, SimpleGraphObjectCursor<GraphPlace> paramSimpleGraphObjectCursor)
{
super.onLoadFinished(paramGraphObjectPagingLoader, paramSimpleGraphObjectCursor);
if ((paramSimpleGraphObjectCursor == null) || (paramGraphObjectPagingLoader.isLoading()))
return;
PlacePickerFragment.this.hideActivityCircle();
if (paramSimpleGraphObjectCursor.isFromCache())
{
long l;
if (paramSimpleGraphObjectCursor.areMoreObjectsAvailable())
l = 2000L;
else
l = 0L;
paramGraphObjectPagingLoader.refreshOriginalRequest(l);
}
}
示例7: testExecuteSingleGetUsingHttpURLConnection
import com.facebook.model.GraphPlace; //導入依賴的package包/類
@MediumTest
@LargeTest
public void testExecuteSingleGetUsingHttpURLConnection() {
final TestSession session = openTestSessionWithSharedUser();
Request request = new Request(session, "TourEiffel", null, null, new ExpectSuccessCallback() {
@Override
protected void performAsserts(Response response) {
assertNotNull(response);
GraphPlace graphPlace = response.getGraphObjectAs(GraphPlace.class);
assertEquals("Paris", graphPlace.getLocation().getCity());
}
});
HttpURLConnection connection = Request.toHttpConnection(request);
TestRequestAsyncTask task = new TestRequestAsyncTask(connection, Arrays.asList(new Request[] { request }));
task.executeOnBlockerThread();
// Wait on 2 signals: request and task will both signal.
waitAndAssertSuccess(2);
}
示例8: testExecuteBatchedGets
import com.facebook.model.GraphPlace; //導入依賴的package包/類
@MediumTest
@LargeTest
public void testExecuteBatchedGets() throws IOException {
TestSession session = openTestSessionWithSharedUser();
Request request1 = new Request(session, "TourEiffel");
Request request2 = new Request(session, "SpaceNeedle");
List<Response> responses = Request.executeBatchAndWait(request1, request2);
assertEquals(2, responses.size());
assertTrue(responses.get(0).getError() == null);
assertTrue(responses.get(1).getError() == null);
GraphPlace eiffelTower = responses.get(0).getGraphObjectAs(GraphPlace.class);
GraphPlace spaceNeedle = responses.get(1).getGraphObjectAs(GraphPlace.class);
assertTrue(eiffelTower != null);
assertTrue(spaceNeedle != null);
assertEquals("Paris", eiffelTower.getLocation().getCity());
assertEquals("Seattle", spaceNeedle.getLocation().getCity());
}
示例9: testExecuteBatchRequestsPathEncoding
import com.facebook.model.GraphPlace; //導入依賴的package包/類
@MediumTest
@LargeTest
public void testExecuteBatchRequestsPathEncoding() throws IOException {
// ensures that paths passed to batch requests are encoded properly before
// we send it up to the server
setBatchApplicationIdForTestApp();
Request request1 = new Request(null, "TourEiffel");
request1.setBatchEntryName("eiffel");
request1.setBatchEntryOmitResultOnSuccess(false);
Request request2 = new Request(null, "{result=eiffel:$.id}");
List<Response> responses = Request.executeBatchAndWait(request1, request2);
assertEquals(2, responses.size());
assertTrue(responses.get(0).getError() == null);
assertTrue(responses.get(1).getError() == null);
GraphPlace eiffelTower1 = responses.get(0).getGraphObjectAs(GraphPlace.class);
GraphPlace eiffelTower2 = responses.get(1).getGraphObjectAs(GraphPlace.class);
assertTrue(eiffelTower1 != null);
assertTrue(eiffelTower2 != null);
assertEquals("Paris", eiffelTower1.getLocation().getCity());
assertEquals("Paris", eiffelTower2.getLocation().getCity());
}
示例10: testExecuteBatchedGets
import com.facebook.model.GraphPlace; //導入依賴的package包/類
@MediumTest
@LargeTest
public void testExecuteBatchedGets() throws IOException {
setBatchApplicationIdForTestApp();
Request request1 = new Request(null, "TourEiffel");
Request request2 = new Request(null, "SpaceNeedle");
List<Response> responses = Request.executeBatchAndWait(request1, request2);
assertEquals(2, responses.size());
assertTrue(responses.get(0).getError() == null);
assertTrue(responses.get(1).getError() == null);
GraphPlace eiffelTower = responses.get(0).getGraphObjectAs(GraphPlace.class);
GraphPlace spaceNeedle = responses.get(1).getGraphObjectAs(GraphPlace.class);
assertTrue(eiffelTower != null);
assertTrue(spaceNeedle != null);
assertEquals("Paris", eiffelTower.getLocation().getCity());
assertEquals("Seattle", spaceNeedle.getLocation().getCity());
}
示例11: attach
import com.facebook.model.GraphPlace; //導入依賴的package包/類
@Override
public void attach(GraphObjectAdapter<GraphPlace> adapter) {
super.attach(adapter);
this.adapter.setDataNeededListener(new GraphObjectAdapter.DataNeededListener() {
@Override
public void onDataNeeded() {
// Do nothing if we are currently loading data . We will get notified again when that load finishes if the adapter still
// needs more data. Otherwise, follow the next link.
if (!loader.isLoading()) {
loader.followNextLink();
}
}
});
}
示例12: newPlacesSearchRequest
import com.facebook.model.GraphPlace; //導入依賴的package包/類
/**
* Creates a new Request that is configured to perform a search for places near a specified location via the Graph
* API. At least one of location or searchText must be specified.
*
* @param session
* the Session to use, or null; if non-null, the session must be in an opened state
* @param location
* the location around which to search; only the latitude and longitude components of the location are
* meaningful
* @param radiusInMeters
* the radius around the location to search, specified in meters; this is ignored if
* no location is specified
* @param resultsLimit
* the maximum number of results to return
* @param searchText
* optional text to search for as part of the name or type of an object
* @param callback
* a callback that will be called when the request is completed to handle success or error conditions
* @return a Request that is ready to execute
*
* @throws FacebookException If neither location nor searchText is specified
*/
public static Request newPlacesSearchRequest(Session session, Location location, int radiusInMeters,
int resultsLimit, String searchText, final GraphPlaceListCallback callback) {
if (location == null && Utility.isNullOrEmpty(searchText)) {
throw new FacebookException("Either location or searchText must be specified.");
}
Bundle parameters = new Bundle(5);
parameters.putString("type", "place");
parameters.putInt("limit", resultsLimit);
if (location != null) {
parameters.putString("center",
String.format(Locale.US, "%f,%f", location.getLatitude(), location.getLongitude()));
parameters.putInt("distance", radiusInMeters);
}
if (!Utility.isNullOrEmpty(searchText)) {
parameters.putString("q", searchText);
}
Callback wrapper = new Callback() {
@Override
public void onCompleted(Response response) {
if (callback != null) {
callback.onCompleted(typedListFromResponse(response, GraphPlace.class), response);
}
}
};
return new Request(session, SEARCH, parameters, HttpMethod.GET, wrapper);
}