mirror of
https://github.com/KeymonSoft/ReplyAutoV1---WIP.git
synced 2026-04-20 22:29:15 +00:00
Commit iniical.
This commit is contained in:
77
B4A/B4XImagenes.bas
Normal file
77
B4A/B4XImagenes.bas
Normal file
@@ -0,0 +1,77 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Class
|
||||
Version=9.86
|
||||
@EndOfDesignText@
|
||||
Sub Class_Globals
|
||||
Private Root As B4XView 'ignore
|
||||
Private xui As XUI 'ignore
|
||||
Public cvs As B4XCanvas
|
||||
Public Panel1 As B4XView
|
||||
Private i_waImg As ImageView
|
||||
Private l_imgData As Label
|
||||
Private clv_imagenes As CustomListView
|
||||
End Sub
|
||||
|
||||
'You can add more parameters here.
|
||||
Public Sub Initialize
|
||||
|
||||
End Sub
|
||||
|
||||
'This event will be called once, before the page becomes visible.
|
||||
Private Sub B4XPage_Created (Root1 As B4XView)
|
||||
Root = Root1
|
||||
'load the layout to Root
|
||||
Root.LoadLayout("Imagenes")
|
||||
cvs.Initialize(Panel1)
|
||||
B4XPages.SetTitle(Me, "Imagenes disponibles")
|
||||
End Sub
|
||||
|
||||
Sub B4XPage_Appear
|
||||
Private losDatos As List = Subs.traeImgMsjData
|
||||
Private bmp As Bitmap
|
||||
clv_imagenes.Clear
|
||||
For i = 0 To losDatos.Size - 1
|
||||
' Log(losDatos.Get(i).As(Map))
|
||||
' Log(losDatos.Get(i).As(Map).Get("imgData").As(Map).Get("file_path"))
|
||||
Private theDir As String = Starter.waDir & "/" & losDatos.Get(i).As(Map).Get("imgData").As(Map).Get("file_path")
|
||||
' Log(theDir.SubString2(0, theDir.LastIndexOf("/")+1))
|
||||
' Log(theDir.SubString(theDir.LastIndexOf("/")+1))
|
||||
If theDir.EndsWith("jpg") Or theDir.EndsWith("png") Then
|
||||
bmp = LoadBitmap(theDir.SubString2(0, theDir.LastIndexOf("/")+1), theDir.SubString(theDir.LastIndexOf("/")+1))
|
||||
clv_imagenes.Add(createImgItem(bmp, losDatos.Get(i).As(Map).Get("msjData").As(Map).Get("media_caption"), 386dip, 90dip), losDatos.Get(i))
|
||||
End If
|
||||
Next
|
||||
End Sub
|
||||
|
||||
'You can see the list of page related events in the B4XPagesManager object. The event name is B4XPage.
|
||||
|
||||
Private Sub btnClear_Click
|
||||
|
||||
End Sub
|
||||
|
||||
Sub btnSet_Click
|
||||
B4XPages.ClosePage(Me)
|
||||
End Sub
|
||||
|
||||
Sub createImgItem(img As Bitmap, text As String, Width As Int, Height As Int) As Panel
|
||||
Dim p As B4XView = xui.CreatePanel("")
|
||||
' Private pLeft = p_rules.left
|
||||
p.SetLayoutAnimated(0, 0, 0, Width, Height)
|
||||
p.LoadLayout("imgItem")
|
||||
i_waImg.Bitmap = img
|
||||
l_imgData.Text = text
|
||||
Return p
|
||||
End Sub
|
||||
|
||||
Private Sub clv_imagenes_ItemClick (Index As Int, Value As Object)
|
||||
If Starter.Logger Then Log(Value)
|
||||
End Sub
|
||||
|
||||
Sub clv_imagenes_ItemLongClick (Index As Int, Value As Object)
|
||||
B4XPages.MainPage.phv.Vibrate(100)
|
||||
Subs.mandaWAImageRoot(Null, "Alo Papagena … Tore bella com la papaia", Value)
|
||||
ToastMessageShow("Imagen mandada.",False)
|
||||
If starter.Logger Then Log(Value)
|
||||
End Sub
|
||||
Reference in New Issue
Block a user