Esempio n. 1
0
  public void commandAction(Command c, Displayable d) {

    int actionOld;

    if (c == CMD_RESET) {

      display.setCurrent(alertReset);

    } else if (c == CMD.YES && d == alertReset) {

      keyBindings.resetToDefaults();

      updateList();

      display.setCurrent(this);

    } else if (c == CMD.NO && d == alertReset) {

      display.setCurrent(this);

    } else if (c == List.SELECT_COMMAND) { // an action to set a key for
      // has been chosen

      actionToBind = getSelectedIndex();

      screenKeyBinder.configure(actionToBind);

      display.setCurrent(screenKeyBinder);

    } else if (c == CMD.YES && d == alertKeyConflict) {

      actionOld = keyBindings.release(selectedKey);
      keyBindings.bindKeyToAction(actionToBind, selectedKey);

      updateList(actionToBind);
      if (actionOld >= 0) updateList(actionOld);

      display.setCurrent(this);

    } else if (c == CMD.NO && d == alertKeyConflict) {

      display.setCurrent(this);

    } else if (externalCommandListener != null) {

      externalCommandListener.commandAction(c, d);

    } else {

      Log.bug("Aug 21, 2009.8:06:24 PM");
    }
  }
Esempio n. 2
0
  /**
   * Update the key name mapped to the given action in the displayed key bindings list.
   *
   * @param action
   */
  private void updateList(int action) {

    int key;
    String keyName;

    key = keyBindings.getKeyForAction(action);
    try {
      keyName = (key != 0) ? screenKeyBinder.getKeyName(key) : "";
    } catch (IllegalArgumentException e) {
      // may happen on version change or device firmware update
      keyBindings.release(key);
      keyName = "";
    }
    set(action, KeyBindings.actionNames[action] + ": " + keyName, null);
  }