From 38ac8d7459179b0f2f601b6e3f1e188dab15e7a8 Mon Sep 17 00:00:00 2001 From: jiaokang Date: Wed, 1 Jul 2020 19:42:24 +0800 Subject: [PATCH 1/2] =?UTF-8?q?=E4=BF=AE=E5=A4=8DshowPreviewPage=E6=97=A0?= =?UTF-8?q?=E6=B3=95=E6=AD=A3=E7=A1=AE=E7=94=9F=E6=95=88=E7=9A=84=E9=97=AE?= =?UTF-8?q?=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- guide/src/main/java/com/app/hubert/guide/core/Controller.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/guide/src/main/java/com/app/hubert/guide/core/Controller.java b/guide/src/main/java/com/app/hubert/guide/core/Controller.java index d6ccd8f..4d42cc9 100644 --- a/guide/src/main/java/com/app/hubert/guide/core/Controller.java +++ b/guide/src/main/java/com/app/hubert/guide/core/Controller.java @@ -157,7 +157,7 @@ public void onGuideLayoutDismiss(GuideLayout guideLayout) { * 显示当前引导页的前一页 */ public void showPreviewPage() { - showPage(--current); + showPage(current - 1); } /** From ca8dfa7fc4a5164d3d49a8728ba8ff00aa02c81a Mon Sep 17 00:00:00 2001 From: jiaokang Date: Wed, 1 Jul 2020 19:43:21 +0800 Subject: [PATCH 2/2] =?UTF-8?q?=E4=B8=BARelativeGuide=E6=B7=BB=E5=8A=A0OnL?= =?UTF-8?q?ayoutInflatedListener?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/app/hubert/guide/model/RelativeGuide.java | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/guide/src/main/java/com/app/hubert/guide/model/RelativeGuide.java b/guide/src/main/java/com/app/hubert/guide/model/RelativeGuide.java index f3b8456..a4b979e 100644 --- a/guide/src/main/java/com/app/hubert/guide/model/RelativeGuide.java +++ b/guide/src/main/java/com/app/hubert/guide/model/RelativeGuide.java @@ -11,6 +11,7 @@ import com.app.hubert.guide.core.Controller; import com.app.hubert.guide.util.LogUtil; +import com.app.hubert.guide.listener.OnLayoutInflatedListener; import java.lang.annotation.Retention; import java.lang.annotation.RetentionPolicy; @@ -52,11 +53,19 @@ public String toString() { public int padding; public int gravity; + private OnLayoutInflatedListener mListener; + public RelativeGuide(@LayoutRes int layout, @LimitGravity int gravity) { this.layout = layout; this.gravity = gravity; } + public RelativeGuide(@LayoutRes int layout, @LimitGravity int gravity , OnLayoutInflatedListener listener) { + this.layout = layout; + this.gravity = gravity; + this.mListener = listener; + } + /** * @param layout 相对位置引导布局 * @param gravity 仅限left top right bottom @@ -133,6 +142,9 @@ protected void onLayoutInflated(View view) { * @param controller controller */ protected void onLayoutInflated(View view, Controller controller) { - //do nothing + // 调用自身onLayoutInflated listener + if (mListener != null){ + mListener.onLayoutInflated(view,controller); + } } }