From c25ceb51baad063f951ae5842033f33291733f7e Mon Sep 17 00:00:00 2001 From: Oleksandr Kucherenko Date: Tue, 23 Jun 2020 16:36:33 +0200 Subject: [PATCH] added sample for creator method usage --- .../olku/autoproxy/sample/KotlinAbstractMvpView.kt | 2 +- .../com/olku/autoproxy/sample/MainActivity.java | 13 +++++++------ .../java/com/olku/autoproxy/sample/MvpView.java | 5 +++-- 3 files changed, 11 insertions(+), 9 deletions(-) diff --git a/sample/src/main/java/com/olku/autoproxy/sample/KotlinAbstractMvpView.kt b/sample/src/main/java/com/olku/autoproxy/sample/KotlinAbstractMvpView.kt index d6b660d..3fa8a00 100644 --- a/sample/src/main/java/com/olku/autoproxy/sample/KotlinAbstractMvpView.kt +++ b/sample/src/main/java/com/olku/autoproxy/sample/KotlinAbstractMvpView.kt @@ -6,7 +6,7 @@ import com.olku.generators.JustRxGenerator import com.olku.generators.RetRxGenerator import rx.Observable -@AutoProxy(flags = AutoProxy.Flags.ALL) +@AutoProxy(flags = AutoProxy.Flags.CREATOR) abstract class KotlinAbstractMvpView { /** Returns NULL if predicate returns False. */ @AutoProxy.Yield(Returns.NULL) diff --git a/sample/src/main/java/com/olku/autoproxy/sample/MainActivity.java b/sample/src/main/java/com/olku/autoproxy/sample/MainActivity.java index ec5fa49..583f489 100644 --- a/sample/src/main/java/com/olku/autoproxy/sample/MainActivity.java +++ b/sample/src/main/java/com/olku/autoproxy/sample/MainActivity.java @@ -21,12 +21,13 @@ protected void onCreate(Bundle savedInstanceState) { @NonNull public MvpView getProxy() { - return new Proxy_MvpView(this) { - @Override - public boolean predicate(@M @NonNull String methodName, Object... args) { - return !isFinishing(); - } - }; + return Proxy_MvpView.create(this, (methodName, args) -> !isFinishing()); +// return new Proxy_MvpView(this) { +// @Override +// public boolean predicate(@M @NonNull String methodName, Object... args) { +// return !isFinishing(); +// } +// }; } //region View interface diff --git a/sample/src/main/java/com/olku/autoproxy/sample/MvpView.java b/sample/src/main/java/com/olku/autoproxy/sample/MvpView.java index 00f2ebe..07c8b48 100644 --- a/sample/src/main/java/com/olku/autoproxy/sample/MvpView.java +++ b/sample/src/main/java/com/olku/autoproxy/sample/MvpView.java @@ -2,6 +2,8 @@ import android.net.Uri; +import androidx.annotation.NonNull; + import com.olku.annotations.AutoProxy; import com.olku.annotations.RetBool; import com.olku.annotations.RetNumber; @@ -12,11 +14,10 @@ import java.util.List; -import androidx.annotation.NonNull; import rx.Observable; /** MVP view interface. */ -@AutoProxy +@AutoProxy(flags = AutoProxy.Flags.CREATOR) public interface MvpView { /** Returns NULL if predicate returns False. */ @AutoProxy.Yield(Returns.NULL)