Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 0799bd07 authored by Sungsoo Lim's avatar Sungsoo Lim
Browse files

MediaBrowser: Make EXTRA_PAGE zero-based

Bug: 27948393
Change-Id: I97fb6b5f13ffb8e006ed4a7efc06e7f45fb5121a
parent 7d718bb2
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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
     */
+2 −2
Original line number Diff line number Diff line
@@ -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;
        }

+2 −2
Original line number Diff line number Diff line
@@ -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()) {