B4A Library [B4X] [XUI] AS FloatingActionButton [Payware]

Alexander Stolte

Expert
Licensed User
Longtime User
Update
V1.03

  • Adds ButtonIconText - gets the main button label for FontAwesome- or Material-Icons
  • Adds the following parameter to ItemButtonProperties
    • IconText_Font
    • IconText_Color
  • Adds new parameter IconText to AddItem - set FontAwesome or MaterialIcons - dont forget to set the right font
Breaking Change: AddItem have now a new paramter "IcontText"
Breaking Change: The Event "ItemClicked" has a new parameter, change the event to this "ItemClicked(index as int,Value as Object)"

You can now customize each item before you add it. Example:
Adds a new item with blue background and Font Awesome Icon
B4X:
ASFloatingActionButton1.ItemButtonProperties.BackgroundColor = xui.Color_ARGB(255,73, 98, 164)'the next item should be a blue button
ASFloatingActionButton1.ItemButtonProperties.IconText_Font = xui.CreateFontAwesome(20)'because the next item we want to add is a FontAwesome Icon
ASFloatingActionButton1.AddItem(Null,Chr(0xF179),"Test Text","")

You can now set FontAwesome- or Material-Icons, instead of images.
Example:
B4X:
ASFloatingActionButton1.AddItem(Null,Chr(0xE859),"Test Text","")'set the image parameter to Null
 
Last edited:

Rubsanpe

Active Member
Licensed User
Hi, great update. I have tried the new example and I get the following error:

*** Service (starter) Create ***
** Service (starter) Start **
** Activity (main) Create, isFirst = true **
Call B4XPages.GetManager.LogEvents = True to enable logging B4XPages events.
** Activity (main) Resume **
ASFloatingActionButton1_ButtonClicked: true
Error occurred on line: 0 (ASFloatingActionButton)
java.lang.Exception: Sub asfloatingactionbutton1_itemclicked signature does not match expected signature.
public static anywheresoftware.b4a.pc.RemoteObject com.stoltex.floatingbutton.b4xmainpage_subs_0._asfloatingactionbutton1_itemclicked(anywheresoftware.b4a.pc.RemoteObject,anywheresoftware.b4a.pc.RemoteObject) throws java.lang.Exception
class anywheresoftware.b4a.pc.RemoteObject, class anywheresoftware.b4a.pc.RemoteObject, class java.lang.String,

The new signature is Private Sub EventName_ItemClicked(index as int,Value as Object)

If i change it then it works.

Rubén
 

Daica

Active Member
Licensed User
I'm finally trying this out now and its awesome so far. Do you think you could capture the text click as well?
 

Sandman

Expert
Licensed User
Longtime User
Hi Alexander, this works great in B4A (and in B4i I assume, haven't tried it yet), but I'm getting no action in B4J.

The button with the plus shows up but nothing happens when I click it. Do I need to do something special to get it working in B4J?
 

Mashiane

Expert
Licensed User
Longtime User
AS, do you have a consolidated thread that showcases all your amazing stuff here so that one can see everything, whether images or gifs?

I want to check the components you have used in one place so that I can decide what I can use in my projects and how.

Thanks again, keep changing the world!
 

Alexander Stolte

Expert
Licensed User
Longtime User
AS, do you have a consolidated thread that showcases all your amazing stuff here so that one can see everything, whether images or gifs?

For years in my signature

Thanks again, keep changing the world!
 

pliroforikos

Active Member
Licensed User
Hello,
I'm facing a problem with B4i. I have a simple form with 1 panel with a b4xtable inside and a float menu outside of panel. Also the app uses drawerMenu.

When i click in float menu ASFloatingActionButton1_ButtonClicked event fires and shows the log. But menu doesn't show.

The same code works in B4A and i cant reproduce the error in other projects. Your example also works in B4i.

this is the corresponding code:

B4X:
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
    Root = Root1

    ' ''''''''''''''''''' Drawer '''''''''''''''''''''''''''''''''
    drManager.Initialize(Me, "Drawer", Root, 200dip)
    drManager.Drawer.CenterPanel.LoadLayout("frmSettings2")
    drManager.Drawer.LeftPanel.LoadLayout("drawerMenu")
    createMenu
    ' ''''''''''''''''''' Drawer '''''''''''''''''''''''''''''''''

    createFloatMenu
end sub

Private Sub createFloatMenu
    floatButtons.ButtonIconText.Font = xui.CreateMaterialIcons(24)'because the icon we want to display is an Material Icon
    floatButtons.ButtonIconText.Text = Chr(0xE145)
    floatButtons.ItemButtonProperties.IconText_Font = xui.CreateMaterialIcons(20)'because the next 2 item we want to add is a Material Icon
    floatButtons.AddItem(Null,Chr(0xE145),"Insert","")
 
    floatButtons.ItemButtonProperties.IconText_Font = xui.CreateFontAwesome(20)'because the next item we want to add is a FontAwesome Icon
'    floatButtons.ItemButtonProperties.BackgroundColor = xui.Color_ARGB(255, 255, 159, 71)'the next item should be a blue button
'    floatButtons.ItemTextProperties.BackgroundColor =  xui.Color_ARGB(255, 255, 159, 71)
    floatButtons.AddItem(Null,Chr(0xF029),"Scan","")
 
    floatButtons.ItemButtonProperties.BackgroundColor = xui.Color_ARGB(255,73, 98, 164)'the next item should be a blue button
    floatButtons.ItemButtonProperties.IconText_Font = xui.CreateFontAwesome(20)'because the next item we want to add is a FontAwesome Icon
'    floatButtons.ItemButtonProperties.BackgroundColor = xui.Color_ARGB(255, 29, 100, 59)'the next item should be a blue button
'    floatButtons.ItemTextProperties.BackgroundColor = xui.Color_ARGB(255, 29, 100, 59)
    floatButtons.AddItem(Null,Chr(0xF00C),"Set","")
 
    floatButtons.ItemButtonProperties.BackgroundColor = xui.Color_ARGB(255,228, 68, 68)'the next item should be a blue button
    floatButtons.ItemTextProperties.BackgroundColor = xui.Color_ARGB(255,228, 68, 68)
    floatButtons.ItemButtonProperties.IconText_Font = xui.CreateMaterialIcons(20)'because the next 2 item we want to add is a Material Icon
    floatButtons.AddItem(Null,Chr(0xE872),"Remove","")
#end if 

End Sub

Sub ASFloatingActionButton1_ItemClicked(index As Int,Value As Object)
    Log("ASFloatingActionButton1_ItemClicked: " & index)
    'ASFloatingActionButton1.CloseMenu
End Sub

Sub ASFloatingActionButton1_ButtonClicked(open As Boolean)
    Log("ASFloatingActionButton1_ButtonClicked: " & open)
    'works only if you set a image as icon
'    If open = True Then
'        ASFloatingActionButton1.Base.GetView(1).SetRotationAnimated(250,135)
'    Else
'        ASFloatingActionButton1.Base.GetView(1).SetRotationAnimated(250,0)
'    End If

    If open = True Then
        ASFloatingActionButton1.ButtonIconText.SetRotationAnimated(250,135)
    Else
        ASFloatingActionButton1.ButtonIconText.SetRotationAnimated(250,0)
    End If
End Sub



I forgot to say that this menu was working fine until July.
 
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
I forgot to say that this menu was working fine until July.
There was no update, so the error is probably yours.
and i cant reproduce the error in other projects. Your example also works in B4i.
And how am I supposed to find a presumptive error if it cannot be reproduced?
Sorry.
 

pliroforikos

Active Member
Licensed User
Sometimes it helps only to describe the problem and the solution comes out! But now nothing happens

But i managed to reproduce the problem in the bellow project. It runs in B4i. Not tested on B4A.

In this project i'm using a drawermenu, a b4xtable and an AS FloatingActionButton.
 

Attachments

  • Project.zip
    444.3 KB · Views: 147
Cookies are required to use this site. You must accept them to continue using the site. Learn more…