Java Code Examples for com.android.volley.Request.Priority#compareTo()

The following examples show how to use com.android.volley.Request.Priority#compareTo() . 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: RequestQueueTest.java    From android-project-wo2b with Apache License 2.0 6 votes vote down vote up
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}
 
Example 2
Source File: RequestQueueTest.java    From android-discourse with Apache License 2.0 6 votes vote down vote up
@Override
public NetworkResponse performRequest(Request<?> request) {
    Priority thisPriority = request.getPriority();
    int thisSequence = request.getSequence();

    int priorityDiff = thisPriority.compareTo(mLastPriority);

    // Should never experience a higher priority after a lower priority
    assertFalse(priorityDiff > 0);

    // If we're not transitioning to a new priority block, check sequence numbers
    if (priorityDiff == 0) {
        assertTrue(thisSequence > mLastSequence);
    }
    mLastSequence = thisSequence;
    mLastPriority = thisPriority;

    mSemaphore.release();
    return new NetworkResponse(new byte[16]);
}