sephiroth74 / android-target-tooltip Goto Github PK
View Code? Open in Web Editor NEWCreate Toast like tooltips, but targets can be specified, plus custom properties and features
License: MIT License
Create Toast like tooltips, but targets can be specified, plus custom properties and features
License: MIT License
When I use the Android Material Navigation Drawer whith your tooltip lib, then the selected item in the Navigation Drawer is totally overlayed and you may not see the text and icon anymore.
When I remove your lib, then it works fine. Can you repair or give me a hint?
Is it possible to support version 10 of the SDK? I downloaded the library sometime ago and I use with min sdk 10. Now I moved to Android Studio and Gradle complains that library requires min sdk 14.
Maybe it make sense to keep tooltip separate from the View?
So tooltip responsibility is only to show "decorated" view. Remove all view setters including text and font.
And create new Builder for this specific view.
So api will look like this:
Tooltip.with(context)
.arrowWidth()
.arrowHeight()
....
.view(customView)
.showAt(point);
or
.showAt(anchorView);
where for custom view we can have one builtin text view builder with text, color, font and etc.
This way we don't have to block developers and wait while someone add more "styling options" for TextView.
as i touch on button on which i have to show tooltip , i can see a touch effect blinking again and again in green. how i can stop it or remove it as i can not see any style or method for that
From the docs i could get an idea how to specify the text color for the tooltip. Could you provide some more information please ?
if i create a tooltip from a dialog this tooltip is shown behind the dialog.
is there any chance to get it on top of the dialog?
thanks!
Please :)
please fix it
I don't know how to better describe this, but here is the screenshot:
http://tinypic.com/r/2ylqwdi/9
I set the overlay to false, but this is extremely strange. The view I'm showing a tooltip for is inside a fragment, and if it's of any help, the view color is the same as this overlays color. It could mean something.
Hi, I'm trying to use the tooltip library on 2 different activities of my project and when the 2nd should be shown this exception appears:
java.lang.NullPointerException: Attempt to invoke virtual method 'int android.view.View.getVisibility()' on a null object reference
at android.widget.FrameLayout.layoutChildren(FrameLayout.java:525)
at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
at android.view.View.layout(View.java:15654)
at android.view.ViewGroup.layout(ViewGroup.java:4969)
at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2102)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1859)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1078)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:5885)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:767)
at android.view.Choreographer.doCallbacks(Choreographer.java:580)
at android.view.Choreographer.doFrame(Choreographer.java:550)
at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:753)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:135)
at android.app.ActivityThread.main(ActivityThread.java:5376)
at java.lang.reflect.Method.invoke(Native Method)
at java.lang.reflect.Method.invoke(Method.java:372)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:908)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:703)
The code I'm using is
Tooltip.make(itemView.getContext(),
new Tooltip.Builder()
.withStyleId(R.style.ToolTipLayoutCustomStyle)
.anchor(itemView.findViewById(R.id.detail_choice_optionA), Tooltip.Gravity.BOTTOM)
.closePolicy(new Tooltip.ClosePolicy()
.insidePolicy(true, false)
.outsidePolicy(true, false), 5000)
.activateDelay(1500)
.showDelay(300)
.text(itemView.getResources().getString(R.string.tooltip_choice_text))
.maxWidth(400)
.withArrow(true)
.withOverlay(true)
.floatingAnimation(Tooltip.AnimationBuilder.DEFAULT)
.build()
).show();
Any hint what's happening? Thanks!
When using a custom style for the popup you may want to set the text color too. For now this seems only possible with creating a custom layout with the appropriate styling and setting it as custom view. Any chance to give the default textview a style that can be overwritten? Or am I missing something obvious?
Saving a reference to the Builder object returned by create() and calling show() multiple times on it seems not to work? What's the proper way to use a tooltip multiple times?
Thanks for the library. I was almost about to create one myself. I have a feature request — Will it be possible to add an option for scheduling tooltips. For instance, show this tooltip on the 3rd call.
Also, does this library show tooltips only once or every time they're called?
'containsTouch' indicates only if the tooltip view was touched.
Tooltip showing String but not showing String of numbers more than 4 digits
any idea ??
tried changing the typeface didn't help
My app was working fine until I changed my activity as a fragment. I have a custom gridview
The getView() method
gridViewAndroid = inflater.inflate(R.layout.imageandtextcombined,null);
TextView textViewAndroid = (TextView) gridViewAndroid.findViewById(R.id.textView1);
ImageView imageViewAndroid = (ImageView)gridViewAndroid.findViewById(R.id.imageView1);
final ImageView eye=(ImageView) gridViewAndroid.findViewById(R.id.imageButton);
final ImageButton tick=(ImageButton)gridViewAndroid.findViewById(R.id.imageButton2);
and the onClisk listner for 'eye' is
eye.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {
Tooltip.make(mcontext,
new Tooltip.Builder(101)
.anchor(eye, Tooltip.Gravity.BOTTOM)
.closePolicy(new Tooltip.ClosePolicy()
.insidePolicy(true, false)
.outsidePolicy(true, false), 3000)
.activateDelay(800)
.showDelay(300)
.text(serviceDescription[position])
.maxWidth(500)
.withArrow(true)
.withOverlay(true)
.floatingAnimation(Tooltip.AnimationBuilder.DEFAULT)
.build()
).show();
}
});
Getting following error while clicking on the 'eye' image
E/AndroidRuntime: FATAL EXCEPTION: main
Process: com.example.android.navigationdrawerexample, PID: 27698
java.lang.UnsupportedOperationException: Failed to resolve attribute at index 6: TypedValue{t=0x1c/d=0xff33b5e5 a=1 r=0x1060012}
at android.content.res.TypedArray.getColor(TypedArray.java:447)
at it.sephiroth.android.library.tooltip.TooltipOverlayDrawable.(TooltipOverlayDrawable.java:54)
at it.sephiroth.android.library.tooltip.TooltipOverlay.init(TooltipOverlay.java:25)
at it.sephiroth.android.library.tooltip.TooltipOverlay.(TooltipOverlay.java:37)
at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.(Tooltip.java:471)
at it.sephiroth.android.library.tooltip.Tooltip.make(Tooltip.java:71)
at com.example.android.navigationdrawerexample.ImageAdapter$2.onClick(ImageAdapter.java:90)
at android.view.View.performClick(View.java:5198)
at android.view.View$PerformClick.run(View.java:21147)
at android.os.Handler.handleCallback(Handler.java:739)
at android.os.Handler.dispatchMessage(Handler.java:95)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:616)
It's just no showing...
Activity activity = (Activity) getContext();
causes a crash using the current AppCompat-Lib as a TintContextWrapper is returned. (Tooltip line 287)
Used following lines to fix:
Activity activity = null;
for (Context c = getContext(); c != null; ) {
if (c instanceof Activity) {
activity = (Activity) c;
break;
} else if (c instanceof ContextWrapper) {
c = ((ContextWrapper) c).getBaseContext();
} else {
c = null;
}
}
Hi,
I got several not stable crashes with the same stacktrace on Android 4.0.4:
0java.lang.NullPointerException
1 at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.calculatePositions(Tooltip.java:978)
2 at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.calculatePositions(Tooltip.java:933)
3 at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.calculatePositions(Tooltip.java:925)
4 at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.onLayout(Tooltip.java:717)
5 at android.view.View.layout(View.java:11390)
6 at android.view.ViewGroup.layout(ViewGroup.java:4332)
7 at android.widget.FrameLayout.onLayout(FrameLayout.java:444)
8 at android.view.View.layout(View.java:11390)
9 at android.view.ViewGroup.layout(ViewGroup.java:4332)
10 at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:1490)
11 at android.view.ViewRootImpl.handleMessage(ViewRootImpl.java:2455)
12 at android.os.Handler.dispatchMessage(Handler.java:99)
13 at android.os.Looper.loop(Looper.java:137)
14 at android.app.ActivityThread.main(ActivityThread.java:4424)
15 at java.lang.reflect.Method.invokeNative(Native Method)
16 at java.lang.reflect.Method.invoke(Method.java:511)
17 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:817)
18 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:584)
19 at dalvik.system.NativeStart.main(Native Method)
Using 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15' version
Hi,
I got crash on Android 5.0.1:
0java.lang.NullPointerException: Attempt to read from field 'int android.graphics.Point.x' on a null object reference
1 at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.calculatePositions(Tooltip.java:978)
2 at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.calculatePositions(Tooltip.java:933)
3 at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.calculatePositions(Tooltip.java:925)
4 at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.onLayout(Tooltip.java:717)
5 at android.view.View.layout(View.java:16695)
6 at android.view.ViewGroup.layout(ViewGroup.java:5328)
7 at android.widget.FrameLayout.layoutChildren(FrameLayout.java:573)
8 at android.widget.FrameLayout.onLayout(FrameLayout.java:508)
9 at android.view.View.layout(View.java:16695)
10 at android.view.ViewGroup.layout(ViewGroup.java:5328)
11 at android.view.ViewRootImpl.performLayout(ViewRootImpl.java:2319)
12 at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:2032)
13 at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1191)
14 at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:6642)
15 at android.view.Choreographer$CallbackRecord.run(Choreographer.java:777)
16 at android.view.Choreographer.doCallbacks(Choreographer.java:590)
17 at android.view.Choreographer.doFrame(Choreographer.java:560)
18 at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:763)
19 at android.os.Handler.handleCallback(Handler.java:739)
20 at android.os.Handler.dispatchMessage(Handler.java:95)
21 at android.os.Looper.loop(Looper.java:145)
22 at android.app.ActivityThread.main(ActivityThread.java:5951)
23 at java.lang.reflect.Method.invoke(Native Method)
24 at java.lang.reflect.Method.invoke(Method.java:372)
25 at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1400)
26 at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:1195)
Using 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15' version
Hi,
I could use the sample that you have put in the github but when I use this library in my project, I am getting a crash.
I debugged and found that this.mTextView = (TextView)this.mView.findViewById(16908308);
(line no 858 in Tooltip.java) statement is returning null. I am using 1.3.12 version.
Let me know if I need to provide further details.
As titled.
It would be much more useful if I can customize arrow size
how to custom 96, use other number
I have custom layout with button. Button must have click event.
Can i use View to withCustomView? Or can i get View from Tooltip?
I'm trying understand why "custom view" loses the arrow.
I'm looking for this in source code, but I can not finding. 😞
Some help?
I can implement a fix for solve this.
Simply rotate the device while showing the tooltip and observe the tooltip position will be wrong after orientation change.
as titled, it seems it does not support to customize arrow height
In the TooltipTextDrawable Class line 42 thows an exception
int backgroundColor = theme.getColor(styleable.TooltipLayout_ttlm_backgroundColor, 0);
It looks like an issue by not using the ContextCompat Class
This is the code I use to create the Tooltip
Tooltip.make(_ctx, new Tooltip.Builder(101)
.anchor(this, Tooltip.Gravity.CENTER)
.closePolicy(new Tooltip.ClosePolicy().insidePolicy(true,true).outsidePolicy(true,true),3000)
.activateDelay(800)
.showDelay(300)
.maxWidth(300)
.floatingAnimation(Tooltip.AnimationBuilder.DEFAULT)
.text(getBubbleText())
.withArrow(true)
.withOverlay(true)
.build()).show();
04-04 16:20:41.200 16638-16638/com.bansi.pagomovil E/InputEventReceiver: Exception dispatching input event.
04-04 16:20:41.200 16638-16638/com.bansi.pagomovil E/MessageQueue-JNI: Exception in MessageQueue callback: handleReceiveCallback
04-04 16:20:41.220 16638-16638/com.bansi.pagomovil E/MessageQueue-JNI: java.lang.UnsupportedOperationException: Failed to resolve attribute at index 24: TypedValue{t=0x3/d=0x8dd "res/drawable-xxhdpi-v4/list_divider_holo_light.9.png" a=1 r=0x108048d}
at android.content.res.TypedArray.getColor(TypedArray.java:447)
at it.sephiroth.android.library.tooltip.TooltipTextDrawable.(TooltipTextDrawable.java:42)
at it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl.(Tooltip.java:477)
at it.sephiroth.android.library.tooltip.Tooltip.make(Tooltip.java:71)
A documentation on how close policy works is required. Where may I find it?
Especially, I want to know what does the consume
boolean means and does?
Hi @sephiroth74
Thanks for the good library, but unfortunately I have small error.
Resize tooltip doesn't work after change text (with different length).
So instead of use simple
TooltipManager.getInstance(activity).setText(TOOLTIP_ID, text)
I should re-create tooltip with a new text:
TooltipManager.getInstance(activity).remove(TOOLTIP_ID);
getTooltipBuilder().text(text).show();
I am seeing the following with LeakCanary. Is there a way to avoid this?
05-20 16:41:17.154 27916-28531/com.gmspartnersltd.earthmiles.debug D/LeakCanary﹕ In com.gmspartnersltd.earthmiles.debug:1.6:6.
* com.gmspartnersltd.earthmiles.views.mainthreetabs.rewardsfragment.RewardsSubFragment has leaked:
* GC ROOT static it.sephiroth.android.library.tooltip.TooltipManager.instances
* references java.util.concurrent.ConcurrentHashMap.table
* references array java.util.concurrent.ConcurrentHashMap$Node[].[7]
* references java.util.concurrent.ConcurrentHashMap$Node.val
* references it.sephiroth.android.library.tooltip.TooltipManager.mActivity
* references com.gmspartnersltd.earthmiles.views.MainActivity.mFragments
* references android.app.FragmentManagerImpl.mAdded
* references java.util.ArrayList.array
* references array java.lang.Object[].[0]
* references com.gmspartnersltd.earthmiles.views.mainthreetabs.rewardsfragment.RewardsFragment.mTabsLinearLayout
* references android.widget.LinearLayout.mParent
* references com.astuetz.PagerSlidingTabStrip.pager
* references android.support.v4.view.ViewPager.mAdapter
* references com.gmspartnersltd.earthmiles.views.mainthreetabs.rewardsfragment.RewardsSubTabAdapter.mFragments
* references java.util.ArrayList.array
* references array java.lang.Object[].[1]
* leaks com.gmspartnersltd.earthmiles.views.mainthreetabs.rewardsfragment.RewardsSubFragment instance
* Reference Key: 1bba5f56-2b65-4036-a117-1677014e0914
* Device: Genymotion generic Google Nexus 5 - 5.0.0 - API 21 - 1080x1920 vbox86p
* Android Version: 5.0 API: 21
* Durations: watch=5019ms, gc=117ms, heap dump=804ms, analysis=3932ms
I was using older version of your library.
My Compile SDK is 23
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.14'
But i found that your issue no #50 is closed in latest version.
So I update gradle line with
compile 'it.sephiroth.android.library.targettooltip:target-tooltip-library:1.3.15'
And I will not working with SDK 24.
If use 1.3.14 version lib. It start working.
Can u help me for this.
Or can you give any work around to solved issue #50 in your older version.
If I disable animations on android settings (developer mode) the tooltip animation go crazy.
Is there any way of fixing this?
1.3.14
Tooltip.make(getActivity(),
new Tooltip.Builder(101)
.anchor(view, Tooltip.Gravity.BOTTOM)
.closePolicy(new Tooltip.ClosePolicy()
.insidePolicy(true, false)
.outsidePolicy(false, false), 3000)
.activateDelay(800)
.showDelay(300)
.text(getString(R.string.share_tooltip))
.maxWidth((int)(mMainView.getWidth()*0.65))
.withArrow(true)
.withOverlay(false)
.fitToScreen(true)
.withStyleId(R.style.TooltipPrimary)
.floatingAnimation(Tooltip.AnimationBuilder.SLOW)
.build()
).show();
Ps. Thanks for the lib, its great!
This is more of a question than an issue, so you can close it without even answering!
Anyhow, in documentation I couldn't find if this library works for showing tooltips for toolbar items.
I wasn't sure where to ask questions so sorry if this is the wrong place. I can't figure out a way to control the minimum width of the tooltip. Essentially I need the tooltip to extend the entire width of the activity or dialog depending on where it is used.
Thanks.
I very appreciate to you for your awesome library!
I found that you use this.mTextView.setText(Html.fromHtml((String)this.mText)).
But Html.fromHtml was deprecated in Android N. Could you please fix this?http://stackoverflow.com/questions/37904739/html-fromhtml-deprecated-in-android-n
From Android Arsenal the minimumSDK is indicated 9.
http://android-arsenal.com/details/1/1240
For higher versions it works, but for api 10 i get this error.
java.lang.NoClassDefFoundError: it.sephiroth.android.library.tooltip.Tooltip$TooltipViewImpl$1
Error:(1, 0) Cause: com/android/build/gradle/AppPlugin : Unsupported major.minor version 52.0
How do you modify the font color ?
i have this bug when i try use a custom view ,
java.lang.NullPointerException: Attempt to invoke virtual method 'int java.lang.String.length()' on a null object reference
my code :
Tooltip.make(anchor.getContext(),
new Tooltip.Builder(101)
.closePolicy(new Tooltip.ClosePolicy()
.insidePolicy(true, false)
.outsidePolicy(true, false), 30000)
.activateDelay(800)
.showDelay(300)
.withArrow(true)
.withOverlay(true)
.floatingAnimation(Tooltip.AnimationBuilder.SLOW)
.withStyleId(R.style.ToolTipLayoutCustomStyle)
.withCustomView(ResId, true)
.anchor(anchor, gravity)
.build()
).show();
Error:(172, 43) error: cannot find symbol variable abc_ic_ab_back_mtrl_am_alpha
Is there a way to turn off the little bubble that animates in the centre of the view that you tapped on?
It's showing behind my view and looks very weird. I would prefer to turn it off, is that possible?
On a side note, without using a custom view, can I change the text colour? Seems like it should be part of the builder but I can't find a method to indicate so.
Thanks.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.