B4A Library [Class] ModularMenu

[Class/Library] ModularMenu

I created a simple alternative to the standard menu similar to the one used by many apps.

Requires the library AnimationPlus V2!.

Events:
- Click

Methods:
- AddMenuItem
- AddMenuItemAt
- OpenMenu
- CloseMenu
- IsOpen
- RenameItem

- RemoveAt
- RemoveAll
- MenuLock
- MenuUnlock
- KeyMenuPress
- Size

[ UPDATE 1.10 ]
- Added the method AddMenuItemAt to add an item at a specific position.

[ UPDATE 1.20 ]
- Added the method RemoveAll.
- Now the events are generated in different activity from the Main.

[ UPDATE 1.32 ]
- Inserted also Library version in Zip Class.
- Adding methods LoadItem and SaveItem to use the same menu with any Activity. I have included an example Multi-Activity in the Zip (use the library for this).
- Small improvements.

[ UPDATE 1.33 ]
- Minor bugfix.

[ UPDATE 1.34 ]
- Fixed bug with RemoveAll method.
- Fixed the forced closure devices with ICS.

[ UPDATE 1.36 ]
- Added the method RenameItem and IsOpen.
- Modified slightly the animation menu.

[ UPDATE 1.37 ]
- Fixed some bugs.

IMPORTANT
For most fluidity add this code to the Manifest:
B4X:
SetActivityAttribute(Main, android:hardwareAccelerated, "true")

For suggestions and bug reports please do not hesitate to post it here.
 

Attachments

  • 2013.01.03-09.33.03.png
    2013.01.03-09.33.03.png
    37.6 KB · Views: 2,314
  • ModulaMenu_1.37.zip
    57 KB · Views: 460
Last edited:

barx

Well-Known Member
Licensed User
Indeed, it does now work. Awesome work!

What was the deal?
 

Dominex

Active Member
Licensed User
Indeed, it does now work. Awesome work!

What was the deal?
In truth I found a solution without understanding the problem. What is certain and that alone the class works well, and works well on all devices and OS that I tried, but combined with your app, which is a set of other classes, verifca a problem, but only on ICS , so I can say it is a problem of interaction between all these things.

The specific part that created the problem was the removal of a panel with RemoveView, insiegabile thing, but it happened. I solved the problem by removing the command that fortunately was not indispensable.

Luckily I had a device that created the same problem, otherwise I would not be able to find the solution.
 

barx

Well-Known Member
Licensed User
Strange behaviour indeed, well done for finding it. I don't think i would even know how to diagnose that...
 

NFOBoy

Active Member
Licensed User
Had to use <uses-sdk android:minSdkVersion="4" android:targetSdkVersion="10"/> as well, in order to get the menu button to show on the Action Bar of one of my Honeycomb tablet. (actually, 12 would've been ok, but I realize that some may still have 10)

Just wondering, does anyone know if this affects any other devices negatively? (the rest of my devices are phones with a menu key, and they work as expected... :) )

Ross
 

desof

Well-Known Member
Licensed User
AnimationSet not inlcudes?

Parsing code. Error
Error parsing program.
Error description: Unknown type: animationset
Are you missing a library reference?
Occurred on line: 70
Dim AnimSet As AnimationSet
 

ivanomonti

Well-Known Member
Licensed User
Una correzione che andrebbe fatta e che su un tablet tipo Note 10 il menu non è accessibile in quanto non ha il tasto home mmmm ho forse non ho capito come fare.

A correction that should be done on a tablet, and type notes 10 the menu is not accessible because it does not have the home button mmmm maybe I did not understand how to do.
 

Dominex

Active Member
Licensed User
Una correzione che andrebbe fatta e che su un tablet tipo Note 10 il menu non è accessibile in quanto non ha il tasto home mmmm ho forse non ho capito come fare.
Il problema Ivano è legato all'OS, in particolare credo che da ICS (4.0) in poi non ci sia più il tasto Menù soft se non utilizzi appositamente della API più vecchie. Ne abbiamo parlato anche qualche post più su. Al momento non conosco un sistema per far apparire forzatamente il tasto Menu soft.
 

CidTek

Active Member
Licensed User
Really nice stuff Dominex!

Two questions...
Where did you get that icon collection?

How can I raise the bottom position of the menu? I need it to clear a custom action menu that is across the bottom of my activity.
 

Dominex

Active Member
Licensed User
Really nice stuff Dominex!

Two questions...
Where did you get that icon collection?

How can I raise the bottom position of the menu? I need it to clear a custom action menu that is across the bottom of my activity.
Tnx!

The icons are in different folders within the "android-sdk".

You can change t the Y position of the menu to the line 218.
B4X:
218 PosY = 100%y-Height+5
 

Dominex

Active Member
Licensed User
Una correzione che andrebbe fatta e che su un tablet tipo Note 10 il menu non è accessibile in quanto non ha il tasto home mmmm ho forse non ho capito come fare.

A correction that should be done on a tablet, and type notes 10 the menu is not accessible because it does not have the home button mmmm maybe I did not understand how to do.

Ho risolto modificando il Manifest sostituendo la parte di codice che riguarda l'SDK, chiaramente impone dei limiti al tipo di SDK che puoi usare.

I solved it by changing the Manifest replacing the piece of code that relates to the SDK, clearly imposes limits on the type of the SDK that you can use.

B4X:
<uses-sdk android:minSdkVersion="4" android:targetSdkVersion="10"/>
 

magi6162

Well-Known Member
Licensed User
Problem:
B4X:
Sub Globals
    'These global variables will be redeclared each time the activity is created.
    'These variables can only be accessed from this module.
     Dim mm As ModularMenu
    Dim mmItem As List
 nd Sub

Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    'Activity.LoadLayout("Layout1")
    Activity.LoadLayout("Citta")

    mm.Initialize(6,40dip,Activity,Me)
    mm.AddMenuItem("Nuovo",Null,"New")            '0
    mm.AddMenuItem("Modifica",Null,"Edit")        '1
    mm.AddMenuItem("Cancella",Null,"Delete")    '2
    mm.AddMenuItem("Annulla",Null,"Cancel")        '3
    mm.AddMenuItem("Salva",Null,"Save")            '4
    mm.AddMenuItem("Indietro",Null,"Back")        '5
    mmItem.Initialize
    mmItem.AddAll(mm.SaveItem)

    mm.RemoveAt(3)        'Annulla             
    mm.RemoveAt(4)        'Salva
    mm.OpenMenu     <-------- Problem:  Always visible six items

Help me, please
 

magi6162

Well-Known Member
Licensed User
Same problem.
When refresh the library the version number always 1.36 not 1.37

thank for help
 

Dey

Active Member
Licensed User
Ciao Dominex,
sto provando la tua classe e riscontro problemi in una activity dove ho la libreria ULV Ultimate List View,
sai per caso se ci sono incompatibilità?
Saluti
 
Top