faruktoptas / FancyShowCaseView

An easy-to-use customisable show case view with circular reveal animation.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FancyShowCaseView not hiding

ReddyAswiniReddy opened this issue · comments

FancyShowCaseView not hiding

I'm using custom View
In that layout on click of one of the button im calling " fancyShowCaseView?.hide()"
Still Some times show case view is not hiding.

please find my code below how i'm setting Listener for that.

Example:
var fancyShowCaseListener = object : OnViewInflateListener {
override fun onViewInflated(view: View) {
view.btnOk?.setOnClickListener {
fancyShowCaseView?.hide()
}
}
}

Did you checked that fancyShowCaseView is not null.

Hello @ReddyAswiniReddy , I have also faced the same issue, For me it was initializing fancyShowCaseView two times, and hence I was not able to hide on click of view.
Check if you're facing same or not. Just check it should initialize once only.

Hello @ReddyAswiniReddy , I tried using customview. I added log in onClickListener, on multilple click of custom view FancyShowCaseView is getting initializing again and again. Below are the logs what I got.

2019-10-29 12:04:45.071 29166-29166/me.toptas.fancyshowcasesample D/Initialize: View
2019-10-29 12:04:46.208 29166-29166/me.toptas.fancyshowcasesample D/Initialize: View
2019-10-29 12:04:46.705 29166-29166/me.toptas.fancyshowcasesample D/Initialize: View
2019-10-29 12:04:47.043 29166-29166/me.toptas.fancyshowcasesample D/Initialize: View
2019-10-29 12:04:47.211 29166-29166/me.toptas.fancyshowcasesample D/Initialize: View

To Avoid these I added this two lines and everything works out as supposed to be.

if(FancyShowCaseView.isVisible(this)){
                FancyShowCaseView.hideCurrent(this);
            }else {
                mFancyShowCaseView = FancyShowCaseView.Builder(this)
                        .focusOn(it)
                        .enableTouchOnFocusedView(true)
                        .customView(R.layout.layout_my_custom_view_arrow, object : OnViewInflateListener {
                            override fun onViewInflated(view: View) {
                                val image = (view as RelativeLayout).findViewById<ImageView>(R.id.iv_custom_view)
                                val params = image.layoutParams as RelativeLayout.LayoutParams
                                val calculator = mFancyShowCaseView!!.focusCalculator!!

                                image.post {
                                    params.leftMargin = calculator.circleCenterX - image.width / 2
                                    params.topMargin = calculator.circleCenterY - calculator.focusHeight - image.height
                                    image.layoutParams = params
                                }

                                view.findViewById<View>(R.id.btn_action_1).setOnClickListener(mClickListener)
                            }
                        })
                        .closeOnTouch(false)
                        .build()

                mFancyShowCaseView?.show()
            }

I saw a problem with custom views. FancyImageView is being added into the show case multiple times. But it still can be hidden. @bhoomishah20 @ReddyAswiniReddy is this your bug?

This issue must be fixed with the latest version.