Coder Social home page Coder Social logo

Comments (3)

tomergoldst avatar tomergoldst commented on August 16, 2024

Hey,

The method of moving the tooltip into correct position after content change is subject to recalculate the updated tooltip size and basicly is equivalent to adding a new tooltip.
Have you tried to just remove the existing tooltip and add a new one with the updated content?
If you did tried that and still want an option to update the tooltip content, can you explain in more details how it will help you?

from tooltips.

mkilp avatar mkilp commented on August 16, 2024

Hey,
The thing is: I'm currently displaying a tooltip called by an onTextChanged listener. Which means there are alot of updates to the tooltip depending on whats entered inside my app.
Currently I get the tooltip view via the Tooltip manager, edit the text and translate the new X center to the center of the anchor view.

Sidenote: Quick question, do you know how to make your tooltips work inside a popup window?
I'm building up the tips via

    EditText currentJoins = popUpView.findViewById(R.id.currentjoins);
    EditText maxJoins = popUpView.findViewById(R.id.maxjoins);

    ToolTip.Builder currentJoinsBuilder = new ToolTip.Builder(mainLayout.getContext(), currentJoins,
        mainLayout,
        getString(R.string.help_current_members), ToolTip.POSITION_LEFT_TO);
    currentJoinsBuilder.setBackgroundColor(getColor(R.color.btOrange));
    currentJoinsBuilder.setTextAppearance(R.style.TooltipTextAppearance);

    ToolTip.Builder maxJoinsBuilder = new ToolTip.Builder(mainLayout.getContext(), maxJoins,
        mainLayout,
        getString(R.string.help_maximum_members), ToolTip.POSITION_RIGHT_TO);
    maxJoinsBuilder.setBackgroundColor(getColor(R.color.btOrange));
    maxJoinsBuilder.setTextAppearance(R.style.TooltipTextAppearance);

and after the popupwindow is shown:

    popupWindow = new PopupWindow(popUpView, width, height, focusable);
    popupWindow.setAnimationStyle(R.style.Animation);
    //show the popup
    popupWindow.showAtLocation(mainLayout, Gravity.CENTER, 0, 0);

    mToolTipsManager.show(currentJoinsBuilder.build());
    mToolTipsManager.show(maxJoinsBuilder.build());

But it seems to not work sadly. Any ideas?

from tooltips.

tomergoldst avatar tomergoldst commented on August 16, 2024

As I can understand from your example it seems that using the ToolTips library for your case is not the best choice. You are trying to achive a badge effect more then a tooltip effect. I would recommend you to create the currentJoin view and maxJoin view as part of your layout with a drawable as background and then you'll won't have any issue to update the text cause the layout constraints will make sure it will always be centered.

Regarding your sidenote, A quick check reveal that the coordinator finder return wrong values when trying to find the location of the popupWindow thus placing the tooltip at a wrong position out of visible area.

from tooltips.

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.