297chrisc / playn

Automatically exported from code.google.com/p/playn
0 stars 0 forks source link

Android 4.0+ empty menu shows when soft menu button is pressed #242

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a PlayN game, register a Keyboard listener, print a debug message 
every time "event.key() == Key.MENU".
2. Set targetSdkVersion="10" in the manifest so the menu button actually shows 
up
3. Run the game on Android 4.0+ (technically I've only tested on 4.3, but I 
imagine it would be all 4.x devices)

What is the expected output? What do you see instead?

Every other time the menu button is pressed, the device will actually try to 
open an invisible/no-option menu. Every other time it will actually trigger the 
debug statement inside the Keyboard listener. The invisible menu can be 
dismissed like in all Android apps by hitting the menu button again or tapping 
the screen. You can tell it's there because the sound mutes and it takes on tap 
to get rid of it.

This behavior can be easily fixed by overloading onMenuOpened() in your main 
activity:

@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    return false; //stops the menu from opening on Android 4+
}

It would be great if the GameActivity did this by default. I don't believe 
there would be any negative consequences. If players wanted an Android menu, 
they could just override it.

What version of the product are you using? On what operating system?
Android 4.3, PlayN 1.7

Please provide any additional information below.

Original issue reported on code.google.com by thomaswp...@gmail.com on 18 Aug 2013 at 12:48