MCPcopy Create free account
hub / github.com/codenameone/CodenameOne / keyReleased

Method keyReleased

CodenameOne/src/com/codename1/ui/MenuBar.java:1332–1408  ·  view source on GitHub ↗
(int keyCode)

Source from the content-addressed store, hash-verified

1330
1331 /// {@inheritDoc}
1332 @Override
1333 public void keyReleased(int keyCode) {
1334 int commandBehavior = getCommandBehavior();
1335 if (commandBehavior >= Display.COMMAND_BEHAVIOR_BUTTON_BAR && keyCode != backSK && keyCode != clearSK && keyCode != backspaceSK) {
1336 return;
1337 }
1338 if (getCommandCount() > 0) {
1339 int softkeyCount = Display.getInstance().getImplementation().getSoftkeyCount();
1340 if (softkeyCount < 2 && isLSK(keyCode)) {
1341 if (commandList != null) {
1342 Container parent = commandList.getParent();
1343 while (parent != null) {
1344 if (parent instanceof Dialog && ((Dialog) parent).isMenu()) {
1345 return;
1346 }
1347 parent = parent.getParent();
1348 }
1349 }
1350 showMenu();
1351 return;
1352 } else {
1353 if (isLSK(keyCode)) {
1354 if (left != null) {
1355 left.released();
1356 }
1357 return;
1358 } else {
1359 // it might be a back command...
1360 if (isRSK(keyCode)) {
1361 if (right != null) {
1362 right.released();
1363 }
1364 return;
1365 } else {
1366 if (Display.getInstance().getGameAction(keyCode) == Display.GAME_FIRE) {
1367 main.released();
1368 return;
1369 }
1370 }
1371 }
1372 }
1373 }
1374
1375 // allows a back/clear command to occur regardless of whether the
1376 // command was added to the form
1377 Command c = null;
1378 if (keyCode == backSK) {
1379 // the back command should be invoked
1380 c = parent.getBackCommand();
1381 if (c == null && minimizeOnBack) {
1382 Display.getInstance().minimizeApplication();
1383 return;
1384 }
1385 } else {
1386 if (keyCode == clearSK || keyCode == backspaceSK) {
1387 c = getClearCommand();
1388 }
1389 }

Callers

nothing calls this directly

Calls 15

getCommandBehaviorMethod · 0.95
getCommandCountMethod · 0.95
getInstanceMethod · 0.95
isLSKMethod · 0.95
showMenuMethod · 0.95
isRSKMethod · 0.95
getClearCommandMethod · 0.95
actionPerformedMethod · 0.95
isConsumedMethod · 0.95
checkPopGuardMethod · 0.80
getParentMethod · 0.65
getSoftkeyCountMethod · 0.45

Tested by

no test coverage detected