B4A Library Circle Menu

Discussion in 'Additional libraries, classes and official updates' started by walterf25, Mar 21, 2017 at 1:48 AM.

  1. walterf25

    walterf25 Well-Known Member Licensed User

    Hello all, it's been a while since i've posted anything, i've created a few libraries small libraries for personal use and have not had so much time to share them.

    Well, today is the day, this library is a wrapper from this library https://android-arsenal.com/details/1/5361 which i wrapped many months ago, i've cleaned it up a little and sharing it with you guys today, is nothing too fancy but it would give a very nice touch to any app in my humble opinion.

    attached is the xml and jar files along with a B4A example on how to use it.
    Also i'am including the resources folder which needs to be included using the
    Please note that the AppCompat library is needed and the AppCompatActivity needs to be extended from the Main Activity.

    B4ACircleMenu
    Author:
    Walter Flores
    Version: 1
    • CircleMenu
      Events:
      • MenuSelected (index as Int As )
      • OnMenuClosed
      • OnMenuOpened
      Methods:
      • BringToFront
      • Initialize (eventname As String, color As Int, openicon As String, closeicon As String)
        initialize library
        Example
        <code>
        Dim menu as CircleMenu
        menu.Initialize("menu1", Colors.Blue, "open_menu", "close_menu")
        </code>
      • Invalidate
      • Invalidate2 (arg0 As Rect)
      • Invalidate3 (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • IsInitialized As Boolean
      • RemoveView
      • RequestFocus As Boolean
      • SendToBack
      • SetBackgroundImage (arg0 As Bitmap)
      • SetColorAnimated (arg0 As Int, arg1 As Int, arg2 As Int)
      • SetLayout (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int)
      • SetLayoutAnimated (arg0 As Int, arg1 As Int, arg2 As Int, arg3 As Int, arg4 As Int)
      • SetVisibleAnimated (arg0 As Int, arg1 As Boolean)
      • addSubMenu (colors() As Int, icons() As String)
        adds submenu icons to main menu
        receives an array or colors and an array of strings whcih point to the icon resources
        <code>
        Dim rescolors() as int = Array As Int(Colors.red, Colors.blue, Colors.Green,Colors.Magenta)
        Dim icons() as String = Array As String ("camera_2","icon_setting","save_48","blank_file")
        menu.addSubMenu(rescolors, icons)
        Activity.AddView(menu, 0, 0, 100%x, 100%y)
        </code>
      Properties:
      • Background As Drawable
      • Color As Int [write only]
      • Enabled As Boolean
      • Height As Int
      • Left As Int
      • Padding()() As Int
      • Parent As Object [read only]
      • Tag As Object
      • Top As Int
      • Visible As Boolean
      • Width As Int

    circlemenu1.png circlemenu2.png

    Hope you guys enjoy it, any questions please feel free to ask,

    Regards,
    Walter
     

    Attached Files:

    victormedranop, denik, eps and 9 others like this.
  2. Johan Schoeman

    Johan Schoeman Well-Known Member Licensed User

    Walter, have just downloaded it and tested it. Very very nice!
     
    walterf25 likes this.
  3. NJDude

    NJDude Expert Licensed User

    Good to see some of the "regulars" still around. :)

    Nicely done bud.
     
    victormedranop, walterf25 and Erel like this.
  4. Mahares

    Mahares Well-Known Member Licensed User

    Very nice piece of work @walterf25
    Is there any way to be able to use text instead of icons here:
    Code:
    Dim icons() As String = Array As String("camera_2","icon_setting","save_48","blank_file")
    For instance, use this to display the sub menu names:
    Code:
    Dim icons() As String = Array As String("Payable","Received","Stock","Comment")
    Also , I noticed that the main menu icon starts out as red, but when clicked, it turns to almost dark brown. Is that by design?
     
  5. JordiCP

    JordiCP Well-Known Member Licensed User

    Thanks for sharing!! I like the effect when one of the expanded icons is clicked :)
     
    walterf25 likes this.
  6. walterf25

    walterf25 Well-Known Member Licensed User

    Thanks Bud, i'm still here, just been a bit busy.

    Walter
     
  7. walterf25

    walterf25 Well-Known Member Licensed User

    I'm not sure, i can look into it, according to the original project, you can only do icons, i think is what gives the menu the very good looking feature.

    As far as the main menu icon, the color can be changed to whatever color you prefer, the color after you open the menu is just a darker color of the color you decide to use and is automatically set, i don't think the function to change the darker color is exposed.

    Regards,
    Walter
     
  8. walterf25

    walterf25 Well-Known Member Licensed User

    Thanks Jordi, it is very cool indeed.

    Walter
     
  9. NJDude

    NJDude Expert Licensed User

    Hey Walt, have you noticed that when you tap the "pink" button on your sample (the icon on the left) there's a "partial ghost" button showing on the bottom right corner of the screen?
     
    Last edited: Mar 25, 2017 at 10:34 PM
Loading...