saket / cascade

Nested popup menus with smooth height animations for Android
https://saket.github.io/cascade
Apache License 2.0
2.02k stars 67 forks source link

Feature/menu groups support #10

Closed ilkeraslan closed 3 years ago

ilkeraslan commented 3 years ago

This PR addresses the issue #1 .

addToGroup() example:

Screenshot_1602413595

removeFromGroup() example:

Screenshot_1602413616

Note: The setGroupVisible() method is not implemented as it sets the visibility of MenuItems without removing the space. One possible workaround would be to call removeFromGroup() method when the user calls setGroupVisible(false) and addToGroup() method when the user calls setGroupVisible(false). To be able to implement this, though, we should memorize the MenuItems added locally before removing them in order to recreate them when setGroupVisible(false) is called. Consequently, this would be a duplicate implementation of the existing addToGroup() and removeFromGroup() methods.
saket commented 3 years ago

Thank you @Dement0, but I'll have to this in favor of #9. If you're picking up a feature, it's worth calling dibs on the issue to make sure someone else isn't already working on it 😄.

FWIW I don't think there's enough value in exposing proxy setters for CascadePopupMenu#menu when it's already a public property. This is also in line with PopupMenu.

ilkeraslan commented 3 years ago

Thank you @Dement0, but I'll have to this in favor of #9. If you're picking up a feature, it's worth calling dibs on the issue to make sure someone else isn't already working on it smile.

FWIW I don't think there's enough value in exposing proxy setters for CascadePopupMenu#menu when it's already a public property. This is also in line with PopupMenu.

@saket In fact I asked for to work on this issue before #9 (if you check the related issue you can easily notice that) and nobody was working on it so I've made the PR. While #9 was made before asking for if someone was already working on it or not.

For the record, #9 was opened just a few seconds before my PR.

Anyways, it's your project so you decide. Good luck!