Merge "Fix index computation for quick viewing." into nyc-dev am: 52036c7
am: e4731b3
* commit 'e4731b337370e00fcbda633fc2bd071c96f9673b':
Fix index computation for quick viewing.
Change-Id: I5ee5cbacbb37e52b60200cc0ce7db8a3958bb63b
This commit is contained in:
@@ -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);
|
intent.setClipData(clipData);
|
||||||
|
|
||||||
return intent;
|
return intent;
|
||||||
@@ -147,12 +150,12 @@ final class QuickViewIntentBuilder {
|
|||||||
authority = getCursorString(cursor, RootCursorWrapper.COLUMN_AUTHORITY);
|
authority = getCursorString(cursor, RootCursorWrapper.COLUMN_AUTHORITY);
|
||||||
uri = DocumentsContract.buildDocumentUri(authority, id);
|
uri = DocumentsContract.buildDocumentUri(authority, id);
|
||||||
|
|
||||||
if (id.equals(mDocument.documentId)) {
|
|
||||||
if (DEBUG) Log.d(TAG, "Found starting point for QV. " + i);
|
|
||||||
documentLocation = i;
|
|
||||||
}
|
|
||||||
|
|
||||||
uris.add(uri);
|
uris.add(uri);
|
||||||
|
|
||||||
|
if (id.equals(mDocument.documentId)) {
|
||||||
|
documentLocation = uris.size() - 1; // Position in "uris", not in the model.
|
||||||
|
if (DEBUG) Log.d(TAG, "Found starting point for QV. " + documentLocation);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return documentLocation;
|
return documentLocation;
|
||||||
|
|||||||
Reference in New Issue
Block a user