B4A Library [B4X] [XUI] AS BottomActionSheet

This view makes it quick and easy to let the user make an action.

You need:
I spend a lot of time in creating views, like this and to create a high quality view cost a lot of time. If you want to support me and further views, then you can do it here by Paypal or with a coffee. :)

(59) mage.png
(60) mage.png


Simple Example:
    BottomActionSheet.Initialize(Me,"BottomActionSheet",Root)
    BottomActionSheet.Theme = BottomActionSheet.Theme_Light 'Dark or Light mode
 
    BottomActionSheet.AddItem("Item #1",BottomActionSheet.FontToBitmap(Chr(0xE190),True,30,xui.Color_Black),0)
    BottomActionSheet.AddItem("Item #2",BottomActionSheet.FontToBitmap(Chr(0xE190),True,30,xui.Color_Black),1)
    BottomActionSheet.AddItem("Item #3",BottomActionSheet.FontToBitmap(Chr(0xE190),True,30,xui.Color_Black),2)
 
    BottomActionSheet.ShowPicker
 
    Wait For BottomActionSheet_ItemClicked(Item As AS_BottomActionSheet_Item)
 
    BottomActionSheet.HidePicker
    Log(Item.Text & " clicked")

Examples

AS_BottomActionSheet
Author: Alexander Stolte
Version: 1.03
  • AS_BottomActionSheet
    • Events:
      • ActionButtonClicked
      • Close
      • CustomDrawItem (Item As AS_BottomActionSheet_Item, ItemViews As AS_BottomActionSheet_ItemViews)
      • ItemClicked (Item As AS_BottomActionSheet_Item)
    • Fields:
      • Tag As Object
    • Functions:
      • AddItem (Text As String, Icon As B4XBitmap, Value As Object) As AS_BottomActionSheet_Item
      • AddItem2 (Text As String, Icon As B4XBitmap, SmallIcon As B4XBitmap, Value As Object) As AS_BottomActionSheet_Item
        SmallIcon - An icon that can be displayed before or after the text
      • Class_Globals As String
      • FontToBitmap (text As String, IsMaterialIcons As Boolean, FontSize As Float, color As Int) As B4XBitmap
      • getActionButton As B4XView
      • getActionButtonVisible As Boolean
      • getColor As Int
      • getDragIndicatorColor As Int
      • getHorizontalAlignment_AfterText As String
      • getHorizontalAlignment_BeforeText As String
      • getItemProperties As AS_BottomActionSheet_ItemProperties
      • getItemSmallIconProperties As AS_BottomActionSheet_ItemSmallIconProperties
        VerticalAlignment - Top, Center, Bottom
        HorizontalAlignment - BeforeText, AfterText
        WidthHeight - Default: 15dip
        LeftGap - Default: 0dip
      • GetItemViews (Value As Object) As AS_BottomActionSheet_ItemViews
        Gets the item views for a value
      • GetItemViews2 (Index As Int) As AS_BottomActionSheet_ItemViews
        Gets the item views for a index
      • getSize As Int
        Get the number of items
      • getTheme_Dark As AS_BottomActionSheet_Theme
      • getTheme_Light As AS_BottomActionSheet_Theme
      • getVerticalAlignment_Bottom As String
      • getVerticalAlignment_Center As String
      • getVerticalAlignment_Top As String
      • HidePicker As String
      • Initialize (Callback As Object, EventName As String, Parent As B4XView) As String
        Initializes the object. You can add parameters to this method if needed.
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • setActionButtonVisible (Visible As Boolean) As String
      • setColor (Color As Int) As String
      • setDragIndicatorColor (Color As Int) As String
      • setTextColor (Color As Int) As String
      • setTheme (Theme As AS_BottomActionSheet_Theme) As String
      • ShowPicker
    • Properties:
      • ActionButton As B4XView [read only]
      • ActionButtonVisible As Boolean
      • Color As Int
      • DragIndicatorColor As Int
      • HorizontalAlignment_AfterText As String [read only]
      • HorizontalAlignment_BeforeText As String [read only]
      • ItemProperties As AS_BottomActionSheet_ItemProperties [read only]
      • ItemSmallIconProperties As AS_BottomActionSheet_ItemSmallIconProperties [read only]
        VerticalAlignment - Top, Center, Bottom
        HorizontalAlignment - BeforeText, AfterText
        WidthHeight - Default: 15dip
        LeftGap - Default: 0dip
      • Size As Int [read only]
        Get the number of items
      • TextColor
      • Theme
      • Theme_Dark As AS_BottomActionSheet_Theme [read only]
      • Theme_Light As AS_BottomActionSheet_Theme [read only]
      • VerticalAlignment_Bottom As String [read only]
      • VerticalAlignment_Center As String [read only]
      • VerticalAlignment_Top As String [read only]
  • AS_BottomActionSheet_Item
    • Fields:
      • Icon As B4XBitmap
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • ItemProperties As AS_BottomActionSheet_ItemProperties
      • ItemSmallIconProperties As AS_BottomActionSheet_ItemSmallIconProperties
      • SmallIcon As B4XBitmap
      • Text As String
      • Value As Object
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_BottomActionSheet_ItemProperties
    • Fields:
      • Height As Float
      • IconWidthHeight As Float
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • LeftGap As Float
      • SeperatorColor As Int
      • SeperatorVisible As Boolean
      • TextColor As Int
      • xFont As B4XFont
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_BottomActionSheet_ItemSmallIconProperties
    • Fields:
      • Color As Int
      • HorizontalAlignment As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • LeftGap As Float
      • VerticalAlignment As String
      • WidthHeight As Float
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_BottomActionSheet_ItemViews
    • Fields:
      • BackgroundPanel As B4XView
      • IconImageView As B4XView
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • SeperatorPanel As B4XView
      • TextLabel As B4XView
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_BottomActionSheet_Theme
    • Fields:
      • BodyColor As Int
      • DragIndicatorColor As Int
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • TextColor As Int
    • Functions:
      • Initialize
        Initializes the fields to their default value.
Changelog
  • 1.00
    • Release
  • 1.01
    • Improvements
    • Add get and set DragIndicatorColor
  • 1.02
    • Add Event CustomDrawItem
    • Add Type AS_BottomActionSheet_ItemViews
    • Add GetItemViews - Gets the item views for a value
    • Add GetItemViews2 - Gets the item views for a index
    • Add Event Close
    • Add get Size - Get the number of items
  • 1.03
    • Add Type AS_BottomActionSheet_ItemSmallIconProperties
    • Add SmallIcon to Type AS_BottomActionSheet_Item
    • Add ItemSmallIconProperties to Type AS_BottomActionSheet_Item
    • Add AddItem2 with the SmallIcon Parameter
    • Add set Theme
      • Add get Theme_Dark
      • Add get Theme_Light
  • 1.04 (read more)
    • Add get and set SheetWidth - Set a value greater than 0 to define a custom width
      • Default: 0
    • Add TextHorizontalAlignment to Type AS_BottomActionSheet_ItemProperties
      • Left, Center, Right
  • 1.05 (read more)
    • Add IconHorizontalAlignment to Type AS_BottomActionSheet_ItemProperties
      • Auto, Left, Right
      • Default: Auto
Have Fun :)
 

Attachments

  • AS BottomActionSheet Example.zip
    178.1 KB · Views: 57
  • AS_BottomActionSheet.b4xlib
    5.1 KB · Views: 22
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.02
    • Add Event CustomDrawItem
    • Add Type AS_BottomActionSheet_ItemViews
    • Add GetItemViews - Gets the item views for a value
    • Add GetItemViews2 - Gets the item views for a index
    • Add Event Close
    • Add get Size - Get the number of items
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.03
    • Add Type AS_BottomActionSheet_ItemSmallIconProperties
    • Add SmallIcon to Type AS_BottomActionSheet_Item
    • Add ItemSmallIconProperties to Type AS_BottomActionSheet_Item
    • Add AddItem2 with the SmallIcon Parameter
    • Add set Theme
      • Add get Theme_Dark
      • Add get Theme_Light
The example project has been adapted and the example code in #1 as well.

Small Icon
An icon that can be displayed before or after the text
(75) mage.png


Theming
You can now simply set a dark or light mode with predefined themes.
B4X:
    BottomActionSheet.Theme = BottomActionSheet.Theme_Dark
    BottomActionSheet.Theme = BottomActionSheet.Theme_Light
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.04
    • Add get and set SheetWidth - Set a value greater than 0 to define a custom width
      • Default: 0
    • Add TextHorizontalAlignment to Type AS_BottomActionSheet_ItemProperties
      • Left, Center, Right
SheetWidth
B4X:
    BottomActionSheet.SheetWidth = 200dip
    BottomActionSheet.ShowPicker
1731058479979.png

TextHorizontalAlignment
B4X:
    BottomActionSheet.ItemProperties.TextHorizontalAlignment = "CENTER"
    BottomActionSheet.AddItem("Item #1",Null,0)
    BottomActionSheet.ShowPicker

1731058548766.png
1731058573846.png
 

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.05
    • Add IconHorizontalAlignment to Type AS_BottomActionSheet_ItemProperties
      • Auto, Left, Right
      • Default: Auto
IconHorizontalAlignment
B4X:
BottomActionSheet.ItemProperties.IconHorizontalAlignment = BottomActionSheet.IconHorizontalAlignment_Right
1733185843090.png
 
Top