Android Question Material Drawer V0.5 beta

Discussion in 'Android Questions' started by DonManfred, Jun 4, 2016.

  1. DonManfred

    DonManfred Expert Licensed User

    This thread is about the beta phase of my newest wrap. It is a wrap for this Github project: Material Drawer by Mike Penz

    At present the library is based on Version 5.8.1 of the Github project

    The Library and download can be found HERE

    Mike Penz (Github) / DonManfred (wrapper)
    Version: 0.9 beta

    this contains the (most probably a bit chaotic) code for the example i build so far.
    So i just tried out how work this, and this and the code came up chaotic....
    I´m sure more examples will follow in future. Maybe made from one of the beatestes? (grins)
    this zip contains the folder "resource"
    copy this folder to your Project or maybe to your additional libraries folder.
    you need to adapt the #additionalres directive to match your folder and
    Copy all files to your additional libs folder
    Contains all needed AAR files. Copy them all to your additional libs folder

    The library depends on some other JARs from the google Maven repository.

    Post any questions regarding this librarywrap in this Thread please.

    Note that this library wrap is in development and subject to be changed before releasing the library.

    The example at present state shows all i have tried so far.
    Some features are not tested at all.
    Some features does not work as yet. The profile and everything about the profileheaderdraweritem for example.

    The Library and download can be found HERE
    Last edited: Dec 22, 2016
  2. itgirl

    itgirl Active Member Licensed User

    first thing come to mind is
    when i try to add a menu item as follows
    Menu.Add2(1,1,"test1",Null).SHOW_AS_ACTION_ALWAYS =ACMenuItem1.SHOW_AS_ACTION_IF_ROOM
    the SHOW_AS_ACTION_IF_ROOM and other ints are missing from ACMenuItem1 or maybe you have implemented it in another way im not sure

    also i cant see the ACMenuItem1.SearchView ??
  3. DonManfred

    DonManfred Expert Licensed User

    Aeh... What object is "Menu"? ACMenuItem1 is not part of this library!?
  4. itgirl

    itgirl Active Member Licensed User

    its ACMenu part of appcompact i think its the different bettwen version of appcompact
  5. DonManfred

    DonManfred Expert Licensed User

    ACMenu is part of the AppCompat.

    The Drawer needs to have a AppCompat compatible "base-app" to be used in.
    the example only uses some basic appcompat layout... But they are not part of the drawer.

    The focus should be the drawer itself and it look, behaviour, features, bugs ;)
    lemonisdead and itgirl like this.
  6. itgirl

    itgirl Active Member Licensed User

    Yup your right lol sorry about that.... looks amazing so far

    Attached Files:

    • 1.png
      File size:
      85.1 KB
  7. DonManfred

    DonManfred Expert Licensed User

    Can you share the code that creates this look? Especially the headeritem with the image
    MarcoRome likes this.
  8. itgirl

    itgirl Active Member Licensed User

    its not based on profiles come with Lib it's just a panel i created manually with 1 image and 3 label ... because the profiles thingy was so messed up and i didnt like it so i decided to make it manually, this way i can take control of all views in the header with their status(left,width,top....) and access them whenever i need to :)
  9. DonManfred

    DonManfred Expert Licensed User

    but you added it somehow to the drawer? How did you do this? I wrote the wrapper but does not have used the drawer itself much.
    I would like to see the code you used to add your own layout to the drawer. ;)
    probably it is a panel you loaded a layout to or so?
  10. itgirl

    itgirl Active Member Licensed User

    Sure , the only tricky part was how to get the drawer width in both states landscape andportrait .... i don't know why but the drawer width is different on each device not as google mentioned here thats why i had to use withDrawerWidthDp ,,,, here you go :
    for the drawer it self
        pnlHdr.Color = AppColors
        pnlHdr.Tag = 
        MDB.withHeader(pnlHdr, drawerwidth, 
        ABHelper.ShowUpIndicator = 
    the panel goes right here after update the header which the bitmap comes from http
    Sub updateheader (bt As Bitmap)
            profilename.TextColor = 
            profilename.TextSize = 
            profilename.Gravity = 
            profileFullname.TextColor = 
            profileFullname.TextSize = 
            profileFullname.Gravity = 

    If  manager.GetString("Fullname") <> "0" Then
                  profilename.Text = manager.GetString(
                  profileFullname.Text = manager.GetString(
                  profilename.Text = GetLang.GetResourceString(
                  profileFullname.Text = GetLang.GetResourceString(
    End If
    Dim profiletagdown As Label
             profiletagdown.TextColor = 
             profiletagdown.TextSize = 
             profiletagdown.Typeface = fontawsome.FontAwesomeTypeface
             profiletagdown.Text = fontawsome.GetFontAwesomeIconByName(
             profiletagdown.Gravity = 

    16dip,profilepic.Top + profilepic.Height + 10dip,pnlHdr.Width /2 ,20dip)
    16dip,profilename.Top  + profilename.Height + 10dip,pnlHdr.Width /2,20dip)
             pnlHdr.AddView(profiletagdown,drawerwidth - 
    35dip  ,profileFullname.Top + profileFullname.Height + 10dip,20dip,20dip)

            profilepic.ImageBitmap = bt
    Dim xImgSize As Int = 25%x * 100%y/100%x
    Dim States(3,1As Int
    0,0) = 16842919
    1,0) = 16842910
    2,0) = -16842910
    Dim Color(3As Int = Array As Int(AppColors,Colors.White, AppColors)

            pnlHdr.Height =profiletagdown.Top + 
            headerloader.Visible = 
    end sub
    inakigarm likes this.
  11. MarcoRome

    MarcoRome Expert Licensed User

    Hi Don. After compiling I have this error:

  12. DonManfred

    DonManfred Expert Licensed User

    I dont get this with the examplecode i posted.

    Try to build your own example and see what happens there...
  13. MarcoRome

    MarcoRome Expert Licensed User

    Also if i compile withour code, only with library, example only Activity_create that open layout i have same error.

    Here example:
    #Region  Project Attributes
    #ApplicationLabel: Test
    #VersionCode: 1
    'SupportedOrientations possible values: unspecified, landscape or portrait.
        #SupportedOrientations: unspecified
    #CanInstallToExternalStorage: False
    #End Region

    '#AdditionalRes: ..\resource
    '#AdditionalRes: ..\res.materialize
    '#AdditionalRes: ..\res.fastadapter
    '#AdditionalRes: $AdditionalLibs$\b4a_appcompat, de.amberhome.objects.appcompat
    '#AdditionalRes: $AndroidSDK$\extras\android\support\v7\appcompat\res,
    '#AdditionalRes: $AndroidSDK$\extras\android\support\v7\recyclerview\res,
    ''#AdditionalRes: $AndroidSDK$\extras\android\support\design\res,
    '#AdditionalRes: ..\res.materialdrawer


    #AdditionalRes: C:\AnywhereSoftware\msmaterialDON-drawneresource\res.materialize
    #AdditionalRes: C:\AnywhereSoftware\msmaterialDON-drawneresource\res.fastadapter

    #AdditionalRes: C:\AnywhereSoftware\b4a_appcompat, de.amberhome.objects.appcompat
    #AdditionalRes: $AndroidSDK$\extras\android\support\v7\appcompat\res,
    #AdditionalRes: $AndroidSDK$\extras\android\support\v7\recyclerview\res,
    '#AdditionalRes: $AndroidSDK$\extras\android\support\design\res,

    #AdditionalRes: C:\AnywhereSoftware\msmaterialDON-drawneresource\res.materialdrawer


    #Region  Activity Attributes
    #FullScreen: False
    #IncludeTitle: false
    #End Region

    Sub Process_Globals
    'These global variables will be declared once when the application starts.
        'These variables can be accessed from all modules.

    End Sub

    Sub Globals
    'These global variables will be redeclared each time the activity is created.
        'These variables can only be accessed from this module.
    ''    Private Spinner1 As Spinner
    ''    Private EditText1 As EditText
        Private mdb As DrawerBuilder
    Private md As Drawer
    Private mnu1,mnu2,mnu3 As PrimaryDrawerItem
    Private submnu1 As SecondaryDrawerItem
    '    Private p1, p2 As IProfile
        Private icon, ic2 As IconicsDrawable
    Private awesome As FontAwesome
    ''    Private iconix As Iconics
    '    Private header As AccountHeaderBuilder
    End Sub

    Sub Activity_Create(FirstTime As Boolean)
    'Do not forget to load the layout file created with the visual designer. For example:
    Dim pnlHdr As Panel
        pnlHdr.Color = 
        pnlHdr.Tag = 
    Dim MSP1 As ProfileDrawerItem
    Dim PDB1 As BitmapDrawable : PDB1.Initialize(LoadBitmap(File.DirAssets,"profile2.jpg"))
    Dim MSP2 As ProfileDrawerItem
    Dim PDB2 As BitmapDrawable : PDB2.Initialize(LoadBitmap(File.DirAssets,"profile3.jpg"))

    Dim Profiles(2As ProfileDrawerItem
    0) = MSP1
    1) = MSP2

    Dim msa As AccountHeaderBuilder
    Dim HeaderBackground As BitmapDrawable
    Dim MaterialHeaderResult As Object =    
    Dim s1 As IconicsDrawable : s1.Initialize("gmd_settings")      : s1.color(Colors.Red)
    Dim s2 As IconicsDrawable : s2.Initialize("gmd_help")          : s2.color(Colors.Red)
    Dim s3 As IconicsDrawable : s3.Initialize("faw_google_wallet") : s3.color(Colors.Red)


        mnu3.withDescription("Dynamic test").withDescriptionTextColor(Colors.Blue).withIdentifier(3).withTag("x3").withName("DynamicTest").withBadge("+99")'.withIcon(ic2.clone)

    '    mdb.addDrawerItems(mnu1)
    '    mdb.addDrawerItems(mnu2)
    '    mdb.addDrawerItems(mnu3)
        md =


    End Sub

    Sub Activity_Resume

    End Sub

    Sub Activity_Pause (UserClosed As Boolean)

    End Sub

    Sub MD_onDrawerOpened()
    End Sub
    Sub MD_onDrawerClosed()
    End Sub
    Sub MD_onDrawerSlide(slideOffset As Float)   
    End Sub
    Sub MD_onItemClick(position As Int, drawerItem As Object)
    End Sub

    Attached Files:

  14. DonManfred

    DonManfred Expert Licensed User

    The accountheader is, like the not working profiles, not working as yet.

    And it looks like you are not using the method right

    Dim MaterialHeaderResult As Object = will not work the way you did.

    I´ve extended the library to have a AccountHeader Object too.
    And i got progress adding the header. But for now it is showing not a correct icon but i dont know why


    I´m working on it ;)
    MarcoRome likes this.
  15. itgirl

    itgirl Active Member Licensed User

    ProfileDrawerItem as in
    .withIconUrl("some img url ")
    not seems to work i guess it still work in progress because ther's no error not attempt to download
  16. DonManfred

    DonManfred Expert Licensed User

    i guess you are right... it is not working for me too
  17. itgirl

    itgirl Active Member Licensed User

    Yeah i guess its easy to put all the images in list then download it but its better if it was built in :/

    anyways Really great Lib i cant stop playing with it lol the drawer dropdown ProfileDrawerItem is really beautiful
    DonManfred likes this.
  18. itgirl

    itgirl Active Member Licensed User

    Hello i think theres a problem with the drawer or maybe Im doing something wrong i just cant get the drawer to get above the statusbar and get the statusbar to Translucent
    tried the

    Attached Files:

    • 1.png
      File size:
      17 KB
  19. DonManfred

    DonManfred Expert Licensed User

    Same here. I dont know how to change or if it is changeable at all.
    I never saw a app which overlaps the statusbar. The statusbar is a SystemUI
  20. itgirl

    itgirl Active Member Licensed User

    yup im workiing on it to find a solution for this one , ive tried with
    <item name="android:windowTranslucentStatus">true</item>
    it works but it shift all the content up :/ so still working on this one ....

    also why always the backarrow shows up in activityies even after i set the toolbar ??? i cant seem to get the Hamburger icon to show up instead of the back arrow :/
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice