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); } /** 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); + } } }