Bug 1296411 - Correctly transform the adapter position to a cursor position when accessing the history cursor for getItemId. r=sebastian

Because of the smart folders and section headers, the adapter position needs to be appropriately adjusted when trying to access the corresponding cursor item.

MozReview-Commit-ID: n3FvcsYJ5T

--HG--
extra : rebase_source : 366dadb7abde5283a93fb1d62cff3ff4e3bba28b
This commit is contained in:
Jan Henning 2016-08-18 22:06:38 +02:00
parent bde66209f8
commit 519057383f

View File

@ -215,7 +215,9 @@ public class CombinedHistoryAdapter extends RecyclerView.Adapter<CombinedHistory
// We might have multiple section headers, so we try get unique IDs for them.
return position * PRIME_SECTION_HEADERS;
case HISTORY:
if (!historyCursor.moveToPosition(position)) {
final int historyPosition = transformAdapterPositionForDataStructure(
CombinedHistoryItem.ItemType.HISTORY, position);
if (!historyCursor.moveToPosition(historyPosition)) {
return RecyclerView.NO_ID;
}