daniel-stoneuk / material-about-library

Makes it easy to create beautiful about screens for your apps
Apache License 2.0
1.12k stars 140 forks source link

onClickAction not working on Kotlin? #72

Closed bernaferrari closed 6 years ago

bernaferrari commented 6 years ago

Hi, I am having the following problem with the following code:

 val dynamicItem = MaterialAboutActionItem.Builder()
                .text("aaa")
                .subText("bbb")
                .icon(IconicsDrawable(c)
                        .icon(CommunityMaterial.Icon.cmd_refresh)
                        .color(ContextCompat.getColor(c, colorIcon)
                        ).sizeDp(18))
                .build()

        dynamicItem.onClickAction = MaterialAboutItemOnClickAction {
            dynamicItem.subText = "ccc"
        }
        otherCardBuilder.addItem(dynamicItem)

I want to change the subtext from dynamic item to "ccc" when someone taps it. The 'onClickAction' is working fine, it is always called. However, I can't manage to solve why the method.subText isn't working. I am using the latest Kotlin version (1.2.10) and never had a problem before today.

daniel-stoneuk commented 6 years ago

Hi, sorry about the late response. Been caught up over the Christmas period. Have you tried calling refreshMaterialAboutList(); after changing the subText?

bernaferrari commented 6 years ago

Works fine, thanks! I would have never guessed this.