Keep source list info in InfoItemBuilder

Also remove some unused code
This commit is contained in:
Stypox 2023-04-11 22:26:35 +02:00
parent 35b33a2833
commit f24f652362
3 changed files with 23 additions and 48 deletions

View file

@ -66,6 +66,7 @@ public abstract class BaseListInfoFragment<I extends InfoItem, L extends ListInf
@Override
public void onResume() {
super.onResume();
// Check if it was loading when the fragment was stopped/paused,
if (wasLoading.getAndSet(false)) {
if (hasMoreItems() && !infoListAdapter.getItemsList().isEmpty()) {
@ -74,6 +75,8 @@ public abstract class BaseListInfoFragment<I extends InfoItem, L extends ListInf
doInitialLoadLogic();
}
}
infoListAdapter.setSourceListInfo(currentInfo);
}
@Override
@ -137,6 +140,8 @@ public abstract class BaseListInfoFragment<I extends InfoItem, L extends ListInf
infoListAdapter.clearStreamItemList();
currentInfo = null;
infoListAdapter.setSourceListInfo(null);
if (currentWorker != null) {
currentWorker.dispose();
}
@ -146,6 +151,7 @@ public abstract class BaseListInfoFragment<I extends InfoItem, L extends ListInf
.subscribe((@NonNull L result) -> {
isLoading.set(false);
currentInfo = result;
infoListAdapter.setSourceListInfo(result);
currentNextPage = result.getNextPage();
handleResult(result);
}, throwable ->