Closed GoogleCodeExporter closed 8 years ago
Hello,
Thanks for the report! Could you explain your use-case? Context menu are not
supported by the GDK and this is by design.
If you want to modify the options menu according to some internal state, you
should use the onPrepareOptionsMenu callback to modify the displayed menu.
You can take a look at the Timer sample that displays different options menu
depending on the state of the Timer.
Best,
Alain
Original comment by ala...@google.com
on 10 Feb 2014 at 4:59
I have two different menu XMLs that I use for different purposes and
wouldn't want to merge them into a single one and toggle their visibility
according to the context of my activity.
I'm using the Options menu in a similar way to the Spinner Navigation
pattern in standard ActionBar android apps with especial gesture to pull it
in and using the tap gesture to get into the detail of the card. Then using
tap+hold for a contextual menu related to that card (and not the menu of
the whole activity) and onCreateOptionsMenu can't be used to inflate
different menus given its only called once on the activity life cycle. So
traditionally one would use a Context menu instead of Options menu if the
actions are being performed against a particular view/item in an
AdapterView.
That's why I was experimenting with Context menus and noticed the black
screen that is shown when inflating and displaying the menu in relation to
the view.
Original comment by roberto.andrade
on 10 Feb 2014 at 5:37
Hello,
Unfortunately, this is not something the GDK might support unless Glass has a
different UI/UX for context menu.
For your use-case I would use a flag to track how the options menu got opened
and use menu groups to easily toggle visibility and availability.
Setting as "RevisitLater" for when a new UI/UX is available for context menu.
Best,
Alain
Original comment by ala...@google.com
on 10 Feb 2014 at 11:32
That's ok, in my particular case, I'm actually resorting to doing this one the
case where the menus are at least somewhat related to the point I can just
group them and switch visibility based on it.
in case it interests anyone else looking for a solution to this, an alternative
I follow as well is to launch another transparent activity like the samples
suggest: https://developers.google.com/glass/develop/gdk/ui/live-card-menus
with the appropriate alternative menu layout inflated.
This way I can have the proper context menu on the activity I'm on and when in
need for the alternative item "context menu", I start the new activity with the
appropriate intents to open the alternative "options menu" as an overlaid menu
on the previous activity. So I get both menus, isolated without having to
switch visibility on and off by inflating from the same resource.
Original comment by roberto.andrade
on 10 Feb 2014 at 11:47
Original issue reported on code.google.com by
roberto.andrade
on 7 Feb 2014 at 12:33