mkaouer / j4me

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

Samsung E250 (and others) left and right menu buttons not mapped #49

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a menu with left and right buttons.
2. Add acceptNotify and declineNotify methods
3. Display the menu and verify that the accept/declineNotify methods aren't
invoked.

Please provide any additional information below.
The reason for this is that getGameAction(key) returns Canvas.FIRE for the
left and right menu buttons (clear is also mapped to FIRE).  I worked
around the issue with the following code changes in the translateKeyCode
method of DeviceScreen
        try {
            action = getGameAction(key);

            // Special handling for Samsung where both menu buttons
            // map to FIRE!
            if (action == Canvas.FIRE) {
                if ((Canvas.FIRE == getGameAction(-6))
                        && (Canvas.FIRE == getGameAction(-7))
                        && ((key == -6) || (key == -7))) {
                    return key == -6 ? DeviceScreen.MENU_LEFT : DeviceScreen.MENU_RIGHT;
                }
            }
        } catch (Exception e) {
            // Some phones throw an exception for unsupported keys.
            // For example the Sony Ericsson K700.
            return key;
        }

Original issue reported on code.google.com by hammingweight on 17 Oct 2008 at 1:52