Giter Site home page Giter Site logo

Comments (10)

faruktoptas avatar faruktoptas commented on June 2, 2024

Please check this example:

from fancyshowcaseview.

rr-akshay-dave avatar rr-akshay-dave commented on June 2, 2024

@faruktoptas Thanks. I checked it out.
That sample works if a focus view is not dynamic (e.g regular view vs list item view). For focus view that is dynamic the calculations don't always work.

from fancyshowcaseview.

faruktoptas avatar faruktoptas commented on June 2, 2024

Calculations are done when build() method is called with a view. If you build your FancyShowCaseView instance after inflation of target view it should work.

from fancyshowcaseview.

rr-akshay-dave avatar rr-akshay-dave commented on June 2, 2024

@faruktoptas Thanks for taking time to respond. I am doing calculations in the .customView() method during the build time like below

    .customView(R.layout.my_custom_view, object : OnViewInflateListener {
                override fun onViewInflated(view: View) {
                    val params = view.layoutParams as FrameLayout.LayoutParams
                    view.post {
                       // This works
                        params.leftMargin = fancyShowCaseView.focusCenterX - view.width / 2
                        view.layoutParams = params
                    }

                   // some code for init
                     ...
                      ...


                    // Get the layout param of top level view group of custom view
                    val customView = (view as LinearLayout).findViewById<LinearLayout>(R.id.customView)
                    val customViewParamParams = customView.layoutParams as FrameLayout.LayoutParams
                    
                    // Adjust the top margin for custom view so that it's on top of focused view.
                    // This calculation is guesstimate, and DOESN'T WORK when the focused view's height changes dynamically
                    customViewParams.topMargin =
                        fancyShowCaseView.focusCenterY - fancyShowCaseViewView.focusHeight - focusedView.measuredHeight / 2
                    customView.layoutParams = customViewParams
                }
            })

Let me know if you see something wrong.

from fancyshowcaseview.

faruktoptas avatar faruktoptas commented on June 2, 2024

Can you share a screenshot to see more details about buggy behaviour.

from fancyshowcaseview.

rr-akshay-dave avatar rr-akshay-dave commented on June 2, 2024

Sure. Device Pixel 3 A (but it's same behavior on any other Pixel emulators)

Context Use case 1 :

  • I created list view with 4 textviews in each list item. I am highlighting item # 5 in the list
  • I am showing all 4 text views in this case. Notice how custom view is nicely on top
  • Screen shot 1:
    image

Context Use case 2 :

  • I am showing only 2 text views out of 4 text views in this case. Notice how custom view is off
  • Screen shot 2:
    image

from fancyshowcaseview.

rr-akshay-dave avatar rr-akshay-dave commented on June 2, 2024

Btw, I appreciate you taking time to respond. I am happy to DM you on twitter or something to save time for both if that works for you.

from fancyshowcaseview.

rr-akshay-dave avatar rr-akshay-dave commented on June 2, 2024

Hello @faruktoptas , just following up. Let me know if you need anything else on this from my end.

from fancyshowcaseview.

DevHisham avatar DevHisham commented on June 2, 2024

i faced same issue

from fancyshowcaseview.

faruktoptas avatar faruktoptas commented on June 2, 2024

@rr-akshay-dave @DevHisham
My apologies for the delayed response. If this is an active issue for you please let me know.

from fancyshowcaseview.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.