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

Adding support for grouped menus #9

Closed waseefakhtar closed 3 years ago

waseefakhtar commented 3 years ago

Implementing #1

Demo:

TODO:

  1. setGroupVisible currently hides the group but does not adjust the menu height.
  2. Adding support for setGroupCheckable.
  3. setGroupEnabled is functional but the group state stays the same. (Perhaps we could add color states for disabled items)

Also, it'd be nice to add icons for the sample grouped menu items. I can add them if there's an icon set you've already used for the other items that I can have access to.

waseefakhtar commented 3 years ago

setGroupVisible currently hides the group but does not adjust the menu height.

Can you explain more? Why does the popup height change?

This was the same bug as #12, which we resolved in #13.

Adding support for setGroupCheckable

Let's leave this for now

Sounds good.

setGroupEnabled is functional but the group state stays the same. (Perhaps we could add color states for disabled items)

What does PopupMenu do here?

This looks more of an enhancement for styles in sample rather than in cascade.

Setting any item disabled keeps it the same visually. So perhaps we just need to add ColorStateList for text color and icon's tint in cascadeMenuStyler. Not within the scope of this PR, so let me know if you want me to create an issue and work on it on another PR.

nuhkoca commented 3 years ago

@saket do you realize the glitch in title change during animation? It seems kinda blinking/clashing. Or has it been changed since the newest commits? You might want to see a new demo. 🤔

bojankoma commented 3 years ago

@saket do you realize the glitch in title change during animation? It seems kinda blinking/clashing. Or has it been changed since the newest commits? You might want to see a new demo. 🤔

I think that glitch comes from Theme.MaterialComponents.

nuhkoca commented 3 years ago

@bojankoma How? Any reason behind this?

saket commented 3 years ago

I assume that's related to #4, which was fixed in v1.1.0. Please file an issue if you're still seeing it?

nuhkoca commented 3 years ago

Okay, I gave the forked repository a try and didn't encounter any weird behavior. It might have been resolved with the last release. Thanks!

@waseefakhtar can you please update the demo gif?

bojankoma commented 3 years ago

@bojankoma How? Any reason behind this?

@nuhkoca I think the animations for enter or exit are different. I didn't go deep into codebase but I already noticed some key differences between using Theme.Appcompat and Theme.MaterialComponents as your app theme. @saket Please, consider your own bundled anims to get more consistency across the theme engine.

saket commented 3 years ago

@bojankoma Interesting. Possible for you to share a video?

saket commented 3 years ago

Sorry it took me way too long to merge this PR. Thanks for contributing @waseefakhtar!