Dim p As B4XView = xui.CreatePanel("")
p.Color = xui.Color_Transparent
' Dim User As String
' If Right Then User = "User 2" Else User = "User 1"
If hora.Contains("-") Then
DateTime.DateFormat = "yyyy-MM-dd HH:mm:ss"
Dim time As Long = DateTime.DateParse(hora)
DateTime.DateFormat = "HH:mm:ss"
Dim timeParsed As String = DateTime.Date(time)
Else
Dim timeParsed As String = hora
End If
' BBCodeView1.ExternalRuns = BuildMessage(Text, Right, timeParsed)
' BBCodeView1.ParseAndDraw
Log("Text: "&Text)
Log("Right: "&Right)
Log("timeParsed: "&timeParsed)
BBCodeView1.Text = BuildMessage(Text, Right, timeParsed)
Dim ivText As B4XView = CreateImageView
'get the bitmap from BBCodeView1 foreground layer.
Dim bmpText As B4XBitmap = GetBitmap(BBCodeView1.ForegroundImageView)
'the image might be scaled by Engine.mScale. The "correct" dimensions are:
Dim TextWidth As Int = bmpText.Width / Engine.mScale
Dim TextHeight As Int = bmpText.Height / Engine.mScale
'bc is not really used here. Only the utility method.
'Now get the whole image
' BBCodeView1.mBase.Color = Colors.Red
Dim bmpAll As B4XBitmap = BBCodeView1.mBase.Snapshot
bmpText = bmpAll.Crop(0, 0, TextWidth, TextHeight)
' bmpText.TextColor = Colors.Black
bc.SetBitmapToImageView(bmpText, ivText)
Dim ivBG As B4XView = CreateImageView
'Draw the bubble.
Dim bmpBG As B4XBitmap = DrawBubble(TextWidth, TextHeight, Right)
bc.SetBitmapToImageView(bmpBG, ivBG)
p.SetLayoutAnimated(0, 0, 0, CLV.sv.ScrollViewContentWidth - 2dip, TextHeight + 3 * Gap)