[go: nahoru, domu]

Add kotlin function types for broken SAM conversions for paging

Two cases here:
 - Public APIs received redundant overloads with kotlin function types
 - Private APIs were simply replaced with kotlin function types

Bug: 134963731
Test: ./gradlew paging:paging-common:check && ./gradlew paging:paging-runtime:cC
Change-Id: Ib4799e9242a9809f8e3ca30c73995ffa8335a0c7
diff --git a/paging/common/api/current.txt b/paging/common/api/current.txt
index a8178ad..cd07f54 100644
--- a/paging/common/api/current.txt
+++ b/paging/common/api/current.txt
@@ -3,6 +3,7 @@
 
   public abstract class DataSource<Key, Value> {
     method @AnyThread public void addInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
+    method @AnyThread public final void addInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
     method protected final java.util.concurrent.Executor getExecutor();
     method @AnyThread public void invalidate();
     method @WorkerThread public boolean isInvalid();
@@ -10,6 +11,7 @@
     method public <ToValue> androidx.paging.DataSource<Key,ToValue> map(androidx.arch.core.util.Function<Value,ToValue> function);
     method public <ToValue> androidx.paging.DataSource<Key,ToValue> mapByPage(androidx.arch.core.util.Function<java.util.List<Value>,java.util.List<ToValue>> function);
     method @AnyThread public void removeInvalidatedCallback(androidx.paging.DataSource.InvalidatedCallback onInvalidatedCallback);
+    method @AnyThread public final void removeInvalidatedCallback(kotlin.jvm.functions.Function0<kotlin.Unit> onInvalidatedCallback);
     property protected final java.util.concurrent.Executor executor;
     property @WorkerThread public boolean isInvalid;
   }
@@ -36,6 +38,10 @@
     method @AnyThread public void onInvalidated();
   }
 
+  public final class DataSourceKt {
+    ctor public DataSourceKt();
+  }
+
   public abstract class ItemKeyedDataSource<Key, Value> extends androidx.paging.ListenableItemKeyedDataSource<Key,Value> {
     ctor public ItemKeyedDataSource();
     method public final com.google.common.util.concurrent.ListenableFuture<androidx.paging.ListenableItemKeyedDataSource.Result<Value>> loadAfter(androidx.paging.ListenableItemKeyedDataSource.LoadParams<Key> params);
@@ -191,7 +197,7 @@
 
   public abstract class PagedList<T> extends java.util.AbstractList<T> {
     method public void addWeakCallback(java.util.List<? extends T>? previousSnapshot, androidx.paging.PagedList.Callback callback);
-    method public void addWeakLoadStateListener(androidx.paging.PagedList.LoadStateListener listener);
+    method public void addWeakLoadStateListener(kotlin.jvm.functions.Function3<? super androidx.paging.PagedList.LoadType,? super androidx.paging.PagedList.LoadState,? super java.lang.Throwable,kotlin.Unit> listener);
     method public abstract void detach();
     method public T? get(int index);
     method public androidx.paging.PagedList.Config getConfig();
@@ -205,7 +211,7 @@
     method public boolean isImmutable();
     method public void loadAround(int index);
     method public void removeWeakCallback(androidx.paging.PagedList.Callback callback);
-    method public void removeWeakLoadStateListener(androidx.paging.PagedList.LoadStateListener listener);
+    method public void removeWeakLoadStateListener(kotlin.jvm.functions.Function3<? super androidx.paging.PagedList.LoadType,? super androidx.paging.PagedList.LoadState,? super java.lang.Throwable,kotlin.Unit> listener);
     method public void retry();
     method public java.util.List<T> snapshot();
     property public androidx.paging.PagedList.Config config;
@@ -271,10 +277,6 @@
     enum_constant public static final androidx.paging.PagedList.LoadState RETRYABLE_ERROR;
   }
 
-  public static interface PagedList.LoadStateListener {
-    method public void onLoadStateChanged(androidx.paging.PagedList.LoadType type, androidx.paging.PagedList.LoadState state, Throwable? error);
-  }
-
   public enum PagedList.LoadType {
     enum_constant public static final androidx.paging.PagedList.LoadType END;
     enum_constant public static final androidx.paging.PagedList.LoadType REFRESH;