Sub Class_Globals
Private Root As B4XView 'ignore
Private xui As XUI 'ignore
Private fx As JFX
Private Dashform As Form
Private pn1 As pane_1
Private pn2 As pane_2
Private pn3 As pane_3
Private lblDashboardTitle As B4XView
Private clv_MenuButtons As CustomListView
Private pnLayoutLoader As B4XView
Private lbl_MenuName As B4XView
Private lbl_MenuButton As B4XView
End Sub
'You can add more parameters here.
Public Sub Initialize As Object
Return Me
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Dashform = B4XPages.GetNativeParent(Me)
Dashform.Initialize("Dashform",1024,768)
Dashform.SetFormStyle("TRANSPARENT")
Dashform.BackColor = fx.Colors.Transparent 'To enforce round corner from panel
Dashform.Resizable = False
Dashform.RootPane.LoadLayout("DashboardV2")
Dashform.Title = "App - Dashboard"
Dashform.Show
Dashform.RootPane.Alpha = 0
Dashform.RootPane.SetAlphaAnimated(800,1)
' pnLayoutLoader.SetColorAndBorder(0,5,0xFF3C334E,10)
pn1.Initialize
pn2.Initialize
pn3.Initialize
AddMenuButton(pn1)
AddMenuButton(pn3)
AddMenuButton(pn2)
' Remove the white order
clv_MenuButtons.sv.Color = fx.Colors.To32Bit(fx.Colors.transparent)
' Add the colour at the bottom, see https://www.b4x.com/android/forum/threads/solved-is-there-a-bug-with-backgroud-color-of-the-customlistview-in-b4j.125218/
XUIViewsUtils.AddStubToCLVIfNeeded(clv_MenuButtons, clv_MenuButtons.AsView.Color)
clv_MenuButtons_ItemClick(0,pn1)
End Sub
Private Sub AddMenuButton (val As Object)
Dim newMenuBttn As B4XView
newMenuBttn = xui.CreatePanel("")
newMenuBttn.LoadLayout("menu_ButtonLayout")
newMenuBttn.Height = 120dip
lbl_MenuName.Text = CallSub(val,"GetName")
lbl_MenuButton.Text = CallSub(val,"GetIcon")
clv_MenuButtons.Add(newMenuBttn,val)
clv_MenuButtons.sv.Color = fx.Colors.To32Bit(fx.Colors.transparent)
End Sub
Private Sub clv_MenuButtons_ItemClick (Index As Int, Value As Object)
Try
pnLayoutLoader.RemoveAllViews
CallSub2(Value,"Show",pnLayoutLoader)
lblDashboardTitle.Text = "App - " & CallSub(Value,"GetName")
Catch
Log("clicked on stub")
End Try
End Sub