B4A Library MSMaterialMenu - Animating icons

thedesolatesoul

Expert
Licensed User
This library simulates some animations on the drawer icon on the titlebar that are coming in on the material design.
It comes from this library: https://github.com/balysv/material-menu



Dependencies:
- The NineOldAndroid java package, is included in the zip file.

Credits:
Thanks to Informatix for his NineOldAndroids library and for modifying it for me.

Sample:
B4X:
    Dim StdABHelper As StdActionBarHelper
    Dim MMenu As MSMaterialMenu
    StdABHelper.Initialize
    MMenu.Initialize("MMenu")

    MMenu.setScaleAndStroke(1,2)
    MMenu.Color = Colors.Black
    StdABHelper.Icon = MMenu.Drawable


Sub StdAB_ButtonClicked
    If MMenu.State = "BURGER" Then
        MMenu.animatePressedState("X")
        NavDrawer.OpenDrawer
    Else
        MMenu.animatePressedState("BURGER")
        NavDrawer.CloseDrawer
    End If
End Sub
This will work best with StdActionBar+StdActionBarHelper (wish they were merged).
 

Attachments

Last edited:

thedesolatesoul

Expert
Licensed User
I was hoping to write a bigger/better material sample but i got stuck with my NavDrawer transparent and havent had time to do it ever since :(
 

migrec

Member
Licensed User
using this with the sliding menu class and it works really fine! will you make some more material libraries when you have time?
 

thedesolatesoul

Expert
Licensed User
I will, I have a couple on my ToDo list but getting no time at all.
Do you have a demo of it with the sliding menu class?
I used it with the AHNavigationDrawer library but I was not satisified with the results. (Drawer was jerky and transparent, also need a way to animate the icon AS the drawer moves)
 

migrec

Member
Licensed User
It works fine with SlideMenu class and it's highly customizable, but it's also simpler like you can't change the item click color. I can post it soon, just need to clean a bit first.
 

thedesolatesoul

Expert
Licensed User
The reason I wanted to go with a native google drawer was because it would look consistent on newer versions on Android. (For e.g. in 'L' the drawer slides OVER the actionbar, we dont have any library that does that). Maybe if I look at your demo it will make me go for the class.
Sometimes google gives me headaches with their constant changes, U-turns and inconsistency.
 

thedesolatesoul

Expert
Licensed User
Here is an easier alternative to Navigation Drawer, it uses the SlideMenu class.

It should look like the screenshot, just ask if something looks weird.
Very nice, very clean!!
My only gripe with this class is that it doesnt have a gesture to pull the drawer open but that should be easy to add with GestureDetector.
Also, I can see you have done a lot of work on the xml theme, very impressive! I was also doing the same at one point.
 

thedesolatesoul

Expert
Licensed User
This is excellent - thank you. Don't suppose you have any plans on material style buttons do you?
Yes I do want to. I was hoping the compatiblity library will have some kind of theme/style we could overlay on the buttons. I didnt want to port a library specifically for this. Still not sure how to acheive it.
 
Top