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

Commit 9a0dbdc1 authored by Tomasz Mikolajewski's avatar Tomasz Mikolajewski Committed by android-build-merger
Browse files

Merge "Fix index computation for quick viewing." into nyc-dev

am: 52036c7

* commit '52036c743c1fccf004247af35e9c95e12fb0a638':
  Fix index computation for quick viewing.

Change-Id: Ief946fe886f8a172cd9e75c0e59904293f0335e2
parents f15d4cbd e23334bd
Loading
Loading
Loading
Loading
+8 −5
Original line number Diff line number Diff line
@@ -101,7 +101,10 @@ final class QuickViewIntentBuilder {
                    }
                }

                intent.putExtra(Intent.EXTRA_INDEX, documentLocation);
                // The documentLocation variable contains an index in "uris". However,
                // ClipData contains a slice of "uris", so we need to shift the location
                // so it points to the same Uri.
                intent.putExtra(Intent.EXTRA_INDEX, documentLocation - range.getLower());
                intent.setClipData(clipData);

                return intent;
@@ -147,12 +150,12 @@ final class QuickViewIntentBuilder {
            authority = getCursorString(cursor, RootCursorWrapper.COLUMN_AUTHORITY);
            uri = DocumentsContract.buildDocumentUri(authority, id);

            uris.add(uri);

            if (id.equals(mDocument.documentId)) {
                if (DEBUG) Log.d(TAG, "Found starting point for QV. " + i);
                documentLocation = i;
                documentLocation = uris.size() - 1;  // Position in "uris", not in the model.
                if (DEBUG) Log.d(TAG, "Found starting point for QV. " + documentLocation);
            }

            uris.add(uri);
        }

        return documentLocation;