B4A Library [B4X] [XUI] AS Draggable Bottom Card

This is my 2k'th post on this Forum and i want to share a nice library with you i made some months ago.
It was not easy to create this library, it took many hours of testing and programming to make the user experience as good as possible.

If you want to support me, then you can do this here or with a coffee. Thanks :)

This lib. is only for B4I and B4A.
B4J is not tested and i currently dont want to support it
B4J is now supported


Features
  • cross-platform compatible
  • easy to use
  • use your own header and body layout
  • 2 states - half expanded and full expanded
  • Events
  • and more...
Some design inspiration:
Screenshot_20200814-175011.jpg

Screenshot_20200814-175140.jpg
ezgif.com-resize.gif
Screenshot_20200426-182000.jpg
Screenshot_20200308-221644.jpg
bottom card.PNG

20-04-04-13-55-05.gif
com.stoltex.asdraggablebottomc_Screenshot_2021.02.23_11.49.59.png
1614077514655.png
TvAP4JLxzvCPBxjKZn2xMLq1B3HnIQkPQq6VYdMPdCEa8r9cfF.jpeg

ASDraggableBottomCard
Author: Alexander Stolte
Version: 1.05

  • ASDraggableBottomCard
    • Events:
      • Close
      • Closed
      • Open
      • Opened
      • VisibleBodyHeightChanged (height As Double)
    • Fields:
      • g_hide_duration As Int
      • g_show_duration As Int
    • Functions:
      • Base_Resize (Width As Double, Height As Double) As String
      • BodyPanel As B4XView
        gets the body panel - Load your body layout
      • Class_Globals As String
      • Create (Parent As B4XView, first_height As Float, second_height As Float, header_height As Float, width As Float, orientation As Int) As String
        Base type must be Object
      • ExpandFull As String
        expand the view full - second height + header height
      • ExpandHalf As String
        expand the view in half mode - first height + header height
      • getCardBase As B4XView
        gets the card base - the main panel that hold the body- and header-panel
      • getDarkPanelAlpha As Int
      • getFirstHeight As Float
      • getHeaderHeight As Float
        gets the header height
      • getIsDraggable As Boolean
      • getIsOpen As Boolean
        Returns True if the view is expanded/open
      • getIsOpenFull As Boolean
        Returns True if the view is full expanded
      • getIsOpenHalf As Boolean
        Returns True if the view is half expanded
      • getSecondHeight As Float
      • HeaderPanel As B4XView
        gets the header panel - Load your header layout
      • Hide (ignore_event As Boolean)
        hides/close the view
      • Initialize (Callback As Object, EventName As String) As String
      • IsInitialized As Boolean
        Tests whether the object has been initialized.
      • Orientation_LEFT As Int
      • Orientation_MIDDLE As Int
      • Orientation_RIGHT As Int
      • setCornerRadius_Header (radius As Float) As String
        sets the corner radius of the header
      • setDarkPanelAlpha (alpha As Int) As String
      • setFirstHeight (height As Float) As String
        sets or gets the first height - body height
        The Event VisibleBodyHeightChanged is triggered if the menu is currently open at the first height
      • setIsDraggable (draggable As Boolean) As String
        set it to false to disable touch gestures on header panel
      • setSecondHeight (height As Float) As String
        sets or gets the second height - body height
        The Event VisibleBodyHeightChanged is triggered if the menu is currently open at the second height
      • Show (ignore_event As Boolean) As String
    • Properties:
      • CardBase As B4XView [read only]
        gets the card base - the main panel that hold the body- and header-panel
      • CornerRadius_Header
        sets the corner radius of the header
      • DarkPanelAlpha As Int
      • FirstHeight As Float
        sets or gets the first height - body height
        The Event VisibleBodyHeightChanged is triggered if the menu is currently open at the first height
      • HeaderHeight As Float [read only]
        gets the header height
      • IsDraggable As Boolean
        set it to false to disable touch gestures on header panel
      • IsOpen As Boolean [read only]
        Returns True if the view is expanded/open
      • IsOpenFull As Boolean [read only]
        Returns True if the view is full expanded
      • IsOpenHalf As Boolean [read only]
        Returns True if the view is half expanded
      • SecondHeight As Float
        sets or gets the second height - body height
        The Event VisibleBodyHeightChanged is triggered if the menu is currently open at the second height
Changelog
  • 1.00
    • Release
  • 1.01
    • Various bug fixes and improvements
    • The menu no longer closes when the last swipe went up, so it is now possible for the user to cancel a full close
  • 1.02
    • Add CornerRadius_Header - sets the CornerRadius of the header
      • dont use asdbc_main.HeaderPanel.Height if your set the corner radius, the returning height is not the display height
      • use HeaderHeight instead
    • Add HeaderHeight - gets the displayed header height
    • Supports now B4J
  • 1.03
    • Add set FirstHeight - sets the FirstHeight - The Event VisibleBodyHeightChanged is triggered if the menu is currently open at the first height
    • Add set SecondHeight - sets the SecondHeight - The Event VisibleBodyHeightChanged is triggered if the menu is currently open at the second height
    • Important BugFixes!
  • 1.04
    • BugFix on Drag with finger - much more better experience now!
  • 1.05
    • Add get IsOpenHalf - Returns True if the view is half expanded
    • Add get IsOpenFull - Returns True if the view is full expanded
    • Add IsDraggable - set it to false to disable touch gestures on header
    • Add some property descriptions
  • 1.06
    • B4I and B4J - Body can now be dragged too
  • 1.07
    • BugFixes
    • Significant handling improvements when working with 2 heights
  • 1.08
    • Add get DarkPanel
    • Add DarkPanelClickable - If false then does the menu not close when you click on the dark area
      • Default: True
  • 1.09
    • Add UserCanClose - If False then the user can expand the menu, but not close
Have Fun :)
 

Attachments

  • AS DraggableBottomCard Example.zip
    16.9 KB · Views: 706
  • ASDraggableBottomCard.b4xlib
    3.7 KB · Views: 191
Last edited:

lucasheer

Active Member
Licensed User
Longtime User
Hello!

Not sure if it is alright to post on this thread, but love this library!

However- In B4A, any panels in the first LoadLayout are shown over the DraggableBottomCard. Even though the Draggable bottom card was initialized and created after LoadLayout?

I tried:
B4X:
asdbc_main.BodyPanel.BringToFront
asdbc_main.Headerpanel.BringToFront
asdbc_main.DarkPanel.BringToFront
asdbc_main.BodyPanel.Parent.BringToFront

Thank you!


Edit- Figured it out, it was because of panel elevation on my form controls. Here was my fix:
B4X:
Dim pp As Panel = asdbc_main.BodyPanel.Parent
pp.Elevation = 1dip
 
Last edited:
Top