Android Question SuperToolTips

ALBRECHT

Active Member
Licensed User
Yess LucaMs, the need is to show a SuperToolTips automaticaly after a waiting time from the user or on demo mode for some Helping. I think i will try to get started with my own library. what i have seen until now, does not provide the same rendering
 
Upvote 0

LucaMs

Expert
Licensed User
Longtime User
Yess LucaMs, the need is to show a SuperToolTips automaticaly after a waiting time from the user or on demo mode for some Helping. I think i will try to get started with my own library. what i have seen until now, does not provide the same rendering
I don't know how they were made, I didn't look at the source, but I think that you can probably use the "balloons" of this chat:
https://www.b4x.com/android/forum/threads/b4x-cross-platform-chat-layout-example.112649/post-702406
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
I don't know how they were made, I didn't look at the source, but I think that you can probably use the "balloons" of this chat:
https://www.b4x.com/android/forum/threads/b4x-cross-platform-chat-layout-example.112649/post-702406

Bubble Tips:


other

 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
We adapt this to B4X for bubble tips:

 
Upvote 0

ALBRECHT

Active Member
Licensed User
ok, thanks for your advices for mixing with B4XCanvas
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
Yes, B4X (B4A, B4J, B4I)

KISS = "keep it simple, stupid!"



tips:

B4X:
Sub TextBubble(inPanel As B4XView, inTexts() As String, inFontSize As Float)


    For Each v As B4XView In inPanel.GetAllViewsRecursive
        v.RemoveViewFromParent
    Next
    
    If inTexts.Length = 0 Then Return
    
    Dim Border As Float  = 0dip 'StrokeWidth
    Dim Edge As Float = 15dip 'Distance

    Dim Canvas1 As B4XCanvas
    Canvas1.Initialize(inPanel)

    ' ***********************************

    #region measure text size

    Dim width, height As Float
    width = 0
    height = 0

    Dim FontHeight As Float
    FontHeight = 1dip

    For Each t As String In inTexts
        FontHeight = Max(FontHeight , Canvas1.MeasureText(t, XUI.CreateDefaultFont(DipToCurrent(inFontSize))).Height + 1dip) 'max. text row height
    Next

    For Each t As String In inTexts
        width = Max(width , Canvas1.MeasureText(t, XUI.CreateDefaultFont(DipToCurrent(inFontSize))).Width) 'maximal with
        height = height + FontHeight
    Next

    #end region

    ' ***********************************

    #region bubble

    'make it bigger for the border around

    Dim width2, height2 As Float
    
    width2 = width + Edge * 2.0
    height2 = height + Edge * 2.0
    
    Dim Rect1 As B4XRect
    Rect1.Initialize(inPanel.Width / 2.0 - width2 / 2.0  , inPanel.Height / 2.0  - height2 / 2.0,  inPanel.Width / 2.0 + width2 / 2.0, inPanel.Height / 2.0 + height2 / 2.0)
            
    Dim Path1 As B4XPath
    Path1.Initialize(Rect1.Left + Edge, Rect1.Top)
    Path1.LineTo(Rect1.Right ,Rect1.Top)
    Path1.LineTo(Rect1.Right ,Rect1.Bottom)

    Path1.LineTo(Rect1.Right - Rect1.Width * 0.5,  Rect1.Bottom)
    Path1.LineTo(Rect1.Right - Rect1.Width * 0.5,  Rect1.Bottom + Edge * 3.0) 'peak
    Path1.LineTo(Rect1.Right - Rect1.Width * 0.75, Rect1.Bottom)

    Path1.LineTo(Rect1.Left ,Rect1.Bottom)
    Path1.LineTo(Rect1.Left ,Rect1.Top + Edge)

    'math corner left, top
    Dim a As Float,x As Float,y As Float
    
    For a = 0.0 To 90.0 Step 10.0
        x = -CosD(a) * Edge
        y = -SinD(a) * Edge
        Path1.LineTo(Rect1.Left + Edge + x ,Rect1.Top + Edge + y)
    Next

    Canvas1.DrawPath(Path1, XUI.Color_RGB(0,128,0), True, 1)
    Canvas1.DrawPath(Path1, XUI.Color_White, False, Border)

    #end region

    ' ***********************************

    #region draw text

    Dim Rect1 As B4XRect
    
    Rect1.Initialize(inPanel.Width / 2.0 -width / 2.0, inPanel.Height / 2.0 - height / 2.0,  inPanel.Width / 2.0 + width / 2.0, inPanel.Height / 2.0 + height / 2.0)

    'test rect
'    Canvas1.DrawRect( Rect1, XUI.Color_Black, False, 1dip) 'check size
    
    Dim y As Float = Rect1.Top
    Dim h As Float = 0
    
    For Each t As String In inTexts
        h = FontHeight
        y = y + h
        Canvas1.DrawText(t, Rect1.Left, y - FontHeight * 0.1, XUI.CreateDefaultFont(inFontSize), XUI.Color_Yellow, "LEFT")
    Next

    Canvas1.Invalidate
    

    #end region
            
End Sub
 
Upvote 0

TILogistic

Expert
Licensed User
Longtime User
What is KISS or "keep it simple, stupid!"?

Principle that states that most systems work best if they are designed with simplicity in mind and avoid unnecessary complexity.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…