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

Gravity doesn't appear to work? #21

Open Kev1000000 opened 3 years ago

Kev1000000 commented 3 years ago

I am using Cascade as a means to show a menu in a scrolling list that takes up the entire vertical space of the device. For items at the very end, I'd prefer if the menu anchors at the bottom and and then draws upward rather than achor at the top of the view, draw downward, and then get cutoff by the screen.

I've tried setting Cascade to use various Gravities, but changing the value seems to have no effect.

image

saket commented 3 years ago

Hmm it shouldn't be getting cut-off. Can you check if this works with the native PopupMenu?

waseefakhtar commented 3 years ago

Hmm it shouldn't be getting cut-off. Can you check if this works with the native PopupMenu?

I believe it's the same issue as #15. I tried investigating why that is but I haven't yet figured it out. Yes, it works well with PopupMenu.

Kev1000000 commented 3 years ago

Ah, yes, it does appear to be the same as #15. The native PopupMenu does handle which direction it should draw automatically based on the view position of the anchor.

Note, in my screenshot you can scroll the list, but whatever PopupMenu is doing to figure out which direction to draw in would be much preferred.

Great library, btw!

cannizarro commented 3 years ago

@Kev1000000 have you found some workaround for this?

Kev1000000 commented 3 years ago

Nope, was hoping for a proper fix :(

gsrathoreniks commented 10 months ago

@Kev1000000 @saket is this issue already fixed ?

saket commented 10 months ago

Sorry I never got enough time to make this work. From what I understand, PopupWindow does not position popups within the window bounds on its own. PopupMenu does not suffer from this because it calculates its height manually to adjust its position. cascade may have to do the same:

https://cs.android.com/android/platform/superproject/main/+/main:frameworks/base/core/java/android/widget/ListPopupWindow.java;l=1298;drc=2d32eb61db0bd7de6bce09dd1549271d5479f8dc

Does anyone want to help me out with this? I haven't been able to find enough time to fix this bug. 🙂

Alternatively, are you able to use Compose UI? cascade-compose does not suffer from this problem and has screenshot tests to back this claim.

gsrathoreniks commented 10 months ago

Can you assign this one as well to me ?

saket commented 10 months ago

Sure go ahead!