skydoves / PowerMenu

:fire: Powerful and modernized popup menu with fully customizable animations.
Apache License 2.0
1.19k stars 174 forks source link

[Suggestion] Please can you port this Library to Kotlin! #27

Closed khalid-mahmood closed 6 years ago

khalid-mahmood commented 6 years ago

it would be awesome if you can port this Library to Kotlin!

Nice work although!!

skydoves commented 6 years ago

You can find some examples in this project!

khalid-mahmood commented 6 years ago

@skydoves Defualt PowerMenu works good even with Kotlin, CustomPowerMenu is the focus. i am unable to use CustomPowerMenu in Kotlin! can't get ride of Errors in Kotlin Can you Please help ?

skydoves commented 6 years ago

Try this :

fun getIconPowerMenu(context: Context, lifecycleOwner: LifecycleOwner, onMenuItemClickListener: OnMenuItemClickListener<IconPowerMenuItem>): CustomPowerMenu<*, *> {
        return CustomPowerMenu.Builder(context, IconMenuAdapter())
                .addItem(IconPowerMenuItem(context.resources.getDrawable(R.drawable.ic_wechat), "WeChat"))
                .addItem(IconPowerMenuItem(context.resources.getDrawable(R.drawable.ic_facebook), "Facebook"))
                .addItem(IconPowerMenuItem(context.resources.getDrawable(R.drawable.ic_twitter), "Twitter"))
                .addItem(IconPowerMenuItem(context.resources.getDrawable(R.drawable.ic_line), "Line"))
                .setLifecycleOwner(lifecycleOwner)
                .setOnMenuItemClickListener(onMenuItemClickListener)
                .setAnimation(MenuAnimation.FADE)
                .setMenuRadius(10f)
                .setMenuShadow(10f)
                .build()
    }
khalid-mahmood commented 6 years ago

Thanks for you help.

CustomPowerMenu<, > This is the key trick i was missing!