-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Suggestions #72
Comments
Hi @MFlisar, 1. Use ViewBindingI'm rather reluctant in putting that in the SDK so that the library does not add a lot of transitive dependencies to the project's using it. The "view accessor" libraries also have a tendency to change over time, we also have Kotlin extensions, DataBinding, Compose on its way... I would like to avoid that in the SDK so that we don't need to modify it whenever a new version comes up. 2. Support more gravitiesCenter makes sense but I'm not sure how left/right or rather start/end affect 3. Height calculation optimisationMakes sense. How do you plan to achieve that? I think we might want to check |
How about providing a small helper class instead? Instead of exposing a view expose a simple class like following, then you do not need to use class ViewData(
val view: View,
val textView: TextView,
....
)
Actually in my own popup I've ended with following anchor types: enum class Anchor {
TopLeft, BottomLeft, TopRight, BottomRight, Center
} Left, right alone does not make much sense probably...
I thought you can stop if you reached the current screens height - I did not think about multi window or multiple screen devices... Maybe something like stopping when reaching the root views height does the trick as well. |
1. Use
ViewBinding
I'd like to use
ViewBinding
instead ofView
in theviewBoundCallbacks
- I would integrate this. What do you think about that?This would remove the need for putting
findViewById(...)
calls into the callbacks.As a side note, this callback could be used to easily replace all text/color adjustments but this would totally break backwards compatibility. But it would minimize the library functions...
2. Support more gravities
I'd like to add support for top/left/right/bottom and center here:
MaterialPopupMenu/material-popup-menu/src/main/java/androidx/appcompat/widget/MaterialRecyclerViewPopupWindow.kt
Lines 263 to 265 in 777bb86
3. Height calculation optimisation
I think following can be optimised for large menus:
MaterialPopupMenu/material-popup-menu/src/main/java/androidx/appcompat/widget/MaterialRecyclerViewPopupWindow.kt
Line 296 in 777bb86
I think it would be save to stop iterating over the adapter items as soon as the total height has reached screen height, am I right?
The text was updated successfully, but these errors were encountered: