zsmb13/MaterialDrawerKt

expandable item bug: sub items added twice

or-dvir opened this issue · 3 comments

hi.
I get duplicate sub-items for an expandable item. am I doing something wrong?
here is my code:

expandableItem {
                nameRes = R.string.moreInfo
                icon = R.drawable.ic_more_info

                attachItem(secondaryItem {
                    nameRes = R.string.officialSite
                })

and here is the outcome
capture _2018-08-02-17-26-56_01

You don't need to attach the items inside the expandable drawer item yourself, they're automatically added:

expandableItem("Expandable drawer item", "Expandable drawer item description") {
    iicon = FontAwesome.Icon.faw_heart
    primaryItem("Expanded item 1") {
        iicon = FontAwesome.Icon.faw_magic
        level = 2
    }
    primaryItem("Expanded item 2") {
        iicon = FontAwesome.Icon.faw_magic
        level = 2
    }
}

The example is from the sample app, specifically here.

thanks everything is fine now.
suggestion: not sure if it's possible due to this being a wrapper library, but maybe you can make functions that are not meant to be called by the user private?

This function has to be accessible so that custom drawer items can be added to the DSL. However, it's supposed to have a Deprecation warning so you don't use it accidentally. The warning was there in the library, just not everywhere - I'll fix this in the next release, thanks for finding it! :)