Search in sources :

Example 1 with Priority

use of com.android.volley.Request.Priority in project iosched by google.

the class RequestQueueTest method makeRequests.

/**
     * Make a list of requests with random priorities.
     * @param count Number of requests to make
     */
private List<MockRequest> makeRequests(int count) {
    Request.Priority[] allPriorities = Request.Priority.values();
    Random random = new Random();
    List<MockRequest> requests = new ArrayList<MockRequest>();
    for (int i = 0; i < count; i++) {
        MockRequest request = new MockRequest();
        Request.Priority priority = allPriorities[random.nextInt(allPriorities.length)];
        request.setCacheKey(String.valueOf(i));
        request.setPriority(priority);
        requests.add(request);
    }
    return requests;
}
Also used : Random(java.util.Random) Priority(com.android.volley.Request.Priority) ArrayList(java.util.ArrayList) MockRequest(com.android.volley.mock.MockRequest) Priority(com.android.volley.Request.Priority) MockRequest(com.android.volley.mock.MockRequest)

Aggregations

Priority (com.android.volley.Request.Priority)1 MockRequest (com.android.volley.mock.MockRequest)1 ArrayList (java.util.ArrayList)1 Random (java.util.Random)1