summaryrefslogtreecommitdiff
path: root/android/arch/paging/TiledDataSource.java
diff options
context:
space:
mode:
authorJustin Klaassen <justinklaassen@google.com>2017-10-10 15:20:13 -0400
committerJustin Klaassen <justinklaassen@google.com>2017-10-10 15:20:13 -0400
commit93b7ee4fce01df52a6607f0b1965cbafdfeaf1a6 (patch)
tree49f76f879a89c256a4f65b674086be50760bdffb /android/arch/paging/TiledDataSource.java
parentbc81c7ada5aab3806dd0b17498f5c9672c9b33c4 (diff)
downloadandroid-28-93b7ee4fce01df52a6607f0b1965cbafdfeaf1a6.tar.gz
Import Android SDK Platform P [4386628]
/google/data/ro/projects/android/fetch_artifact \ --bid 4386628 \ --target sdk_phone_armv7-win_sdk \ sdk-repo-linux-sources-4386628.zip AndroidVersion.ApiLevel has been modified to appear as 28 Change-Id: I9b8400ac92116cae4f033d173f7a5682b26ccba9
Diffstat (limited to 'android/arch/paging/TiledDataSource.java')
-rw-r--r--android/arch/paging/TiledDataSource.java19
1 files changed, 14 insertions, 5 deletions
diff --git a/android/arch/paging/TiledDataSource.java b/android/arch/paging/TiledDataSource.java
index 56556cd4..36be423d 100644
--- a/android/arch/paging/TiledDataSource.java
+++ b/android/arch/paging/TiledDataSource.java
@@ -17,6 +17,7 @@
package android.arch.paging;
import android.support.annotation.Nullable;
+import android.support.annotation.WorkerThread;
import java.util.List;
@@ -90,6 +91,7 @@ public abstract class TiledDataSource<Type> extends DataSource<Integer, Type> {
*
* @return Number of items this DataSource can provide. Must be <code>0</code> or greater.
*/
+ @WorkerThread
@Override
public abstract int countItems();
@@ -100,14 +102,20 @@ public abstract class TiledDataSource<Type> extends DataSource<Integer, Type> {
/**
* Called to load items at from the specified position range.
+ * <p>
+ * This method must return a list of requested size, unless at the end of list. Fixed size pages
+ * enable TiledDataSource to navigate tiles efficiently, and quickly accesss any position in the
+ * data set.
+ * <p>
+ * If a list of a different size is returned, but it is not the last list in the data set based
+ * on the return value from {@link #countItems()}, an exception will be thrown.
*
* @param startPosition Index of first item to load.
- * @param count Exact number of items to load. Returning a different number will cause
- * an exception to be thrown.
- * @return List of loaded items. Null if the DataSource is no longer valid, and should
- * not be queried again.
+ * @param count Number of items to load.
+ * @return List of loaded items, of the requested length unless at end of list. Null if the
+ * DataSource is no longer valid, and should not be queried again.
*/
- @SuppressWarnings("WeakerAccess")
+ @WorkerThread
public abstract List<Type> loadRange(int startPosition, int count);
final List<Type> loadRangeWrapper(int startPosition, int count) {
@@ -132,6 +140,7 @@ public abstract class TiledDataSource<Type> extends DataSource<Integer, Type> {
mTiledDataSource = tiledDataSource;
}
+ @WorkerThread
@Nullable
@Override
public List<Value> loadRange(int startPosition, int loadCount) {