yavski / fab-speed-dial

FAB flinging out actionable menu items using the Speed dial metaphor
Apache License 2.0
477 stars 122 forks source link

Please add a posibility to change menu programly #61

Open Kolyall opened 7 years ago

Kolyall commented 7 years ago

Please add a possibility to change menu programmatically, because now it can be set only from layout: app:fabMenu="@menu/menu_fab"

Henriquedn commented 7 years ago

@Kolyall I also wanted to change menu at runtime. For now its much easier and expressive to create multiple fabs on the xml with your menus and set visibility of the fab at runtime to the one you want to display.

Kolyall commented 7 years ago

@Henriquedn can you post an example how you change visibility for menu items?

Henriquedn commented 7 years ago

@Kolyall am assuming there is something (data) on your fragment/activity that determines which menu you want to be inflated by the fab. assume data boolean x show menu A when true, show menu B when false.

Create two Fabs fab one with menu A and fab two with menu B

if(x) show fab one if(!x) show fab two

this is just a quick fix not the actual implementation

Kolyall commented 7 years ago

@Henriquedn There is no any data that determines which menu you want to be inflated by the fab,because inflate is in xml of the FAB for ex:

<io.github.yavski.fabspeeddial.FabSpeedDial
        android:id="@+id/fab"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="bottom|end"
        app:fabGravity="bottom_end"
        app:fabMenu="@menu/menu_fab"//here is inflate of the menu
        />