Added overflow menu to open card image in image gallery#3219
Conversation
|
Thanks for trying. I sadly am quite busy lately so I don't really have much time to guide people in general, so don't take this personally please. But basically this code isn't really usable and needs quite some changes. The main problems are:
|
|
Hi! Thank you so much for answering, I never take personally good and constructive feedback. Is it okay if I try again by fixing the problems you underlined? |
|
Sure that's fine, sorry for closing it so quickly yesterday I was having kind of a bad day :) If you have the patience to keep trying I don't mind doing a few review rounds :) |
|
Thanks for the extra chance! This time my approach was a little different as I tried to fix the main problems:
I tested it with the same commands and devices as last time, making sure that these changes don't mess up the About Activity since it also uses CatimaTopAppBar, but without any overflow action. |
| overflowMenuActions = mapOf( | ||
| Pair(OverflowMenuEntry.IMAGE_GALLERY, mapOf( | ||
| Pair(OverflowMenuParameter.LOYALTY_CARD_ID, cardId), | ||
| Pair(OverflowMenuParameter.IMAGE_LOCATION_TYPE, imageLocationType)) | ||
| ) | ||
| ) |
There was a problem hiding this comment.
It kinda makes sense to go for something like this, but I don't think it'll really scale. You're putting all possible logic in the CatimaTopAppBar element, which will completely balloon dealing with hundreds of options at some point.
It's probably cleanest to just pass the actions Compose code directly to the CatimaTopAppBar, that will scale much better, especially because actions will generally be unique per activity anyway.
There was a problem hiding this comment.
Yeah I agree with you, it's way better to just treat CatimaTopAppBar as a simple runner or it will become huge. Putting the actions Compose code directly in the individual activities will also avoid non necessary validation of the parameters on which the actions are based.
There was a problem hiding this comment.
Applied the change in the latest commit.
I couldn't find a way to reuse the actions building logic without resulting in an exploding method again, but given the fact that actions are generally unique per activity I thought that initializing the menu in each activity that will need one with it's own entries would be fitting.
Hello!
This PR contains changes to fix #3209.
My idea was to change the TopAppBar utilized by the card detail activity with another one containing the overflow menu, which takes in input the image simple path defined by the Utils class method, and creates a readable URI to the image. This URI is then used as the input of the Intent that will eventually open the image gallery app.
I ran the following commands to ensure nothing broke on the surface:
In case any log is needed, please let me know!
After executing these commands, I manually checked that the behaviour is the desired one with a Oneplus Nord 3 and with the embedded Android Studio emulator.