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

Commit 38fdef8d authored by Sungsoo Lim's avatar Sungsoo Lim Committed by android-build-merger
Browse files

Merge "MediaBrowser: Make EXTRA_PAGE zero-based" into nyc-dev

am: 16bbf7d8

* commit '16bbf7d8':
  MediaBrowser: Make EXTRA_PAGE zero-based

Change-Id: I75f1786e6a2acb2a06e11f1af7856a7344593104
parents 04dc28af 16bbf7d8
Loading
Loading
Loading
Loading
+1 −1
Original line number Original line 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.
     * 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
     * @see #EXTRA_PAGE_SIZE
     */
     */
+2 −2
Original line number Original line Diff line number Diff line
@@ -50,7 +50,7 @@ public class MediaBrowserUtils {
            startIndex1 = 0;
            startIndex1 = 0;
            endIndex1 = Integer.MAX_VALUE;
            endIndex1 = Integer.MAX_VALUE;
        } else {
        } else {
            startIndex1 = pageSize1 * (page1 - 1);
            startIndex1 = pageSize1 * page1;
            endIndex1 = startIndex1 + pageSize1 - 1;
            endIndex1 = startIndex1 + pageSize1 - 1;
        }
        }


@@ -58,7 +58,7 @@ public class MediaBrowserUtils {
            startIndex2 = 0;
            startIndex2 = 0;
            endIndex2 = Integer.MAX_VALUE;
            endIndex2 = Integer.MAX_VALUE;
        } else {
        } else {
            startIndex2 = pageSize2 * (page2 - 1);
            startIndex2 = pageSize2 * page2;
            endIndex2 = startIndex2 + pageSize2 - 1;
            endIndex2 = startIndex2 + pageSize2 - 1;
        }
        }


+2 −2
Original line number Original line Diff line number Diff line
@@ -657,9 +657,9 @@ public abstract class MediaBrowserService extends Service {
        if (page == -1 && pageSize == -1) {
        if (page == -1 && pageSize == -1) {
            return list;
            return list;
        }
        }
        int fromIndex = pageSize * (page - 1);
        int fromIndex = pageSize * page;
        int toIndex = fromIndex + pageSize;
        int toIndex = fromIndex + pageSize;
        if (page < 1 || pageSize < 1 || fromIndex >= list.size()) {
        if (page < 0 || pageSize < 1 || fromIndex >= list.size()) {
            return Collections.EMPTY_LIST;
            return Collections.EMPTY_LIST;
        }
        }
        if (toIndex > list.size()) {
        if (toIndex > list.size()) {