B4A Library MSShowTips

thedesolatesoul

Expert
Licensed User
Based on: https://github.com/fredericojssilva/ShowTipsView

This library is able to highlight or showcase views in your activity. This is extremely useful for on-boarding tutorials and explaining what things do.



http://i.imgur.com/m8SpBiq.png
http://i.imgur.com/y5fAezU.png


MSShowTips
Version:
0.9
  • MSShowTipsBuilder
    Events:
    • Click
    Methods:
    • Initialize (EventName As String)
    • IsInitialized As Boolean
    • build As BuilderWrapper
    • displayOneTime (showtipId As Int) As BuilderWrapper
    • setBackgroundColor (color As Int) As BuilderWrapper
    • setCircleColor (color As Int) As BuilderWrapper
    • setDelay (delay As Int) As BuilderWrapper
    • setDescription (text As String) As BuilderWrapper
    • setDescriptionColor (color As Int) As BuilderWrapper
    • setTarget (v As View) As BuilderWrapper
    • setTitle (text As String) As BuilderWrapper
    • setTitleColor (color As Int) As BuilderWrapper
    • show


Very simple to use:
B4X:
Dim Tips As MSShowTipsBuilder
    Tips.Initialize("Tips")
    Tips.setTarget(Button1).setTitle("Button").setDescription("This is a button").build
    Tips.setDelay(1000)
    Tips.show
Setup:
Make sure to point your additional res to the extracted location:
B4X:
#AdditionalRes: H:\MyProjects\Github_masters\ShowTipsView-master\ShowTipsView-master\res
ToDo:
Add method Button.setText or expose the Text property.
Add Right-to-left text. Dont know how to do it.
Add setTarget(v,x,y,r) method.
 

Attachments

Last edited:

thedesolatesoul

Expert
Licensed User
May i ask you for a small (java) code-snippet to see what you have done to realize using such "chained"-commands?
Basically it is a 'builder' coding pattern. This library is probably not the best example as the .build() method does nothing.
The idea is that the builder class, actually contains a local variable of the actual class, and assigns its properties using chaining, and the the .build() method finalizes the class.

Chaining is very easy because you just return the same object.
B4X:
public BuilderWrapper setTarget(View v){
   this.getObject().setTarget(v);
   return this;
}
Since it keeps returning itself, you can chain it.

You can do the same thing with a B4A class/library as well. Just return Me. (Although I have never tried so far, I did intend to).
 

bluedude

Well-Known Member
Licensed User
Hi,

Normally I use strings.xml but because this one is just a button I would say .Text property.
 

MhdBoy

Member
Licensed User
hi
how i can change the direction of title?
the deafult is Left To Right and when i write Persian text for the title it isn't well!
please create the Right To Left mathod
tnx a lot
 

jotaele

Member
Licensed User
Nice Job!!

As @bluedude saids, it was interesting to put the method "Text" to customize then text of the button.

Trying to change the text , I saw that the library has this method:

setTarget (View v , int x, int y , int radius )

It would be also very interesting.

thx

EDIT: I changed your xml file to use the second target method and its working.

<method>
<name>setTarget</name>
<comment></comment>
<returntype>com.maximussoft.showtips.BuilderWrapper</returntype>
<parameter>
<name>v</name>
<type>android.view.View</type>
</parameter>
<parameter>
<name>x</name>
<type>int</type>
</parameter>
<parameter>
<name>y</name>
<type>int</type>
</parameter>
<parameter>
<name>radius</name>
<type>int</type>
</parameter>
</method>

But I want two methods at time and I tried to compile the wrapper again but it was imposible.

I want to change the text of the button, and recompile your jar.

Can somebody help me?

Thanks
 
Last edited:

jotaele

Member
Licensed User
I've added it to my ToDo list (at the top post), but currently I have no schedule to fix it.
Excuse me but

I do not know if it's a stupid question , but I've been trying to RE-create a wrapper like yours with the latest version of the library frederico silva.

Is YOUR source code needed to recompile the .jar file? I would interested in update the B4A library with this two methods.

Thanks
 

thedesolatesoul

Expert
Licensed User
Excuse me but

I do not know if it's a stupid question , but I've been trying to RE-create a wrapper like yours with the latest version of the library frederico silva.

Is YOUR source code needed to recompile the .jar file? I would interested in update the B4A library with this two methods.

Thanks
Now I come to think of it, it may actually be faster for me to fix the library than trying to understand your incomprehensible questions ;)

Jokes aside, I have no clue what you mean.
 

jotaele

Member
Licensed User
Now I come to think of it, it may actually be faster for me to fix the library than trying to understand your incomprehensible questions ;)

Jokes aside, I have no clue what you mean.
What I meant was that wanted to do the same job you did.

I wanted to recreate the wrapper for this library, downloading packages frederico silva , and rewrite your BuilderWrapper.java file and recompile .jar file.

I was reading about creating a wrapper library for existing java library in B4A , but I have not managed to do after two days of testing with eclipse , in SLC , ... Problems dependencies and other things.

I know php, mysql, .net, etc, but very very few things of java. May be this was the problem. :)
 

thedesolatesoul

Expert
Licensed User
What I meant was that wanted to do the same job you did.

I wanted to recreate the wrapper for this library, downloading packages frederico silva , and rewrite your BuilderWrapper.java file and recompile .jar file.

I was reading about creating a wrapper library for existing java library in B4A , but I have not managed to do after two days of testing with eclipse , in SLC , ... Problems dependencies and other things.

I know php, mysql, .net, etc, but very very few things of java. May be this was the problem. :)
It is actually very simple. I can send you the source code, if that accomplishes the transfer of knowledge. In return you would have host a VPS for me. :)
 
Top