Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FancyShowCaseView not hiding #161

Closed
ReddyAswiniReddy opened this issue Sep 30, 2019 · 6 comments · May be fixed by #169
Closed

FancyShowCaseView not hiding #161

ReddyAswiniReddy opened this issue Sep 30, 2019 · 6 comments · May be fixed by #169
Milestone

Comments

@ReddyAswiniReddy
Copy link

ReddyAswiniReddy commented Sep 30, 2019

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()
}
}
}

@faruktoptas
Copy link
Owner

Did you checked that fancyShowCaseView is not null.

@bhoomishah20
Copy link

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.

@Rajnish23
Copy link
Contributor

Rajnish23 commented Oct 29, 2019

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()
            }

@faruktoptas
Copy link
Owner

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?

@bhoomishah20
Copy link

@faruktoptas yes

@faruktoptas faruktoptas added this to the 1.3.0 milestone Nov 12, 2019
@faruktoptas
Copy link
Owner

This issue must be fixed with the latest version.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants