Merge "MediaBrowser: Make EXTRA_PAGE zero-based" into nyc-dev
This commit is contained in:
@@ -72,7 +72,7 @@ public final class MediaBrowser {
|
||||
|
||||
/**
|
||||
* Used as an int extra field to denote the page number to subscribe.
|
||||
* The value of {@code EXTRA_PAGE} should be greater than or equal to 1.
|
||||
* The value of {@code EXTRA_PAGE} should be greater than or equal to 0.
|
||||
*
|
||||
* @see #EXTRA_PAGE_SIZE
|
||||
*/
|
||||
|
||||
@@ -50,7 +50,7 @@ public class MediaBrowserUtils {
|
||||
startIndex1 = 0;
|
||||
endIndex1 = Integer.MAX_VALUE;
|
||||
} else {
|
||||
startIndex1 = pageSize1 * (page1 - 1);
|
||||
startIndex1 = pageSize1 * page1;
|
||||
endIndex1 = startIndex1 + pageSize1 - 1;
|
||||
}
|
||||
|
||||
@@ -58,7 +58,7 @@ public class MediaBrowserUtils {
|
||||
startIndex2 = 0;
|
||||
endIndex2 = Integer.MAX_VALUE;
|
||||
} else {
|
||||
startIndex2 = pageSize2 * (page2 - 1);
|
||||
startIndex2 = pageSize2 * page2;
|
||||
endIndex2 = startIndex2 + pageSize2 - 1;
|
||||
}
|
||||
|
||||
|
||||
@@ -657,9 +657,9 @@ public abstract class MediaBrowserService extends Service {
|
||||
if (page == -1 && pageSize == -1) {
|
||||
return list;
|
||||
}
|
||||
int fromIndex = pageSize * (page - 1);
|
||||
int fromIndex = pageSize * page;
|
||||
int toIndex = fromIndex + pageSize;
|
||||
if (page < 1 || pageSize < 1 || fromIndex >= list.size()) {
|
||||
if (page < 0 || pageSize < 1 || fromIndex >= list.size()) {
|
||||
return Collections.EMPTY_LIST;
|
||||
}
|
||||
if (toIndex > list.size()) {
|
||||
|
||||
Reference in New Issue
Block a user