Jeff Gaston | 5d65a6a | 2019-01-23 13:44:15 -0500 | [diff] [blame^] | 1 | // Signature format: 3.0 |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 2 | package androidx.paging { |
| 3 | |
| 4 | public abstract class DataSource<Key, Value> { |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 5 | method @AnyThread public void addInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback); |
| 6 | method @AnyThread public void invalidate(); |
| 7 | method @WorkerThread public boolean isInvalid(); |
| 8 | method public abstract <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue>); |
| 9 | method public abstract <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>>); |
| 10 | method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 11 | } |
| 12 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 13 | public abstract static class DataSource.Factory<Key, Value> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 14 | ctor public DataSource.Factory(); |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 15 | method public abstract androidx.paging.DataSource<Key,Value> create(); |
| 16 | method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue>); |
| 17 | method public <ToValue> androidx.paging.DataSource.Factory<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>>); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 18 | } |
| 19 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 20 | public static interface DataSource.InvalidatedCallback { |
| 21 | method @AnyThread public void onInvalidated(); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 22 | } |
| 23 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 24 | public abstract class ItemKeyedDataSource<Key, Value> extends androidx.paging.DataSource<Key,Value> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 25 | method public abstract Key getKey(Value); |
| 26 | method public abstract void loadAfter(androidx.paging.ItemKeyedDataSource.LoadParams<Key>, androidx.paging.ItemKeyedDataSource.LoadCallback<Value>); |
| 27 | method public abstract void loadBefore(androidx.paging.ItemKeyedDataSource.LoadParams<Key>, androidx.paging.ItemKeyedDataSource.LoadCallback<Value>); |
| 28 | method public abstract void loadInitial(androidx.paging.ItemKeyedDataSource.LoadInitialParams<Key>, androidx.paging.ItemKeyedDataSource.LoadInitialCallback<Value>); |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 29 | method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue>); |
| 30 | method public final <ToValue> androidx.paging.ItemKeyedDataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>>); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 31 | } |
| 32 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 33 | public abstract static class ItemKeyedDataSource.LoadCallback<Value> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 34 | ctor public ItemKeyedDataSource.LoadCallback(); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 35 | method public void onError(Throwable); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 36 | method public abstract void onResult(java.util.List<Value>); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 37 | method public void onRetryableError(Throwable); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 38 | } |
| 39 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 40 | public abstract static class ItemKeyedDataSource.LoadInitialCallback<Value> extends androidx.paging.ItemKeyedDataSource.LoadCallback<Value> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 41 | ctor public ItemKeyedDataSource.LoadInitialCallback(); |
| 42 | method public abstract void onResult(java.util.List<Value>, int, int); |
| 43 | } |
| 44 | |
| 45 | public static class ItemKeyedDataSource.LoadInitialParams<Key> { |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 46 | ctor public ItemKeyedDataSource.LoadInitialParams(Key?, int, boolean); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 47 | field public final boolean placeholdersEnabled; |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 48 | field public final Key? requestedInitialKey; |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 49 | field public final int requestedLoadSize; |
| 50 | } |
| 51 | |
| 52 | public static class ItemKeyedDataSource.LoadParams<Key> { |
| 53 | ctor public ItemKeyedDataSource.LoadParams(Key, int); |
| 54 | field public final Key key; |
| 55 | field public final int requestedLoadSize; |
| 56 | } |
| 57 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 58 | public abstract class PageKeyedDataSource<Key, Value> extends androidx.paging.DataSource<Key,Value> { |
| 59 | method public abstract void loadAfter(androidx.paging.PageKeyedDataSource.LoadParams<Key>, androidx.paging.PageKeyedDataSource.LoadCallback<Key,Value>); |
| 60 | method public abstract void loadBefore(androidx.paging.PageKeyedDataSource.LoadParams<Key>, androidx.paging.PageKeyedDataSource.LoadCallback<Key,Value>); |
| 61 | method public abstract void loadInitial(androidx.paging.PageKeyedDataSource.LoadInitialParams<Key>, androidx.paging.PageKeyedDataSource.LoadInitialCallback<Key,Value>); |
| 62 | method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue>); |
| 63 | method public final <ToValue> androidx.paging.PageKeyedDataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>>); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 64 | } |
| 65 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 66 | public abstract static class PageKeyedDataSource.LoadCallback<Key, Value> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 67 | ctor public PageKeyedDataSource.LoadCallback(); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 68 | method public void onError(Throwable); |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 69 | method public abstract void onResult(java.util.List<Value>, Key?); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 70 | method public void onRetryableError(Throwable); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 71 | } |
| 72 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 73 | public abstract static class PageKeyedDataSource.LoadInitialCallback<Key, Value> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 74 | ctor public PageKeyedDataSource.LoadInitialCallback(); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 75 | method public void onError(Throwable); |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 76 | method public abstract void onResult(java.util.List<Value>, int, int, Key?, Key?); |
| 77 | method public abstract void onResult(java.util.List<Value>, Key?, Key?); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 78 | method public void onRetryableError(Throwable); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 79 | } |
| 80 | |
| 81 | public static class PageKeyedDataSource.LoadInitialParams<Key> { |
| 82 | ctor public PageKeyedDataSource.LoadInitialParams(int, boolean); |
| 83 | field public final boolean placeholdersEnabled; |
| 84 | field public final int requestedLoadSize; |
| 85 | } |
| 86 | |
| 87 | public static class PageKeyedDataSource.LoadParams<Key> { |
| 88 | ctor public PageKeyedDataSource.LoadParams(Key, int); |
| 89 | field public final Key key; |
| 90 | field public final int requestedLoadSize; |
| 91 | } |
| 92 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 93 | public abstract class PagedList<T> extends java.util.AbstractList<T> { |
| 94 | method public void addWeakCallback(java.util.List<T>?, androidx.paging.PagedList.Callback); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 95 | method public void addWeakLoadStateListener(androidx.paging.PagedList.LoadStateListener); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 96 | method public void detach(); |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 97 | method public T? get(int); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 98 | method public androidx.paging.PagedList.Config getConfig(); |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 99 | method public abstract androidx.paging.DataSource<?,T> getDataSource(); |
| 100 | method public abstract Object? getLastKey(); |
Chris Craik | 00cf205 | 2018-08-10 14:00:23 -0700 | [diff] [blame] | 101 | method public int getLoadedCount(); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 102 | method public int getPositionOffset(); |
| 103 | method public boolean isDetached(); |
| 104 | method public boolean isImmutable(); |
| 105 | method public void loadAround(int); |
| 106 | method public void removeWeakCallback(androidx.paging.PagedList.Callback); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 107 | method public void removeWeakLoadStateListener(androidx.paging.PagedList.LoadStateListener); |
| 108 | method public void retry(); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 109 | method public int size(); |
| 110 | method public java.util.List<T> snapshot(); |
| 111 | } |
| 112 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 113 | @MainThread public abstract static class PagedList.BoundaryCallback<T> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 114 | ctor public PagedList.BoundaryCallback(); |
| 115 | method public void onItemAtEndLoaded(T); |
| 116 | method public void onItemAtFrontLoaded(T); |
| 117 | method public void onZeroItemsLoaded(); |
| 118 | } |
| 119 | |
| 120 | public static final class PagedList.Builder<Key, Value> { |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 121 | ctor public PagedList.Builder(androidx.paging.DataSource<Key,Value>, androidx.paging.PagedList.Config); |
| 122 | ctor public PagedList.Builder(androidx.paging.DataSource<Key,Value>, int); |
| 123 | method @WorkerThread public androidx.paging.PagedList<Value> build(); |
| 124 | method public androidx.paging.PagedList.Builder<Key,Value> setBoundaryCallback(androidx.paging.PagedList.BoundaryCallback?); |
| 125 | method public androidx.paging.PagedList.Builder<Key,Value> setFetchExecutor(java.util.concurrent.Executor); |
| 126 | method public androidx.paging.PagedList.Builder<Key,Value> setInitialKey(Key?); |
| 127 | method public androidx.paging.PagedList.Builder<Key,Value> setNotifyExecutor(java.util.concurrent.Executor); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 128 | } |
| 129 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 130 | public abstract static class PagedList.Callback { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 131 | ctor public PagedList.Callback(); |
| 132 | method public abstract void onChanged(int, int); |
| 133 | method public abstract void onInserted(int, int); |
| 134 | method public abstract void onRemoved(int, int); |
| 135 | } |
| 136 | |
| 137 | public static class PagedList.Config { |
Chris Craik | e8ca38c | 2018-05-22 18:08:16 -0700 | [diff] [blame] | 138 | field public static final int MAX_SIZE_UNBOUNDED = 2147483647; // 0x7fffffff |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 139 | field public final boolean enablePlaceholders; |
| 140 | field public final int initialLoadSizeHint; |
Chris Craik | e8ca38c | 2018-05-22 18:08:16 -0700 | [diff] [blame] | 141 | field public final int maxSize; |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 142 | field public final int pageSize; |
| 143 | field public final int prefetchDistance; |
| 144 | } |
| 145 | |
| 146 | public static final class PagedList.Config.Builder { |
| 147 | ctor public PagedList.Config.Builder(); |
| 148 | method public androidx.paging.PagedList.Config build(); |
| 149 | method public androidx.paging.PagedList.Config.Builder setEnablePlaceholders(boolean); |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 150 | method public androidx.paging.PagedList.Config.Builder setInitialLoadSizeHint(@IntRange(from=1) int); |
| 151 | method public androidx.paging.PagedList.Config.Builder setMaxSize(@IntRange(from=2) int); |
| 152 | method public androidx.paging.PagedList.Config.Builder setPageSize(@IntRange(from=1) int); |
| 153 | method public androidx.paging.PagedList.Config.Builder setPrefetchDistance(@IntRange(from=0) int); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 154 | } |
| 155 | |
Jeff Gaston | 5d65a6a | 2019-01-23 13:44:15 -0500 | [diff] [blame^] | 156 | public enum PagedList.LoadState { |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 157 | enum_constant public static final androidx.paging.PagedList.LoadState DONE; |
| 158 | enum_constant public static final androidx.paging.PagedList.LoadState ERROR; |
| 159 | enum_constant public static final androidx.paging.PagedList.LoadState IDLE; |
| 160 | enum_constant public static final androidx.paging.PagedList.LoadState LOADING; |
| 161 | enum_constant public static final androidx.paging.PagedList.LoadState RETRYABLE_ERROR; |
| 162 | } |
| 163 | |
| 164 | public static interface PagedList.LoadStateListener { |
| 165 | method public void onLoadStateChanged(androidx.paging.PagedList.LoadType, androidx.paging.PagedList.LoadState, Throwable?); |
| 166 | } |
| 167 | |
Jeff Gaston | 5d65a6a | 2019-01-23 13:44:15 -0500 | [diff] [blame^] | 168 | public enum PagedList.LoadType { |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 169 | enum_constant public static final androidx.paging.PagedList.LoadType END; |
| 170 | enum_constant public static final androidx.paging.PagedList.LoadType REFRESH; |
| 171 | enum_constant public static final androidx.paging.PagedList.LoadType START; |
| 172 | } |
| 173 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 174 | public abstract class PositionalDataSource<T> extends androidx.paging.DataSource<java.lang.Integer,T> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 175 | method public static int computeInitialLoadPosition(androidx.paging.PositionalDataSource.LoadInitialParams, int); |
| 176 | method public static int computeInitialLoadSize(androidx.paging.PositionalDataSource.LoadInitialParams, int, int); |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 177 | method @WorkerThread public abstract void loadInitial(androidx.paging.PositionalDataSource.LoadInitialParams, androidx.paging.PositionalDataSource.LoadInitialCallback<T>); |
| 178 | method @WorkerThread public abstract void loadRange(androidx.paging.PositionalDataSource.LoadRangeParams, androidx.paging.PositionalDataSource.LoadRangeCallback<T>); |
| 179 | method public final <V> androidx.paging.PositionalDataSource<V> map(androidx.arch.core.util.Function<T,V>); |
| 180 | method public final <V> androidx.paging.PositionalDataSource<V> mapByPage(androidx.arch.core.util.Function<java.util.List<T>,java.util.List<V>>); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 181 | } |
| 182 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 183 | public abstract static class PositionalDataSource.LoadInitialCallback<T> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 184 | ctor public PositionalDataSource.LoadInitialCallback(); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 185 | method public void onError(Throwable); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 186 | method public abstract void onResult(java.util.List<T>, int, int); |
| 187 | method public abstract void onResult(java.util.List<T>, int); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 188 | method public void onRetryableError(Throwable); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | public static class PositionalDataSource.LoadInitialParams { |
| 192 | ctor public PositionalDataSource.LoadInitialParams(int, int, int, boolean); |
| 193 | field public final int pageSize; |
| 194 | field public final boolean placeholdersEnabled; |
| 195 | field public final int requestedLoadSize; |
| 196 | field public final int requestedStartPosition; |
| 197 | } |
| 198 | |
Jeff Gaston | c21caf9 | 2018-10-16 13:24:41 -0400 | [diff] [blame] | 199 | public abstract static class PositionalDataSource.LoadRangeCallback<T> { |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 200 | ctor public PositionalDataSource.LoadRangeCallback(); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 201 | method public void onError(Throwable); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 202 | method public abstract void onResult(java.util.List<T>); |
Chris Craik | cf72bdc | 2018-10-18 13:32:02 -0700 | [diff] [blame] | 203 | method public void onRetryableError(Throwable); |
Chris Craik | 7cb6041 | 2018-04-04 13:02:50 -0700 | [diff] [blame] | 204 | } |
| 205 | |
| 206 | public static class PositionalDataSource.LoadRangeParams { |
| 207 | ctor public PositionalDataSource.LoadRangeParams(int, int); |
| 208 | field public final int loadSize; |
| 209 | field public final int startPosition; |
| 210 | } |
| 211 | |
| 212 | } |
| 213 | |