B4A Library Side swipe sliding menu library

Hello everybody,
Here we have my second library, I created this library for a project that I'm working on, I've previously used this menu(in a class) on other clients bespoke apps. I've learnt a lot from other forum members, so hopefully you will like my little sliding menu.

Just swipe your finger from off the screen and the menu slides in and out, the top left button also slides the menu in and out when tapped.

A big thank you to @Informatix and @margret for creating libraries that makes my life easier :)

SlidingMenuStd
  • BarsOff
    TURN OFF BARS
  • Initialize (Activity As Activity, Top As Int, SetMenuWidth As Int, SetMenuColor As Int, FontSize As Int, FontColor As Int)
    Current activity, Menu top position, Menu Width, Menu color, Text size, Text color
  • InitializeActionBar (Activity As Activity, ActionBarColor As Int, LineColor As Int, Radius As Int, MenuButton As Boolean)
    Current activity, Action bar color, Thin line color, Action bar corner radius
  • InitializeSwipe (Activity As Activity, Module As Object, SetSlideDuration As Int, SetFadeAlpha As Int, SetMenuLength As Boolean)
    Current activity, Current module name, Menu slide duration in milliseconds, FadeAlpha(0-255), Menu length(Full or just items)

The extra libraries that I used were:
  1. AnimationPlus
  2. ICS Contols
I've built some simple adjustable functionality into this library v1.2+, I hope it's enough for you all.
  • Menu width
  • Menu colour
  • Menu text size
  • Menu full length or item length
  • Menu text colour
  • Action bar colour
  • Action bar under line colour
  • Action bar corner radius
  • Slide duration
  • Fade alpha shade
  • Action bar text
  • Slide menu button visible(True or false)
Anyway, that's enough of me babbling on, just download the library and let me know what you think about it. The screen shots below were taken on a Galaxy Nexus and a Nexus 7.

This has been tested on:
  • Acer Iconia A500 running Android 4.0.3 Ice Cream Sandwich
  • Samsung Galaxy Nexus running Android 4.2.2 Jelly Bean
  • ASUS Nexus 7(2012) running Android 4.2.2 Jelly Bean
  • LG Nexus 4 running Android 4.4.2 KitKat
  • LG Nexus 5 running Android 4.4.2 KitKat
  • ASUS Nexus 7(2013) running Android 4.4.2 KitKat
This works best in Android 4.0 and above. The attached APK install file has an TabHost with my Sliding Menu on top.

Cheers :cool:

- UPDATED V1.2, Removed the NFC Foreground Library.
- UPDATED V1.3, SDK checker and some other small updates.
- UPDATED V1.31, Added full length or item length vertical menu setting (MenuFullLength = True/False).
- UPDATED V1.32, Added the option to show or hide the top slide menu button (ShowSlideButton = True/False)
- UPDATED V1.34, Added method to show sliding menu
- UPDATED V1.35, Removed pnl_v_shadow.9.png, developers were not adding the file to their projects, thus causing an error

Last updated on 8th June 2015, see V1.35 update note above.
 

Attachments

  • Phone_L.png
    Phone_L.png
    25.6 KB · Views: 3,871
  • Phone_P.png
    Phone_P.png
    34.9 KB · Views: 3,902
  • Tablet_L.png
    Tablet_L.png
    22.7 KB · Views: 3,357
  • Tablet_P.png
    Tablet_P.png
    22.4 KB · Views: 3,248
  • ExtraLiberiesUsed.zip
    6 KB · Views: 1,995
  • SS_SlidingMenuLibraryV1.35.zip
    7 KB · Views: 1,667
  • TestSlidingMenu.zip
    22.6 KB · Views: 1,651
Last edited:

susu

Well-Known Member
Licensed User
Longtime User
Why your sample code need NFCForeground library?
 

Mahares

Expert
Licensed User
Longtime User
@Peter: I tested on ASUS Nexus 7 running Android 4.2.2 Jelly Bean. The menu button at the top left hand side corner is only partially visible when the menu items are not displayed. Also, sliding your finger to hide/unhide the menu items is erratic. It does not function every time.
Thanks for a great effort.
 

Peter Simpson

Expert
Licensed User
Longtime User
@Peter: I tested on ASUS Nexus 7 running Android 4.2.2 Jelly Bean. The menu button at the top left hand side corner is only partially visible when the menu items are not displayed. Also, sliding your finger to hide/unhide the menu items is erratic. It does not function every time.
Thanks for a great effort.

Hello @Mahares
It functions perfectly fine on my Nexus 7. I loaded a table and then I loaded the menu on top(you MUST LOAD the menu last in the Sub Activity_Create(FirstTime As Boolean) sub).

Anyway 221 test swipes and it worked 100% of the time for me on my N7 tablet :)
The top left hand button is supposed to be half hidden, press it and it slides to the right until it is then fully visible, press it again and it slides back to being half hidden, Some app have it the other way around. There's a couple of other action bars on here that does it this way(they are based onAhaActionBar). I use this menu 3 bespoke customer apps now, I've not heard of any swiping or not displaying issues.

Thank you for your feedback...
 
Last edited:

mcmanu

Active Member
Licensed User
Longtime User
Mhh It crashes on the galaxy s4 :(


Code:
--------- beginning of /dev/log/system

--------- beginning of /dev/log/main
main_globals (java line: 353)
java.lang.NoClassDefFoundError: simplysoftware.slidemenu.slidingmenu
at b4a.example.main._globals(main.java:353)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at anywheresoftware.b4a.BA.raiseEvent2(BA.java:167)
at b4a.example.main.initializeGlobals(main.java:226)
at b4a.example.main.afterFirstLayout(main.java:86)
at b4a.example.main.access$100(main.java:16)
at b4a.example.main$WaitForLayout.run(main.java:74)
at android.os.Handler.handleCallback(Handler.java:725)
at android.os.Handler.dispatchMessage(Handler.java:92)
at android.os.Looper.loop(Looper.java:137)
at android.app.ActivityThread.main(ActivityThread.java:5328)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:511)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:1102)
at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:869)
at dalvik.system.NativeStart.main(Native Method)
 

CidTek

Active Member
Licensed User
Longtime User
Request: Any chance you could implement vertical centering of the menu items when there are only a few?
 

mcmanu

Active Member
Licensed User
Longtime User
Solution to my problem above:
I Deinstalled the app, and deleted the lib files, downloaded again, installed it on my galaxy s4 and now it works :)
 

CidTek

Active Member
Licensed User
Longtime User
That's not a bad idea, I'll look into it, no promises though...

Any further thoughts on implementing this? To reiterate I was thinking of just the listview is vertically centered when the sliding panel itself is still full height
 

Peter Simpson

Expert
Licensed User
Longtime User
Any further thoughts on implementing this? To reiterate I was thinking of just the listview is vertically centered when the sliding panel itself is still full height

Hello, I added a menu full length or item length option, but the vertical alignment I've tested and it can cause issues. I'll have another look at it when I have the chance.
 

CidTek

Active Member
Licensed User
Longtime User
Hello, I added a menu full length or item length option, but the vertical alignment I've tested and it can cause issues. I'll have another look at it when I have the chance.

Hopefully you get can it sorted out as I find when you only have a few menu items they look odd stuck up at the top.
 

CidTek

Active Member
Licensed User
Longtime User
Hello, I'm not really sure what you are talking about. have you tried this in the settings Dim MenuFullLength As Boolean = False

That shortens the background panel which is not the same effect.

What I am referring to is with the full length setting = True and the listview with say only 4 items is visually centered.
 

Attachments

  • slider.png
    slider.png
    51.6 KB · Views: 1,042

susu

Well-Known Member
Licensed User
Longtime User
Hi Peter,

Could you please add a method to show sliding menu (MenuShow) ? Now it's only MenuHide.

Thank you.
 
Top