B4A Library [B4X] [XUI] AS BottomSelectionList

This view makes it easy to quickly provide a good looking single or multiple selection list, based on the AS_SelectionList, built into a ready to use bottom menu.

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. :)

(83) mage.png
(84) mage.png

Simple Example:
Private Sub OpenSheet(DarkMode As Boolean)
    BottomSelectionList.Initialize(Me,"BottomSelectionList",Root)
 
    BottomSelectionList.Theme = IIf(DarkMode,BottomSelectionList.Theme_Dark,BottomSelectionList.Theme_Light)
    BottomSelectionList.ActionButtonVisible = True

    For i = 0 To 20 -1
        BottomSelectionList.AddItem("Test " & i,Null,i)
    Next
 
    BottomSelectionList.ShowPicker
 
    BottomSelectionList.ActionButton.Text = "Confirm"
 
End Sub
Events
SelectionChanged:
Private Sub BottomSelectionList_SelectionChanged
 
    For Each Item As AS_SelectionList_Item In BottomSelectionList.GetSelections
        Log("SelectionChanged: " & Item.Text)
    Next

End Sub
ActionButtonClicked:
Private Sub BottomSelectionList_ActionButtonClicked
    Log("ActionButtonClicked")
    BottomSelectionList.HidePicker
End Sub
SelectionMode
You can change the selection mode from single to multi
B4X:
BottomSelectionList.SelectionMode = BottomSelectionList.SelectionMode_Multi
B4X:
BottomSelectionList.SelectionMode = BottomSelectionList.SelectionMode_Single
MaxVisibleItems
The maximum number of items that are visible before it becomes a list and must be scrolled.
Default: 5
B4X:
BottomSelectionList.MaxVisibleItems = 5

AS_BottomSelectionList
Author: Alexander Stolte
Version: 1.00
  • AS_BottomActionSheet_Theme
    • Fields:
      • ActionButtonBackgroundColor As Int
      • ActionButtonTextColor As Int
      • BodyColor As Int
      • DragIndicatorColor As Int
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • SelectionList As b4j.example.as_selectionlist._as_selectionlist_theme
      • TextColor As Int
    • Functions:
      • Initialize
        Initializes the fields to their default value.
  • AS_BottomSelectionList
    • Events:
      • ActionButtonClicked
      • Close
      • SelectionChanged
    • Fields:
      • Tag As Object
    • Functions:
      • AddItem (Text As String, Icon As B4XBitmap, Value As Object) As b4j.example.as_selectionlist._as_selectionlist_item
      • Class_Globals As String
      • Clear 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
      • getMaxVisibleItems As Int
      • getSelectionList As b4j.example.as_selectionlist
      • getSelectionMode As String
        Single or Multi
      • getSelectionMode_Multi As String
      • getSelectionMode_Single As String
      • GetSelections As List
        <code>
        For Each Item As AS_SelectionList_Item In BottomSelectionList.GetSelections
        Log("Item selected: " & Item.Text)
        Next
        </code>
      • getSheetWidth As Float
      • getSize As Int
        Get the number of items
      • getTheme_Dark As AS_BottomActionSheet_Theme
      • getTheme_Light As AS_BottomActionSheet_Theme
      • getThemeChangeTransition As String
      • getThemeChangeTransition_Fade As String
      • getThemeChangeTransition_None 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
      • setMaxVisibleItems (MaxVisibleItems As Int) As String
        The maximum number of items that are visible before it becomes a list and must be scrolled
        Default: 5
      • setSelectionMode (SelectionMode As String) As String
      • SetSelections (Values As Object()) As String
        <code>BottomSelectionList.SetSelections(Array As Object(1,3))</code>
      • setSheetWidth (SheetWidth As Float) As String
        Set the value to greater than 0 to set a custom width
        Set the value to 0 to use the full screen width
        Default: 0
      • setTheme (Theme As AS_BottomActionSheet_Theme) As String
      • setThemeChangeTransition (ThemeChangeTransition As String) As String
        Fade or None
      • ShowPicker
    • Properties:
      • ActionButton As B4XView [read only]
      • ActionButtonVisible As Boolean
      • Color As Int
      • DragIndicatorColor As Int
      • MaxVisibleItems As Int
        The maximum number of items that are visible before it becomes a list and must be scrolled
        Default: 5
      • SelectionList As b4j.example.as_selectionlist [read only]
      • SelectionMode As String
        Single or Multi
      • SelectionMode_Multi As String [read only]
      • SelectionMode_Single As String [read only]
      • SheetWidth As Float
        Set the value to greater than 0 to set a custom width
        Set the value to 0 to use the full screen width
        Default: 0
      • Size As Int [read only]
        Get the number of items
      • Theme
      • Theme_Dark As AS_BottomActionSheet_Theme [read only]
      • Theme_Light As AS_BottomActionSheet_Theme [read only]
      • ThemeChangeTransition As String
        Fade or None
      • ThemeChangeTransition_Fade As String [read only]
      • ThemeChangeTransition_None As String [read only]
Changelog
  • 1.00
    • Release
  • 1.01
    • BugFixes
    • Add GetItems - Get all items as list of AS_SelectionList_Item
  • 1.02
    • Improvements
    • Add SetSelections2 - Set the Selections via a list
    • Add get and set SideGap
      • Default: 10dip
    • Add get SelectedItemProperties
    • Add get ItemProperties
Have Fun :)
 

Attachments

  • AS BottomSelectionList Example.zip
    178 KB · Views: 37
  • AS_BottomSelectionList.b4xlib
    3.3 KB · Views: 28
Last edited:

Alexander Stolte

Expert
Licensed User
Longtime User
Update
  • 1.02
    • Improvements
    • Add SetSelections2 - Set the Selections via a list
    • Add get and set SideGap
      • Default: 10dip
    • Add get SelectedItemProperties
    • Add get ItemProperties
A more detailed insight into the features can be found here:
 
Top