Android Question Open and Close events for B4XDrawer

Fifi Donkor

Member
Licensed User
Longtime User
I'm using B4XDrawer in an android app and I find that it would be very helpful for what i'm trying to do if there was something like a Drawer_close event and a Drawer_open event for when the drawer is opened or closed, whether by sliding in and out or by touching some icon or whatever.

I'm implementing the drawer on an activity without a toolbar.

Does something like that exist?
 

DonManfred

Expert
Licensed User
Longtime User
Upvote 0

Erel

B4X founder
Staff member
Licensed User
Longtime User
There is a variable named IsOpen in B4XDrawer class. It is set in ChangeOffset. You can change the code to:
B4X:
If (IsOpen And VisibleOffset < 0.8 * mSideWidth) Or (IsOpen = False And VisibleOffset < 0.2 * mSideWidth) Then
           x = -mSideWidth
           IsOpen = False
           CallSub(mCallback, mEventName & "_DrawerClosed")
       Else
           x = 0
           IsOpen = True
           CallSub(mCallback, mEventName & "_DrawerOpened")
       End If
 
Upvote 0

Fifi Donkor

Member
Licensed User
Longtime User
There is a variable named IsOpen in B4XDrawer class. It is set in ChangeOffset. You can change the code to:
B4X:
If (IsOpen And VisibleOffset < 0.8 * mSideWidth) Or (IsOpen = False And VisibleOffset < 0.2 * mSideWidth) Then
           x = -mSideWidth
           IsOpen = False
           CallSub(mCallback, mEventName & "_DrawerClosed")
       Else
           x = 0
           IsOpen = True
           CallSub(mCallback, mEventName & "_DrawerOpened")
       End If

Perfect solution to my problem. I guess I now have B4XDrawer version 1.53 ;) or is it 1.60?

Thanks a lot
 
Upvote 0
Top