Skip to content

Commit fff5b11

Browse files
committed
Definitive fix for #452 using an updated fast-adapter
1 parent da13c5e commit fff5b11

File tree

2 files changed

+9
-11
lines changed

2 files changed

+9
-11
lines changed

app/build.gradle

+6-6
Original file line numberDiff line numberDiff line change
@@ -175,12 +175,12 @@ dependencies {
175175
implementation 'com.jakewharton.threetenabp:threetenabp:1.2.1'
176176

177177
// https://github.com/mikepenz/FastAdapter
178-
implementation "com.mikepenz:fastadapter:4.1.2" // needs the `expandable`, `drag` and `scroll` extension.
179-
implementation "com.mikepenz:fastadapter-extensions-drag:4.1.2" // drag support
180-
implementation "com.mikepenz:fastadapter-extensions-expandable:4.1.2"
181-
implementation "com.mikepenz:fastadapter-extensions-scroll:4.1.2" // scroll helpers
182-
implementation "com.mikepenz:fastadapter-extensions-paged:4.1.2"
183-
implementation "com.mikepenz:fastadapter-extensions-utils:4.1.2" // needs the `expandable`, `drag` and `scroll` extension.
178+
implementation "com.mikepenz:fastadapter:5.0.0-a03" // needs the `expandable`, `drag` and `scroll` extension.
179+
implementation "com.mikepenz:fastadapter-extensions-drag:5.0.0-a03" // drag support
180+
implementation "com.mikepenz:fastadapter-extensions-expandable:5.0.0-a03"
181+
implementation "com.mikepenz:fastadapter-extensions-scroll:5.0.0-a03" // scroll helpers
182+
implementation "com.mikepenz:fastadapter-extensions-paged:5.0.0-a03"
183+
implementation "com.mikepenz:fastadapter-extensions-utils:5.0.0-a03" // needs the `expandable`, `drag` and `scroll` extension.
184184
implementation "com.mikepenz:materialize:1.2.1"
185185

186186
// ProgressDialog alternative - https://github.com/Livin21/MissMe

app/src/main/java/me/devsaki/hentoid/fragments/library/LibraryFragment.java

+3-5
Original file line numberDiff line numberDiff line change
@@ -881,7 +881,6 @@ private void loadBookshelf(PagedList<Content> iLibrary) {
881881
return;
882882
}
883883

884-
// TODO explore using PagedList.Callback instead
885884
/* We're using PagedList v2.1.1 against the use case it has been designed for (endless lists loaded linearly).
886885
Doing it right requires the following algorithm :
887886
@@ -896,7 +895,6 @@ Check if there is unloaded data in the working dataset (iLibrary)
896895
NB : Case C implementation _is_ quick and hacky (no discussion about that).
897896
The alternative would be to implement a whole alternate data source for Hentoid paged mode, which is massively more complex
898897
*/
899-
900898
//noinspection Convert2MethodRef need API24
901899
long nbPlaceholders = Stream.of(iLibrary.subList(minIndex, maxIndex)).filter(c -> c == null).count();
902900
Timber.d(">> nb placeholders : %s", nbPlaceholders);
@@ -996,6 +994,7 @@ private void onLibraryChanged(PagedList<Content> result) {
996994
if (Preferences.getEndlessScroll()) {
997995
pagedItemAdapter.submitList(result, this::differEndCallback);
998996
} else {
997+
999998
if (newSearch) pager.setCurrentPage(1);
1000999
pager.setPageCount((int) Math.ceil(result.size() * 1.0 / Preferences.getContentPageQuantity()));
10011000
minLoadedBound = Integer.MAX_VALUE;
@@ -1039,8 +1038,7 @@ private void updateTitle(long totalSelectedCount, long totalCount) {
10391038
private boolean onBookClick(ContentItem item, int position) {
10401039
if (0 == selectExtension.getSelectedItems().size()) {
10411040
if (!invalidateNextBookClick) {
1042-
topItemPosition = position;
1043-
// unObserveAll();
1041+
topItemPosition = position; // TODO - still useful ?
10441042
ContentHelper.openHentoidViewer(requireContext(), item.getContent(), viewModel.getSearchManagerBundle());
10451043
} else invalidateNextBookClick = false;
10461044

@@ -1138,7 +1136,7 @@ private void differEndCallback() {
11381136
Timber.i(">> differEnd::current vs. memorized %s / %s", currentPosition, topItemPosition);
11391137
if (currentPosition != topItemPosition) {
11401138
Timber.i(">> differEnd::scrolling to last memorized position : %s", topItemPosition);
1141-
// llm.scrollToPositionWithOffset(topItemPosition, 0);
1139+
// llm.scrollToPositionWithOffset(topItemPosition, 0); // TODO - enable or delete the whole method
11421140
topItemPosition = -1;
11431141
}
11441142
}

0 commit comments

Comments
 (0)