本文整理汇总了Java中com.android.volley.Request.Priority.IMMEDIATE属性的典型用法代码示例。如果您正苦于以下问题:Java Priority.IMMEDIATE属性的具体用法?Java Priority.IMMEDIATE怎么用?Java Priority.IMMEDIATE使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在类com.android.volley.Request.Priority
的用法示例。
在下文中一共展示了Priority.IMMEDIATE属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: compareTo
@Test public void compareTo() {
int sequence = 0;
TestRequest low = new TestRequest(Priority.LOW);
low.setSequence(sequence++);
TestRequest low2 = new TestRequest(Priority.LOW);
low2.setSequence(sequence++);
TestRequest high = new TestRequest(Priority.HIGH);
high.setSequence(sequence++);
TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
immediate.setSequence(sequence++);
// "Low" should sort higher because it's really processing order.
assertTrue(low.compareTo(high) > 0);
assertTrue(high.compareTo(low) < 0);
assertTrue(low.compareTo(low2) < 0);
assertTrue(low.compareTo(immediate) > 0);
assertTrue(immediate.compareTo(high) < 0);
}
示例2: testCompareTo
public void testCompareTo() {
int sequence = 0;
TestRequest low = new TestRequest(Priority.LOW);
low.setSequence(sequence++);
TestRequest low2 = new TestRequest(Priority.LOW);
low2.setSequence(sequence++);
TestRequest high = new TestRequest(Priority.HIGH);
high.setSequence(sequence++);
TestRequest immediate = new TestRequest(Priority.IMMEDIATE);
immediate.setSequence(sequence++);
// "Low" should sort higher because it's really processing order.
assertTrue(low.compareTo(high) > 0);
assertTrue(high.compareTo(low) < 0);
assertTrue(low.compareTo(low2) < 0);
assertTrue(low.compareTo(immediate) > 0);
assertTrue(immediate.compareTo(high) < 0);
}
示例3: getVolleyPriority
private Priority getVolleyPriority(int priority) {
switch (priority) {
case Api.Priority.LOW:
return Priority.LOW;
case Api.Priority.HIGH:
return Priority.HIGH;
case Api.Priority.IMMEDIATE:
return Priority.IMMEDIATE;
case Api.Priority.NORMAL:
default:
return Priority.NORMAL;
}
}
示例4: getPriority
public Priority getPriority() {
return Priority.IMMEDIATE;
}