Skip to content

Commit

Permalink
Merge pull request #334 from fakeboboliu/master
Browse files Browse the repository at this point in the history
tweaks to handle more galleries
  • Loading branch information
jiangtian616 authored Dec 15, 2023
2 parents e202972 + d0305bd commit 5b1cf90
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
2 changes: 1 addition & 1 deletion lib/src/pages/download/download_base_page.dart
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ class _GroupListState<E, G> extends State<GroupList<E, G>> {
controller: scrollController,
padding: const EdgeInsets.only(bottom: 80),
itemCount: widget.elements.length + widget.groups.length,
cacheExtent: 6000,
cacheExtent: 20,
itemBuilder: (BuildContext context, int index) {
int remainingCount = index;
int groupIndex = 0;
Expand Down
11 changes: 6 additions & 5 deletions lib/src/service/archive_download_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -335,11 +335,11 @@ class ArchiveDownloadService extends GetxController with GridBasePageServiceMixi
continue;
}

_initArchiveInMemory(archive);
_initArchiveInMemory(archive, sort: false);

restoredCount++;
}

_sortArchives();
return restoredCount;
}

Expand Down Expand Up @@ -697,8 +697,9 @@ class ArchiveDownloadService extends GetxController with GridBasePageServiceMixi
List<ArchiveDownloadedData> archives = await appDb.selectArchives().get();

for (ArchiveDownloadedData archive in archives) {
_initArchiveInMemory(archive);
_initArchiveInMemory(archive, sort: false);
}
_sortArchives();
}

Future<bool> _initArchiveInfo(ArchiveDownloadedData archive) async {
Expand Down Expand Up @@ -775,7 +776,7 @@ class ArchiveDownloadService extends GetxController with GridBasePageServiceMixi

// MEMORY

void _initArchiveInMemory(ArchiveDownloadedData archive) {
void _initArchiveInMemory(ArchiveDownloadedData archive, {bool sort = true}) {
if (!allGroups.contains(archive.groupName ?? 'default'.tr)) {
allGroups.add(archive.groupName ?? 'default'.tr);
}
Expand All @@ -794,7 +795,7 @@ class ArchiveDownloadService extends GetxController with GridBasePageServiceMixi
group: archive.groupName ?? 'default'.tr,
);

_sortArchives();
if (sort) _sortArchives();
update([galleryCountChangedId, '$archiveStatusId::::${archive.gid}']);
}

Expand Down
4 changes: 2 additions & 2 deletions lib/src/service/gallery_download_service.dart
Original file line number Diff line number Diff line change
Expand Up @@ -431,11 +431,11 @@ class GalleryDownloadService extends GetxController with GridBasePageServiceMixi
continue;
}

_initGalleryInfoInMemory(gallery, images: images);
_initGalleryInfoInMemory(gallery, images: images, sort: false);

restoredCount++;
}

_sortGallerys();
return restoredCount;
}

Expand Down

0 comments on commit 5b1cf90

Please sign in to comment.