Skip to content

Commit 25af25c

Browse files
greyson-signalalan-signal
authored andcommitted
Fix issue where button to go to archive was missing.
1 parent dfd5b2c commit 25af25c

1 file changed

Lines changed: 16 additions & 3 deletions

File tree

app/src/main/java/org/thoughtcrime/securesms/conversationlist/ConversationListDataSource.java

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,14 +112,27 @@ protected int getTotalCount() {
112112
pinnedCount = threadDatabase.getPinnedConversationListCount();
113113
archivedCount = threadDatabase.getArchivedConversationListCount();
114114
unpinnedCount = unarchivedCount - pinnedCount;
115-
totalCount = unarchivedCount + (archivedCount != 0 ? 1 : 0) + (pinnedCount != 0 ? (unpinnedCount != 0 ? 2 : 1) : 0);
115+
totalCount = unarchivedCount;
116+
117+
if (archivedCount != 0) {
118+
totalCount++;
119+
}
120+
121+
if (pinnedCount != 0) {
122+
if (unpinnedCount != 0) {
123+
totalCount += 2;
124+
} else {
125+
totalCount += 1;
126+
}
127+
}
116128

117129
return totalCount;
118130
}
119131

120132
@Override
121133
protected Cursor getCursor(long offset, long limit) {
122-
List<Cursor> cursors = new ArrayList<>(5);
134+
List<Cursor> cursors = new ArrayList<>(5);
135+
long originalLimit = limit;
123136

124137
if (offset == 0 && hasPinnedHeader()) {
125138
MatrixCursor pinnedHeaderCursor = new MatrixCursor(ConversationReader.HEADER_COLUMN);
@@ -143,7 +156,7 @@ protected Cursor getCursor(long offset, long limit) {
143156
Cursor unpinnedCursor = threadDatabase.getUnarchivedConversationList(false, unpinnedOffset, limit);
144157
cursors.add(unpinnedCursor);
145158

146-
if (offset + limit >= totalCount && hasArchivedFooter()) {
159+
if (offset + originalLimit >= totalCount && hasArchivedFooter()) {
147160
MatrixCursor archivedFooterCursor = new MatrixCursor(ConversationReader.ARCHIVED_COLUMNS);
148161
archivedFooterCursor.addRow(ConversationReader.createArchivedFooterRow(archivedCount));
149162
cursors.add(archivedFooterCursor);

0 commit comments

Comments
 (0)