B4A Class DOTips 2.5 - show an overlay for app tips

Discussion in 'Additional libraries, classes and official updates' started by Dave O, May 31, 2015.

  1. Dave O

    Dave O Active Member Licensed User

    Hi all, I've uploaded version 1.4:
    - Added maskAlpha property to control the transparency of the text/button area.
    - Added nextButtonColor and nextButtonTextColor to control the appearance of the Next button.
     
  2. jotaele

    jotaele Member Licensed User

    Amazing. Thanks. :)
     
    Last edited: Jun 11, 2015
  3. Dave O

    Dave O Active Member Licensed User

    Hi all, I've uploaded version 1.5:
    - Changed maskAlpha to maskColor.

    If you already use maskAlpha, this will break your code (slightly).

    If you don't already use maskAlpha, nothing will be affected.

    This change lets you set a mask color that's completely different from the background, if you wish.

    If you don't set an explicit mask color, it will default to a darker shade of the background color (as it did before).
     
  4. tpakis

    tpakis Active Member Licensed User

    Thank you for this excellent class!!
     
    Dave O likes this.
  5. ™AsAs4242

    ™AsAs4242 Member Licensed User

    "Show" sub no visible...
    plz see pic
     

    Attached Files:

  6. Dave O

    Dave O Active Member Licensed User

    Hmm, that's strange. Are you able to run the demo app? If so, compare that to your own code.

    If you look at the DOTips class itself, you should be able to see the Show sub, and it should be defined as public.

    Better yet, if you can upload your source code (or a simple version of it that shows the same problem), I can look at it today.

    Thanks!
     
    ™AsAs4242 likes this.
  7. Dave O

    Dave O Active Member Licensed User

    Hi all, I've uploaded version 1.7:
    - added OnHide event to handle optional actions after tips are closed
    - text for titles and descriptions now auto-scales (but button text doesn't (yet))

    Note that the Initialize method now has a few extra arguments (really easy, see the demo code).

    Also note that the text auto-scaling should make the title and description text appear roughly the same relative size on all devices. (Previously, it would appear much smaller on larger displays like tablets.) Check the new text sizes on various devices and adjust as you see fit (although I think the default sizes should be good for most folks).

    Thanks!
     
    susu likes this.
  8. hibrid0

    hibrid0 Active Member Licensed User

    thank you for share!
     
  9. hibrid0

    hibrid0 Active Member Licensed User

    Hi I insert the DOTips in my project, I insert this on Activity_create


    Code:
    tips.addGeneralTip("Title text""Text text Texto.")
        tips.DoneText=
    "Go!"
        tips.show
    But not showed on activity create on first run, the tips show if I continue to the next activity and back to the activity content the tip, but I need to show it starting the app.
     
    Last edited: Nov 20, 2015
  10. Dave O

    Dave O Active Member Licensed User

    In activity.create, I avoid doing GUI stuff because the views are still being drawn and strange things sometimes happen.

    In my apps, if I have tips to show when the activity launches, I do that in activity_resume.

    Let me know if this helps. Cheers!
     
    Last edited: Feb 13, 2016
    hibrid0 likes this.
  11. hibrid0

    hibrid0 Active Member Licensed User

    Hey thanks for this very nice Class.
    Hi I'm here again, I solved the problem on starting the DOTips, work perfect on load.
    Now I have a small problem, If I use the Tips.addTipForView and add a view work fine, but in my activities I have an Scrollview and panels, if I use tips.addTipForView (A view inside of scrollview), the class crash.

    Code:
    ** Service (starter) Create **
    ** 
    Service (starter) Start **
    ** 
    Activity (main) Create, isFirst = true **
    ** 
    Activity (main) Resume **
    Error occurred on line: 
    751 (DOTips)
    java.lang.ClassCastException: android.widget.FrameLayout$LayoutParams cannot be cast 
    to anywheresoftware.b4a.BALayout$LayoutParams
        at anywheresoftware.b4a.objects.ViewWrapper.getLeft(ViewWrapper.java:
    150)
        at XXXX.XXXXX.dotips._getabsoluteposition(dotips.java:
    1116)
        at XXXX.XXXXX.dotips._getabsoluteposition(dotips.java:
    1113)
        at XXXX.XXXXX.dotips._getabsoluteposition(dotips.java:
    1113)
        at XXXX.XXXXX.dotips._settargetrectfromview(dotips.java:
    2006)
        at XXXX.XXXXX.dotips._show(dotips.java:
    359)
        at XXXX.XXXXX.dotips._tipsnextbutton_click(dotips.java:
    2188)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:
    511)
        at anywheresoftware.b4a.shell.Shell.runMethod(
    Shell.java:697)
        at anywheresoftware.b4a.shell.Shell.raiseEventImpl(
    Shell.java:339)
        at anywheresoftware.b4a.shell.Shell.raiseEvent(
    Shell.java:246)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:
    511)
        at anywheresoftware.b4a.ShellBA.raiseEvent2(ShellBA.java:
    134)
        at anywheresoftware.b4a.BA.raiseEvent(BA.java:
    153)
        at anywheresoftware.b4a.objects.ViewWrapper$
    1.onClick(ViewWrapper.java:78)
        at android.view.View.performClick(
    View.java:4204)
        at android.view.View$PerformClick.run(
    View.java:17355)
        at android.os.Handler.handleCallback(Handler.java:
    725)
        at android.os.Handler.dispatchMessage(Handler.java:
    92)
        at android.os.Looper.loop(Looper.java:
    137)
        at android.app.ActivityThread.main(ActivityThread.java:
    5041)
        at java.lang.reflect.Method.invokeNative(Native Method)
        at java.lang.reflect.Method.invoke(Method.java:
    511)
        at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:
    793)
        at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:
    560)
        at dalvik.system.NativeStart.main(Native Method)
    ** 
    Activity (main) Pause, UserClosed = true **
     
  12. Dave O

    Dave O Active Member Licensed User

    Hmm, that may be because scrollviews use a different layout scheme than normal views?

    I'll experiment a bit to see if I can get this working. Thanks for reporting it!
     
  13. nwhitfield

    nwhitfield Active Member Licensed User

    This is a great class; just what I needed for a final polish on one of my apps.

    One suggestion, though - would it be possible to add a flag passed to the onHide sub, so I could do something like

    Code:
    Sub tips_OnHide ( complete As Boolean )
    If complete Then
     StateManager.SetSetting(
    "tipsShown","yes")
     StateManager.SaveSettings
    End if
    End sub
    Which would then mean that at the start of my app I could say something like

    Code:
    If StateManager.GetSetting2("tipsShown","no") <> "yes" then tips.Show
    The idea is that 'complete' would be true if and only if the user has gone through all the tips to the end. If they hide them with the Back button, for example, they'll still get the help the next time the app starts.
     
    Dave O likes this.
  14. DonManfred

    DonManfred Expert Licensed User

    You already have the source; extend it like you wish and reshare the class then
     
  15. Dave O

    Dave O Active Member Licensed User

    Good idea.

    I'm thinking, though, that instead of forcing the user to view all the tips again, it might be more considerate to show them only the tips they had skipped.

    To allow for both cases, the OnHide event could return the # of tips remaining (i.e. skipped) instead of a simple yes/no:
    • tipsRemaining = 0 means that the tips are complete, and you can use your logic above.
    • tipsRemaining > 0 means that, optionally, the next time you show tips, you could do some simple list adjustment (e.g. build your list and then subtract the # of tips they already saw), so that you only show them the tips they skipped.
    Let me know what you think. Either way, it looks like an easy improvement for me to add.
     
    nwhitfield likes this.
  16. nwhitfield

    nwhitfield Active Member Licensed User

    Yes, that would work just as well.
     
  17. Dave O

    Dave O Active Member Licensed User

    Hi all, I've uploaded version 1.8:
    - OnHide event now returns # of tips skipped

    As always, let me know if anything seems amiss.

    Thanks!
     
  18. Dave O

    Dave O Active Member Licensed User

    Hi @hibrid0 , I finally got some time to update this class and I was finally able to solve the scrollview problem you reported.

    If you have a chance, please download version 2.0 of this class and let me know if it works for you.

    Cheers!
     
  19. Dave O

    Dave O Active Member Licensed User

    Hi all, I've uploaded version 2.0. This is a major update that adds:
    - picture tips
    - the ability to resume tips after an orientation change (requires a few lines of code - see the demo app)
    - support for scrollviews
    - a demo app that lets you try ALL the properties, and that shows the use of scrollviews and screen rotation.

    Note: when updating, if you're using the OnHide event, check that your sub signature includes the new parameter added in v1.8. (B4A will not spot an invalid sub signature for this event at compile time, but it will crash on calling OnHide if you use the old parameter-less signature.)

    As always, let me know if anything seems amiss.

    Thanks!
     
    asales and DonManfred like this.
  20. Dave O

    Dave O Active Member Licensed User

    Hi all, I've uploaded version 2.1, a minor update that makes it possible to show tips for more kinds of views (greater compatibility).
     
    analizer3816 likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice