B4A Library Arc Menu [Class] + [Lib]

Arc Menu:

Here is a nice little animated menu known as Arc Menu. It is based on a native java android library ArcMenu Java Lib. I initially tried to wrap the java library, but my skills weren't up to the job on the day, so I decided to create my own incarnation in b4a code as a class. It is very customizable and I think it adds a nice effect to any User Interface. This should be nice and easy to use. The only methods that are required are the Initialize and at least 1 x AddItem (whats a menu without any menu items)

ScreenShots:

screen1.jpg screen2.jpg screen3.jpg screen4.jpg

Documentation:

ArcMenu
Version: 1
  • Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • _additem (ItemImage As BitmapWrapper) As String
      Adds an item to the menu.
      ItemImage - the image shown as the MenuItem

    • _initialize (Activity As ActivityWrapper, Module As Object, EventName As String, AnimatedButtonImage As BitmapWrapper, StaticButtonImage As BitmapWrapper, x As Int, y As Int) As String
      Initializes the object.

      Parameters:
      Activity - The activity to add the OrbitalMenu to. Use 'Activity' to pass the current activity.
      Module - Use 'Me'
      EventName - The EventName to be use for callbacks.
      _AnimationEnd(Open as Boolean) - this event triggers once the menu has finished expanding or collapsing.
      Open - will return whether the menu is open or not.
      _Click(Position as Int)
      _LongClick(Position as Int)
      Position - returns the Item Position that triggered the event. First Item = 1.
      StaticButtonImage - A static background for the menu button. Use NULL for no image.
      AnimatedButtonImage - A bitmap that will show in front of the StaticBackgroundImage and will rotate 90 degrees when pressed. Use NULL for no image.
      x, y - The coordinates for where the button will appear.

    • _isopen As Boolean
    • _setanimatedbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the AnimatedButtonImage
      Defaults are 20dip x 20dip

    • _setdegreespan (value As Int) As String
      Sets the amount of degrees the MenuItems Orbit will span from the starting point.
      Default is 90

    • _setmenuitemdimensions (width As Int, height As Int) As String
      NOTE: Must be called before Adding and items to the menu.
      Use to override the dimensions of the menu items.
      Defaults are 40dip x 40dip

    • _setmenuitemradius (value As Int) As String
      Use to set the Menu item radius (the distance the items pop out from center)
      Default is 120dip

    • _setstartdegrees (value As Int) As String
      Sets the angle the MenuItems Orbit will start at.
      Default is 0 (straight up.)

    • _setstaticbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the StaticButtonImage
      Defaults are 20dip x 20dip

    • _toggle As String
      Simulates a Click of the menu Button

Below I have added both the class (in a demo project) AND the library, both have the same functionality. I added both so you as the user can choose which to use. The library is the easiest to use, just install as any other library. The class is there if you wish to view / edit the code. This is my first attempt at animations, so hopefully others could learn from it too. Enjoy!

Note: This does require the Animation Plus v2 library to be installed too.
 

Attachments

  • ArcMenuClass.zip
    60.1 KB · Views: 1,500
  • ArcMenuLib.zip
    6.7 KB · Views: 1,402
Last edited:

Gary Milne

Active Member
Licensed User
Longtime User
With these search criteria, it's the first link returned by Google...
But as NJDude suggested, this forum is a better place for a search.
Got it, I was confused by your statement in the discussion regarding Arc Menu that you had pulled version 2 from this site so I was trying to find it elsewhere.
 

koaunglay

Member
Licensed User
Longtime User
When I run, ----------------
Parsing code. 0.02
Compiling code. 0.04
Compiling layouts code. 0.07
Generating R file. 0.45
Compiling generated Java code. 1.34
Convert byte code - optimized dex. Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lbarxdroid/ArcMenuDemo/arcmenu;
at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
at com.android.dx.command.dexer.Main.processClass(Main.java:490)
at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
at com.android.dx.command.dexer.Main.access$400(Main.java:67)
at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:135)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:191)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:123)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:191)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:123)
at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:191)
at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:123)
at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
at com.android.dx.command.dexer.Main.processOne(Main.java:422)
at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
at com.android.dx.command.dexer.Main.run(Main.java:209)
at com.android.dx.command.dexer.Main.main(Main.java:174)
at com.android.dx.command.Main.main(Main.java:91)
1 error; aborting
Optimized dexer failed. Switching to Standard dexer.


----------------
Please help!
 

barx

Well-Known Member
Licensed User
Longtime User
Can you post your code relating to the menu please...
 

microbox

Active Member
Licensed User
Longtime User
Hi barx, thank you for this.. and also to Infomatix. I'm planning to use it in my app if it's okay?
 

barx

Well-Known Member
Licensed User
Longtime User
Hi barx, thank you for this.. and also to Infomatix. I'm planning to use it in my app if it's okay?
That is what it is there for ;)
 

Bitcrawler

Member
Licensed User
Longtime User
Hi barx, this is great. I love it.

But I have a little problem ;-)

I use the PreferenceActivity to change the SetStartDegrees. On FirstRun SetStartDegrees(270). This works. I change it in Preferences to SetStartDegrees(90). When I open the Arc Menu it shows up correct, but it seems like the position counter has not updated. The menu icons have the right positition, but the wrong position id.

When I restart the app, it works correct. But it would be nice to do this on runtime.


Example: After changing SetStartDegrees from 270 to 90

B4X:
Sub ArcMenu_Click(position As Int)
    If position = 1 Then Flashlight_Click (positon = 5 after changing to 90)
    If position = 2 Then Compass_Click (positon = 4 after changing to 90)
    If position = 3 Then ScreenLight_Click (positon = 3 after changing to 90)
    If position = 4 Then Preference (positon = 2 after changing to 90)
    If position = 5 Then StartActivity ("infoact") (positon = 1 after changing to 90)
End Sub

Do you have a solution for this?
 

barx

Well-Known Member
Licensed User
Longtime User
Hi barx, this is great. I love it.

But I have a little problem ;-)

I use the PreferenceActivity to change the SetStartDegrees. On FirstRun SetStartDegrees(270). This works. I change it in Preferences to SetStartDegrees(90). When I open the Arc Menu it shows up correct, but it seems like the position counter has not updated. The menu icons have the right positition, but the wrong position id.

When I restart the app, it works correct. But it would be nice to do this on runtime.


Example: After changing SetStartDegrees from 270 to 90

B4X:
Sub ArcMenu_Click(position As Int)
    If position = 1 Then Flashlight_Click (positon = 5 after changing to 90)
    If position = 2 Then Compass_Click (positon = 4 after changing to 90)
    If position = 3 Then ScreenLight_Click (positon = 3 after changing to 90)
    If position = 4 Then Preference (positon = 2 after changing to 90)
    If position = 5 Then StartActivity ("infoact") (positon = 1 after changing to 90)
End Sub

Do you have a solution for this?
I've had a flick through the code but cannot see anything that would cause this. Calling SetStartDegrees sets a private variable in the class and this is used in the calculations whenever the menu button is clicked.

manybe show your code from Preference activity that changes the StartDegree, see if I can spot something there. Or post a sample project showing the issue. Maybe I didn't understand the issue properly.

Thanks
 

koaunglay

Member
Licensed User
Longtime User
Please what is my error? I didn't change anycode. But I get this error.
B4X:
Parsing code.                           0.05
Compiling code.                         0.31
Compiling layouts code.                 0.01
Generating R file.                      0.11
Compiling generated Java code.          1.12
Convert byte code - optimized dex.      Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lbarxdroid/ArcMenuDemo/arcmenu;
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
    at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
    at com.android.dx.command.dexer.Main.processClass(Main.java:490)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
    at com.android.dx.command.dexer.Main.access$400(Main.java:67)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:135)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:191)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:123)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:191)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:123)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:191)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:123)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
    at com.android.dx.command.dexer.Main.processOne(Main.java:422)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
    at com.android.dx.command.dexer.Main.run(Main.java:209)
    at com.android.dx.command.dexer.Main.main(Main.java:174)
    at com.android.dx.command.Main.main(Main.java:91)
1 error; aborting
    Optimized dexer failed. Switching to Standard dexer.
Arc Menu:

Here is a nice little animated menu known as Arc Menu. It is based on a native java android library ArcMenu Java Lib. I initially tried to wrap the java library, but my skills weren't up to the job on the day, so I decided to create my own incarnation in b4a code as a class. It is very customizable and I think it adds a nice effect to any User Interface. This should be nice and easy to use. The only methods that are required are the Initialize and at least 1 x AddItem (whats a menu without any menu items)

ScreenShots:

View attachment 16902 View attachment 16903 View attachment 16904 View attachment 16905

Documentation:

ArcMenu
Version:
1
  • Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • _additem (ItemImage As BitmapWrapper) As String
      Adds an item to the menu.
      ItemImage - the image shown as the MenuItem

    • _initialize (Activity As ActivityWrapper, Module As Object, EventName As String, AnimatedButtonImage As BitmapWrapper, StaticButtonImage As BitmapWrapper, x As Int, y As Int) As String
      Initializes the object.

      Parameters:
      Activity - The activity to add the OrbitalMenu to. Use 'Activity' to pass the current activity.
      Module - Use 'Me'
      EventName - The EventName to be use for callbacks.
      _AnimationEnd(Open as Boolean) - this event triggers once the menu has finished expanding or collapsing.
      Open - will return whether the menu is open or not.
      _Click(Position as Int)
      _LongClick(Position as Int)
      Position - returns the Item Position that triggered the event. First Item = 1.
      StaticButtonImage - A static background for the menu button. Use NULL for no image.
      AnimatedButtonImage - A bitmap that will show in front of the StaticBackgroundImage and will rotate 90 degrees when pressed. Use NULL for no image.
      x, y - The coordinates for where the button will appear.

    • _isopen As Boolean
    • _setanimatedbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the AnimatedButtonImage
      Defaults are 20dip x 20dip

    • _setdegreespan (value As Int) As String
      Sets the amount of degrees the MenuItems Orbit will span from the starting point.
      Default is 90

    • _setmenuitemdimensions (width As Int, height As Int) As String
      NOTE: Must be called before Adding and items to the menu.
      Use to override the dimensions of the menu items.
      Defaults are 40dip x 40dip

    • _setmenuitemradius (value As Int) As String
      Use to set the Menu item radius (the distance the items pop out from center)
      Default is 120dip

    • _setstartdegrees (value As Int) As String
      Sets the angle the MenuItems Orbit will start at.
      Default is 0 (straight up.)

    • _setstaticbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the StaticButtonImage
      Defaults are 20dip x 20dip

    • _toggle As String
      Simulates a Click of the menu Button

Below I have added both the class (in a demo project) AND the library, both have the same functionality. I added both so you as the user can choose which to use. The library is the easiest to use, just install as any other library. The class is there if you wish to view / edit the code. This is my first attempt at animations, so hopefully others could learn from it too. Enjoy!

Note: This does require the Animation Plus v2 library to be installed too.[/QUOTE
 

koaunglay

Member
Licensed User
Longtime User
Arc Menu:

Here is a nice little animated menu known as Arc Menu. It is based on a native java android library ArcMenu Java Lib. I initially tried to wrap the java library, but my skills weren't up to the job on the day, so I decided to create my own incarnation in b4a code as a class. It is very customizable and I think it adds a nice effect to any User Interface. This should be nice and easy to use. The only methods that are required are the Initialize and at least 1 x AddItem (whats a menu without any menu items)

ScreenShots:

View attachment 16902 View attachment 16903 View attachment 16904 View attachment 16905

Documentation:

ArcMenu
Version:
1
  • Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • _additem (ItemImage As BitmapWrapper) As String
      Adds an item to the menu.
      ItemImage - the image shown as the MenuItem

    • _initialize (Activity As ActivityWrapper, Module As Object, EventName As String, AnimatedButtonImage As BitmapWrapper, StaticButtonImage As BitmapWrapper, x As Int, y As Int) As String
      Initializes the object.

      Parameters:
      Activity - The activity to add the OrbitalMenu to. Use 'Activity' to pass the current activity.
      Module - Use 'Me'
      EventName - The EventName to be use for callbacks.
      _AnimationEnd(Open as Boolean) - this event triggers once the menu has finished expanding or collapsing.
      Open - will return whether the menu is open or not.
      _Click(Position as Int)
      _LongClick(Position as Int)
      Position - returns the Item Position that triggered the event. First Item = 1.
      StaticButtonImage - A static background for the menu button. Use NULL for no image.
      AnimatedButtonImage - A bitmap that will show in front of the StaticBackgroundImage and will rotate 90 degrees when pressed. Use NULL for no image.
      x, y - The coordinates for where the button will appear.

    • _isopen As Boolean
    • _setanimatedbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the AnimatedButtonImage
      Defaults are 20dip x 20dip

    • _setdegreespan (value As Int) As String
      Sets the amount of degrees the MenuItems Orbit will span from the starting point.
      Default is 90

    • _setmenuitemdimensions (width As Int, height As Int) As String
      NOTE: Must be called before Adding and items to the menu.
      Use to override the dimensions of the menu items.
      Defaults are 40dip x 40dip

    • _setmenuitemradius (value As Int) As String
      Use to set the Menu item radius (the distance the items pop out from center)
      Default is 120dip

    • _setstartdegrees (value As Int) As String
      Sets the angle the MenuItems Orbit will start at.
      Default is 0 (straight up.)

    • _setstaticbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the StaticButtonImage
      Defaults are 20dip x 20dip

    • _toggle As String
      Simulates a Click of the menu Button

Below I have added both the class (in a demo project) AND the library, both have the same functionality. I added both so you as the user can choose which to use. The library is the easiest to use, just install as any other library. The class is there if you wish to view / edit the code. This is my first attempt at animations, so hopefully others could learn from it too. Enjoy!

Note: This does require the Animation Plus v2 library to be installed too.
Very very nice ! I can run it. No need to check arcmenu lib if it is arcmenu module . Right?
 

koaunglay

Member
Licensed User
Longtime User
Arc Menu:

Here is a nice little animated menu known as Arc Menu. It is based on a native java android library ArcMenu Java Lib. I initially tried to wrap the java library, but my skills weren't up to the job on the day, so I decided to create my own incarnation in b4a code as a class. It is very customizable and I think it adds a nice effect to any User Interface. This should be nice and easy to use. The only methods that are required are the Initialize and at least 1 x AddItem (whats a menu without any menu items)

ScreenShots:

View attachment 16902 View attachment 16903 View attachment 16904 View attachment 16905

Documentation:

ArcMenu
Version:
1
  • Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • _additem (ItemImage As BitmapWrapper) As String
      Adds an item to the menu.
      ItemImage - the image shown as the MenuItem

    • _initialize (Activity As ActivityWrapper, Module As Object, EventName As String, AnimatedButtonImage As BitmapWrapper, StaticButtonImage As BitmapWrapper, x As Int, y As Int) As String
      Initializes the object.

      Parameters:
      Activity - The activity to add the OrbitalMenu to. Use 'Activity' to pass the current activity.
      Module - Use 'Me'
      EventName - The EventName to be use for callbacks.
      _AnimationEnd(Open as Boolean) - this event triggers once the menu has finished expanding or collapsing.
      Open - will return whether the menu is open or not.
      _Click(Position as Int)
      _LongClick(Position as Int)
      Position - returns the Item Position that triggered the event. First Item = 1.
      StaticButtonImage - A static background for the menu button. Use NULL for no image.
      AnimatedButtonImage - A bitmap that will show in front of the StaticBackgroundImage and will rotate 90 degrees when pressed. Use NULL for no image.
      x, y - The coordinates for where the button will appear.

    • _isopen As Boolean
    • _setanimatedbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the AnimatedButtonImage
      Defaults are 20dip x 20dip

    • _setdegreespan (value As Int) As String
      Sets the amount of degrees the MenuItems Orbit will span from the starting point.
      Default is 90

    • _setmenuitemdimensions (width As Int, height As Int) As String
      NOTE: Must be called before Adding and items to the menu.
      Use to override the dimensions of the menu items.
      Defaults are 40dip x 40dip

    • _setmenuitemradius (value As Int) As String
      Use to set the Menu item radius (the distance the items pop out from center)
      Default is 120dip

    • _setstartdegrees (value As Int) As String
      Sets the angle the MenuItems Orbit will start at.
      Default is 0 (straight up.)

    • _setstaticbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the StaticButtonImage
      Defaults are 20dip x 20dip

    • _toggle As String
      Simulates a Click of the menu Button

Below I have added both the class (in a demo project) AND the library, both have the same functionality. I added both so you as the user can choose which to use. The library is the easiest to use, just install as any other library. The class is there if you wish to view / edit the code. This is my first attempt at animations, so hopefully others could learn from it too. Enjoy!

Note: This does require the Animation Plus v2 library to be installed too.
Very very nice ! I can run it. No need to check arcmenu lib if it is arcmenu module . Right?
 

koaunglay

Member
Licensed User
Longtime User
Arc Menu:

Here is a nice little animated menu known as Arc Menu. It is based on a native java android library ArcMenu Java Lib. I initially tried to wrap the java library, but my skills weren't up to the job on the day, so I decided to create my own incarnation in b4a code as a class. It is very customizable and I think it adds a nice effect to any User Interface. This should be nice and easy to use. The only methods that are required are the Initialize and at least 1 x AddItem (whats a menu without any menu items)

ScreenShots:

View attachment 16902 View attachment 16903 View attachment 16904 View attachment 16905

Documentation:

ArcMenu
Version:
1
  • Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • _additem (ItemImage As BitmapWrapper) As String
      Adds an item to the menu.
      ItemImage - the image shown as the MenuItem

    • _initialize (Activity As ActivityWrapper, Module As Object, EventName As String, AnimatedButtonImage As BitmapWrapper, StaticButtonImage As BitmapWrapper, x As Int, y As Int) As String
      Initializes the object.

      Parameters:
      Activity - The activity to add the OrbitalMenu to. Use 'Activity' to pass the current activity.
      Module - Use 'Me'
      EventName - The EventName to be use for callbacks.
      _AnimationEnd(Open as Boolean) - this event triggers once the menu has finished expanding or collapsing.
      Open - will return whether the menu is open or not.
      _Click(Position as Int)
      _LongClick(Position as Int)
      Position - returns the Item Position that triggered the event. First Item = 1.
      StaticButtonImage - A static background for the menu button. Use NULL for no image.
      AnimatedButtonImage - A bitmap that will show in front of the StaticBackgroundImage and will rotate 90 degrees when pressed. Use NULL for no image.
      x, y - The coordinates for where the button will appear.

    • _isopen As Boolean
    • _setanimatedbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the AnimatedButtonImage
      Defaults are 20dip x 20dip

    • _setdegreespan (value As Int) As String
      Sets the amount of degrees the MenuItems Orbit will span from the starting point.
      Default is 90

    • _setmenuitemdimensions (width As Int, height As Int) As String
      NOTE: Must be called before Adding and items to the menu.
      Use to override the dimensions of the menu items.
      Defaults are 40dip x 40dip

    • _setmenuitemradius (value As Int) As String
      Use to set the Menu item radius (the distance the items pop out from center)
      Default is 120dip

    • _setstartdegrees (value As Int) As String
      Sets the angle the MenuItems Orbit will start at.
      Default is 0 (straight up.)

    • _setstaticbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the StaticButtonImage
      Defaults are 20dip x 20dip

    • _toggle As String
      Simulates a Click of the menu Button

Below I have added both the class (in a demo project) AND the library, both have the same functionality. I added both so you as the user can choose which to use. The library is the easiest to use, just install as any other library. The class is there if you wish to view / edit the code. This is my first attempt at animations, so hopefully others could learn from it too. Enjoy!

Note: This does require the Animation Plus v2 library to be installed too.
Very very nice ! I can run it. No need to check arcmenu lib if it is arcmenu module . Right?
 

koaunglay

Member
Licensed User
Longtime User
Very very nice ! I can run it. No need to check arcmenu lib if it is arcmenu module . Right?

Arc Menu:

Here is a nice little animated menu known as Arc Menu. It is based on a native java android library ArcMenu Java Lib. I initially tried to wrap the java library, but my skills weren't up to the job on the day, so I decided to create my own incarnation in b4a code as a class. It is very customizable and I think it adds a nice effect to any User Interface. This should be nice and easy to use. The only methods that are required are the Initialize and at least 1 x AddItem (whats a menu without any menu items)

ScreenShots:

View attachment 16902 View attachment 16903 View attachment 16904 View attachment 16905

Documentation:

ArcMenu
Version:
1
  • Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • _additem (ItemImage As BitmapWrapper) As String
      Adds an item to the menu.
      ItemImage - the image shown as the MenuItem

    • _initialize (Activity As ActivityWrapper, Module As Object, EventName As String, AnimatedButtonImage As BitmapWrapper, StaticButtonImage As BitmapWrapper, x As Int, y As Int) As String
      Initializes the object.

      Parameters:
      Activity - The activity to add the OrbitalMenu to. Use 'Activity' to pass the current activity.
      Module - Use 'Me'
      EventName - The EventName to be use for callbacks.
      _AnimationEnd(Open as Boolean) - this event triggers once the menu has finished expanding or collapsing.
      Open - will return whether the menu is open or not.
      _Click(Position as Int)
      _LongClick(Position as Int)
      Position - returns the Item Position that triggered the event. First Item = 1.
      StaticButtonImage - A static background for the menu button. Use NULL for no image.
      AnimatedButtonImage - A bitmap that will show in front of the StaticBackgroundImage and will rotate 90 degrees when pressed. Use NULL for no image.
      x, y - The coordinates for where the button will appear.

    • _isopen As Boolean
    • _setanimatedbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the AnimatedButtonImage
      Defaults are 20dip x 20dip

    • _setdegreespan (value As Int) As String
      Sets the amount of degrees the MenuItems Orbit will span from the starting point.
      Default is 90

    • _setmenuitemdimensions (width As Int, height As Int) As String
      NOTE: Must be called before Adding and items to the menu.
      Use to override the dimensions of the menu items.
      Defaults are 40dip x 40dip

    • _setmenuitemradius (value As Int) As String
      Use to set the Menu item radius (the distance the items pop out from center)
      Default is 120dip

    • _setstartdegrees (value As Int) As String
      Sets the angle the MenuItems Orbit will start at.
      Default is 0 (straight up.)

    • _setstaticbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the StaticButtonImage
      Defaults are 20dip x 20dip

    • _toggle As String
      Simulates a Click of the menu Button

Below I have added both the class (in a demo project) AND the library, both have the same functionality. I added both so you as the user can choose which to use. The library is the easiest to use, just install as any other library. The class is there if you wish to view / edit the code. This is my first attempt at animations, so hopefully others could learn from it too. Enjoy!

Note: This does require the Animation Plus v2 library to be installed too.
Please what is my error? I didn't change anycode. But I get this error.
B4X:
Parsing code.                           0.05
Compiling code.                         0.31
Compiling layouts code.                 0.01
Generating R file.                      0.11
Compiling generated Java code.          1.12
Convert byte code - optimized dex.      Error
UNEXPECTED TOP-LEVEL EXCEPTION:
java.lang.IllegalArgumentException: already added: Lbarxdroid/ArcMenuDemo/arcmenu;
    at com.android.dx.dex.file.ClassDefsSection.add(ClassDefsSection.java:123)
    at com.android.dx.dex.file.DexFile.add(DexFile.java:163)
    at com.android.dx.command.dexer.Main.processClass(Main.java:490)
    at com.android.dx.command.dexer.Main.processFileBytes(Main.java:459)
    at com.android.dx.command.dexer.Main.access$400(Main.java:67)
    at com.android.dx.command.dexer.Main$1.processFileBytes(Main.java:398)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:135)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:191)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:123)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:191)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:123)
    at com.android.dx.cf.direct.ClassPathOpener.processDirectory(ClassPathOpener.java:191)
    at com.android.dx.cf.direct.ClassPathOpener.processOne(ClassPathOpener.java:123)
    at com.android.dx.cf.direct.ClassPathOpener.process(ClassPathOpener.java:109)
    at com.android.dx.command.dexer.Main.processOne(Main.java:422)
    at com.android.dx.command.dexer.Main.processAllFiles(Main.java:333)
    at com.android.dx.command.dexer.Main.run(Main.java:209)
    at com.android.dx.command.dexer.Main.main(Main.java:174)
    at com.android.dx.command.Main.main(Main.java:91)
1 error; aborting
    Optimized dexer failed. Switching to Standard dexer.
 

koaunglay

Member
Licensed User
Longtime User
Very very nice ! I can run it. No need to check arcmenu lib if it is arcmenu module . Right?
 

koaunglay

Member
Licensed User
Longtime User
Very very nice ! I can run it. No need to check arcmenu lib if it is arcmenu module . Right?
Arc Menu:

Here is a nice little animated menu known as Arc Menu. It is based on a native java android library ArcMenu Java Lib. I initially tried to wrap the java library, but my skills weren't up to the job on the day, so I decided to create my own incarnation in b4a code as a class. It is very customizable and I think it adds a nice effect to any User Interface. This should be nice and easy to use. The only methods that are required are the Initialize and at least 1 x AddItem (whats a menu without any menu items)

ScreenShots:

View attachment 16902 View attachment 16903 View attachment 16904 View attachment 16905

Documentation:

ArcMenu
Version:
1
  • Methods:
    • IsInitialized As Boolean
      Tests whether the object has been initialized.
    • _additem (ItemImage As BitmapWrapper) As String
      Adds an item to the menu.
      ItemImage - the image shown as the MenuItem

    • _initialize (Activity As ActivityWrapper, Module As Object, EventName As String, AnimatedButtonImage As BitmapWrapper, StaticButtonImage As BitmapWrapper, x As Int, y As Int) As String
      Initializes the object.

      Parameters:
      Activity - The activity to add the OrbitalMenu to. Use 'Activity' to pass the current activity.
      Module - Use 'Me'
      EventName - The EventName to be use for callbacks.
      _AnimationEnd(Open as Boolean) - this event triggers once the menu has finished expanding or collapsing.
      Open - will return whether the menu is open or not.
      _Click(Position as Int)
      _LongClick(Position as Int)
      Position - returns the Item Position that triggered the event. First Item = 1.
      StaticButtonImage - A static background for the menu button. Use NULL for no image.
      AnimatedButtonImage - A bitmap that will show in front of the StaticBackgroundImage and will rotate 90 degrees when pressed. Use NULL for no image.
      x, y - The coordinates for where the button will appear.

    • _isopen As Boolean
    • _setanimatedbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the AnimatedButtonImage
      Defaults are 20dip x 20dip

    • _setdegreespan (value As Int) As String
      Sets the amount of degrees the MenuItems Orbit will span from the starting point.
      Default is 90

    • _setmenuitemdimensions (width As Int, height As Int) As String
      NOTE: Must be called before Adding and items to the menu.
      Use to override the dimensions of the menu items.
      Defaults are 40dip x 40dip

    • _setmenuitemradius (value As Int) As String
      Use to set the Menu item radius (the distance the items pop out from center)
      Default is 120dip

    • _setstartdegrees (value As Int) As String
      Sets the angle the MenuItems Orbit will start at.
      Default is 0 (straight up.)

    • _setstaticbuttondimensions (width As Int, height As Int) As String
      Use to override the dimensions of the StaticButtonImage
      Defaults are 20dip x 20dip

    • _toggle As String
      Simulates a Click of the menu Button

Below I have added both the class (in a demo project) AND the library, both have the same functionality. I added both so you as the user can choose which to use. The library is the easiest to use, just install as any other library. The class is there if you wish to view / edit the code. This is my first attempt at animations, so hopefully others could learn from it too. Enjoy!

Note: This does require the Animation Plus v2 library to be installed too.
 

barx

Well-Known Member
Licensed User
Longtime User
Very very nice ! I can run it. No need to check arcmenu lib if it is arcmenu module . Right?
No need for both. The lib is for quick easy use. The class was for peoe to see how it was done and to allow modification if they wish. Please do not keep posting the same question like above. Next time I simply won't answer.
 
Top