sephiroth74 / android-target-tooltip

Create Toast like tooltips, but targets can be specified, plus custom properties and features
MIT License
1.49k stars 278 forks source link

Positioning issues when upgrading from 1.x to 2.x #149

Open yuvalgnessin-qz opened 3 years ago

yuvalgnessin-qz commented 3 years ago

Hello, thank you for the great library!

I would like to update my project from using 1.x version of the library to 2.x, but unfortunately there is no upgrade guide. I did my best to try to transfer the logic over as identically as possible, but I've ran into several issues.

The biggest issue so far is that it's not clear what to pass for parent when calling .show() on the tooltip. The old version of the library didn't have such a construct. I've tried passing the view itself, I've tried passing the root view, I've tried passing the parents, but no matter what I do some of my tooltips don't appear anchored in the correct place. What should the argument for parent be, and how can I debug why my tooltips aren't anchored correctly?

Similarly, I'm not sure what to pass to fitToScreen to retain behavior from before. For example, I have a view that lives in the top-right corner of my toolbar that I'd like to use as an anchor for a tooltip. Previously, the tooltip was initialized with Gravity.BOTTOM and the tooltip correctly appeared underneath, with the arrow offset such that the whole tooltip was in the screen. But after migrating to 2.x, the tooltip gets cut off by the right side of the screen. If I set fitToScreen = true, the tooltip is no longer cut off, but now it appears to the left of the anchor instead of underneath.

I would really appreciate some advice on how to resolve both of these issues, as well as perhaps a general guide on how to migrate from 1.x to 2.x without regressions. This process would also be a lot easier if the library had documentation, as requested in #147. I've been resorting to reading through the code to try to understand what it's doing, but even the code itself is not documented.

Once again, thank you so much for this library, and I hope someone can help me!