Display thread header in CFv2.

This commit is contained in:
Cody Henthorne
2023-05-11 15:39:59 -04:00
committed by Greyson Parrelli
parent ffbbdc1576
commit 3ba128793a
26 changed files with 235 additions and 49 deletions

View File

@@ -66,6 +66,7 @@ class FixedSizePagingController<Key, Data> implements PagingController<Key> {
final int loadStart;
final int loadEnd;
final int totalSize;
synchronized (loadState) {
if (loadState.size() == 0) {
@@ -94,7 +95,7 @@ class FixedSizePagingController<Key, Data> implements PagingController<Key> {
return;
}
int totalSize = loadState.size();
totalSize = loadState.size();
loadState.markRange(loadStart, loadEnd);
@@ -107,7 +108,7 @@ class FixedSizePagingController<Key, Data> implements PagingController<Key> {
return;
}
List<Data> loaded = dataSource.load(loadStart, loadEnd - loadStart, () -> invalidated);
List<Data> loaded = dataSource.load(loadStart, loadEnd - loadStart, totalSize, () -> invalidated);
if (invalidated) {
Log.w(TAG, buildDataNeededLog(aroundIndex, "Invalidated! Just after data was loaded."));

View File

@@ -17,15 +17,15 @@ public interface PagedDataSource<Key, Data> {
int size();
/**
* @param start The index of the first item that should be included in your results.
* @param length The total number of items you should return.
* @param start The index of the first item that should be included in your results.
* @param length The total number of items you should return.
* @param totalSize The total number of items in the data source
* @param cancellationSignal An object that you can check to see if the load operation was canceled.
*
* @return A list of length {@code length} that represents the data starting at {@code start}.
* If you don't have the full range, just populate what you can.
* If you don't have the full range, just populate what you can.
*/
@WorkerThread
@NonNull List<Data> load(int start, int length, @NonNull CancellationSignal cancellationSignal);
@NonNull List<Data> load(int start, int length, int totalSize, @NonNull CancellationSignal cancellationSignal);
@WorkerThread
@Nullable Data load(Key key);