hello
I tried xui.
Actually, that's how I imagine it to work.
But:
Adding an event with the Click event does not work in Designer.
I don't even know if you can leave the code like that.
Maybe we can do better.
regards Frank
xActionBar
I tried xui.
Actually, that's how I imagine it to work.
But:
Adding an event with the Click event does not work in Designer.
I don't even know if you can leave the code like that.
Maybe we can do better.
regards Frank
xActionBar
B4X:
'Custom View class
#DesignerProperty: Key: TextColor, DisplayName: Text Color, FieldType: Color, DefaultValue: 0xFFA2A2A2, Description: Text color
Sub Class_Globals
Private EventName As String
Private CallBack As Object
Private mBase As B4XView
Private mLbl As B4XView
Private xui As XUI
Private mTitle As B4XView
Private mSubTitle As B4XView
Private mArrowBack As B4XView
End Sub
Public Sub Initialize (vCallBack As Object, vEventName As String)
EventName = vEventName
CallBack = vCallBack
End Sub
'Base type must be Object
Public Sub DesignerCreateView (Base As Object, Lbl As Label, Props As Map)
mBase = Base
mLbl = Lbl
mBase.AddView(mLbl, 0, 0, mBase.Width, mBase.Height)
mLbl.SetTextAlignment("CENTER", "CENTER")
mLbl.TextColor = xui.PaintOrColorToColor(Props.Get("TextColor"))
mTitle = CreateLabel("",16,0)
mBase.AddView(mTitle, mBase.Width * 0.2 , mBase.Height * 0.15 , mBase.Width /2, mBase.Height * 0.3)
mSubTitle = CreateLabel("",14,0)
mBase.AddView(mSubTitle, mBase.Width * 0.2 , mBase.Height * 0.55 , mBase.Width /2, mBase.Height * 0.3)
mArrowBack = CreateLabel("ArrowBack",25,1)
mBase.AddView(mArrowBack, 10dip , (mBase.Height / 2) - 25dip , 50dip, 50dip)
mArrowBack.SetTextAlignment("CENTER", "CENTER")
mArrowBack.TextColor = Colors.White
mArrowBack.Text = Chr(0xE5C4)
End Sub
Private Sub Base_Resize (Width As Double, Height As Double)
mLbl.SetLayoutAnimated(0, 0, 0, Width, Height)
End Sub
Sub ArrowBack_Click
If xui.SubExists(CallBack, EventName & "_click", 0) Then
CallSubDelayed(CallBack, EventName & "_click")
End If
End Sub
Private Sub CreateLabel(Event As String , Textsize As Int,Fonttype As Int) As B4XView
Dim lbl As Label
lbl.Initialize(Event)
lbl.SingleLine = True
lbl.Text = ""
lbl.TextSize = Textsize
lbl.TextColor = xui.Color_Black
If Fonttype = 0 Then
lbl.Typeface = Typeface.DEFAULT
Else
lbl.Typeface = Typeface.MATERIALICONS
Dim res As StateListDrawable
res.Initialize
Dim drwPressedColor As ColorDrawable
drwPressedColor.Initialize(Colors.ARGB(70,255,255,255),90)
res.AddState(res.State_Pressed, drwPressedColor)
lbl.Background = res
End If
Return lbl
End Sub
Public Sub setTitle(NewValue As String)
mTitle.Text = NewValue
End Sub
Public Sub setTitleColor(NewValue As Long)
mTitle.TextColor = NewValue
End Sub
Public Sub setSubTitle(NewValue As String)
mSubTitle.Text = NewValue
End Sub
Public Sub setSubTitleColor(NewValue As Long)
mSubTitle.TextColor = NewValue
End Sub
Public Sub setBarColor(NewValue As Long)
mBase.Color = NewValue
End Sub