Java 类com.facebook.RequestBatch 实例源码

项目:FacebookImageShareIntent    文件:ProgressOutputStreamTests.java   
@Override
protected void setUp() throws Exception {
    r1 = new Request(null, "4");
    r2 = new Request(null, "4");

    progressMap = new HashMap<Request, RequestProgress>();
    progressMap.put(r1, new RequestProgress(null, r1));
    progressMap.get(r1).addToMax(5);
    progressMap.put(r2, new RequestProgress(null, r2));
    progressMap.get(r2).addToMax(5);

    requests = new RequestBatch(r1, r2);

    ByteArrayOutputStream backing = new ByteArrayOutputStream();
    stream = new ProgressOutputStream(backing, requests, progressMap, MAX_PROGRESS);
}
项目:yelo-android    文件:GraphObjectPagingLoader.java   
private void startLoading(Request request, boolean skipRoundtripIfCached, long afterDelay) {
    this.skipRoundtripIfCached = skipRoundtripIfCached;
    appendResults = false;
    nextRequest = null;
    currentRequest = request;
    currentRequest.setCallback(new Request.Callback() {
        @Override
        public void onCompleted(Response response) {
            requestCompleted(response);
        }
    });

    // We are considered loading even if we have a delay.
    loading = true;

    final RequestBatch batch = putRequestIntoBatch(request, skipRoundtripIfCached);
    Runnable r = new Runnable() {
        @Override
        public void run() {
            Request.executeBatchAsync(batch);
        }
    };
    if (afterDelay == 0) {
        r.run();
    } else {
        Handler handler = new Handler();
        handler.postDelayed(r, afterDelay);
    }
}
项目:p2psafety    文件:GraphObjectPagingLoader.java   
private void startLoading(Request request, boolean skipRoundtripIfCached, long afterDelay) {
    this.skipRoundtripIfCached = skipRoundtripIfCached;
    appendResults = false;
    nextRequest = null;
    currentRequest = request;
    currentRequest.setCallback(new Request.Callback() {
        @Override
        public void onCompleted(Response response) {
            requestCompleted(response);
        }
    });

    // We are considered loading even if we have a delay.
    loading = true;

    final RequestBatch batch = putRequestIntoBatch(request, skipRoundtripIfCached);
    Runnable r = new Runnable() {
        @Override
        public void run() {
            Request.executeBatchAsync(batch);
        }
    };
    if (afterDelay == 0) {
        r.run();
    } else {
        Handler handler = new Handler();
        handler.postDelayed(r, afterDelay);
    }
}
项目:FacebookImageShareIntent    文件:BatchRequestTests.java   
@SmallTest
@MediumTest
@LargeTest
public void testCreateNonemptyRequestBatch() {
    Request meRequest = Request.newMeRequest(null, null);

    RequestBatch batch = new RequestBatch(new Request[] { meRequest, meRequest });
    assertEquals(2, batch.size());
    assertEquals(meRequest, batch.get(0));
    assertEquals(meRequest, batch.get(1));
}