예제 #1
0
  protected boolean navigationClick(final int status, int time) {
    System.out.println("***** navigationClick *****");
    System.out.println("status=" + Integer.toHexString(status));
    if ((status & (KeypadListener.STATUS_FOUR_WAY | KeypadListener.STATUS_TRACKWHEEL)) == 0) {
      if (status != 0) Logger.log("navClick ignored status " + Integer.toHexString(status));
      return true;
    }

    boolean used = false;

    try {
      if (c_on_navigation_click == 0)
        c_on_navigation_click = CibylCallTable.getAddressByName("rim_on_navigation_click");
    } catch (Throwable t) {
      Logger.log("Exception in navigationClick: " + t);
      t.printStackTrace();

      System.exit(0);
    }

    if (c_on_navigation_click != 0) {
      UIWorker.addUIEvent(c_on_navigation_click, status, time, 0, 0, true);
    }

    return true;
  }
예제 #2
0
  private void checkOrientationChanged(int w, int h) {
    // calculate current orientation based on width and height
    int isLandscape = w > h ? 1 : 0;
    if (isLandscape == isLandscapeScreen) {
      return;
    }
    if (!isUIWorkerInit) {
      // verify that UIWorker is initialized
      isUIWorkerInit = UIWorker.isInit();
      if (!isUIWorkerInit) return;
    }
    isLandscapeScreen = isLandscape;
    try {
      if (c_on_orientation_change == 0)
        c_on_orientation_change = CibylCallTable.getAddressByName("rim_on_orientation_change");
    } catch (Throwable t) {
      Logger.log("Exception in checkOrientationChanged: " + t);
      t.printStackTrace();

      System.exit(0);
    }

    if (c_on_orientation_change != 0) {
      UIWorker.addUIEvent(c_on_orientation_change, isLandscape, 0, 0, 0, true);
    }
  }
예제 #3
0
  protected boolean touchEvent(TouchEvent te) {
    System.out.println("touchEvent type " + Integer.toString(te.getEvent()));
    if (te.getEvent() == TouchEvent.CANCEL) return true;
    int x = te.getX(1);
    int y = te.getY(1);
    if (x < 0 || x > this.getWidth() || y < 0 || y > this.getHeight()) {
      Logger.log(
          "touchedEvent type "
              + Integer.toString(te.getEvent())
              + " x="
              + Integer.toString(x)
              + " y="
              + Integer.toString(x)
              + " outside "
              + Integer.toString(getWidth())
              + "x"
              + Integer.toString(getHeight()));
      return super.touchEvent(te);
    }
    switch (te.getEvent()) {
      case TouchEvent.DOWN:
        touchDownEvent(x, y);
        break;
      case TouchEvent.UP:
        touchUpEvent(x, y);
        break;
      case TouchEvent.MOVE:
        touchMovedEvent(x, y);
        break;
      default:
        return super.touchEvent(te);
    }

    return true;
  }
예제 #4
0
  private void touchMovedEvent(int x, int y) {
    try {
      if (c_on_canvas_button_moved == 0)
        c_on_canvas_button_moved = CibylCallTable.getAddressByName("rim_on_canvas_button_moved");
    } catch (Throwable t) {
      Logger.log("Exception in touchMovedEvent: " + t);
      t.printStackTrace();

      System.exit(0);
    }

    if (c_on_canvas_button_pressed != 0) {
      UIWorker.addUIEvent(c_on_canvas_button_moved, x, y, 0, 0, true);
    }
  }
예제 #5
0
  protected boolean navigationMovement(final int dx, final int dy, final int status, int time) {
    //		System.out.println("***** navigationMovement *****");
    //		System.out.println("dx=" + dx + " dy=" + dy + " status=" + Integer.toHexString(status));

    boolean used = false;
    // m_graphics.copyArea(0, 0, getVisibleWidth(), getVisibleHeight(), dx * 30, dy * 30);
    // refresh();

    try {
      if (c_on_navigation_movement == 0)
        c_on_navigation_movement = CibylCallTable.getAddressByName("rim_on_navigation_movement");
    } catch (Throwable t) {
      Logger.log("Exception in navigationMovement: " + t);
      t.printStackTrace();

      System.exit(0);
    }

    if (c_on_navigation_movement != 0) {
      UIWorker.addUIEvent(c_on_navigation_movement, dx, dy, status, time, true, true);
    }
    //		System.out.println("used=" + used);
    return true;
  }
예제 #6
0
  protected boolean keyDown(final int keycode, int time) {
    System.out.println("***** keyDown *****");
    System.out.println("keycode=" + keycode);
    char altedKey = '0';
    boolean useAltedKey = false;
    final int key;
    boolean isAltedKeyboard = false;
    try {
      isAltedKeyboard = hwKeyboardLayoutsLst.containsKey(Keypad.getHardwareLayout());
      // System.out.println("hw layout " + Integer.toString(Keypad.getHardwareLayout()) +
      // (isAltedKeyboard ? " alted" : " non-alted") );
    } catch (Exception e) {
      System.out.println("contains Exception " + e);
    }
    if (isAltedKeyboard) { // Alted keyboard
      altedKey = Keypad.map(Keypad.key(keycode), KeypadListener.STATUS_ALT);
      if ((altedKey == '#') || (altedKey == '*')) { // enable zoom in zoom out.
        useAltedKey = true;
      }
    }

    if (keyDownStackAddress == 0) {
      Logger.log("keyDownStackAddress = 0, before stack init ");
      return true;
    }

    key = Keypad.key(keycode);

    System.out.println("key is = " + key);

    final int status = Keypad.status(keycode);
    // System.out.println("key=" + keycode + " status=" + status);

    if (key == Keypad.KEY_MENU) {
      System.out.println("***** MENU BUTTON PRESSED *****");
      menu_open = true;
      try {
        if (c_on_menu_key_down == 0) {
          c_on_menu_key_down = CibylCallTable.getAddressByName("rim_on_menu_button");
        }
        if (c_on_menu_key_down != 0) {
          // FIXME - should send keycode to C and C should trans to UTF8
          updateUTF8Key(keycode);
          CibylCallTable.call(c_on_menu_key_down, keyDownStackAddress, key, status, time, 0);
        }
      } catch (Exception t) {
        Logger.log("Exception in UI action: " + t);
        t.printStackTrace();
      }
      return false; // return false so RIM will open the menu as necessary.
    } else if (key == Keypad.KEY_VOLUME_DOWN) {
      SoundMgr.updateSoundLevel(-10);
    } else if (key == Keypad.KEY_VOLUME_UP) {
      SoundMgr.updateSoundLevel(10);
    } else if ((key == Keypad.KEY_SEND)
        || (key == Keypad.KEY_APPLICATION)
        || (key == Keypad.KEY_SPEAKERPHONE)
        || (key == Keypad.KEY_CONVENIENCE_1)
        || (key == Keypad.KEY_CONVENIENCE_2)) {
      return false;

    } else if (key == Keypad.KEY_END) {
      return false;
    } else {
      try {
        if (c_on_key_down == 0) c_on_key_down = CibylCallTable.getAddressByName("rim_on_key_down");
      } catch (Throwable t) {
        Logger.log("Exception in keyDown: " + t);
        t.printStackTrace();

        System.exit(0);
      }

      if (c_on_key_down != 0) {
        // FIXME - should send keycode to C and C should trans to UTF8
        if (!useAltedKey) updateUTF8Key(keycode);
        else updateUTF8Key(altedKey);

        UIWorker.addUIEvent(c_on_key_down, key, status, time, 0, true);
      }
    }
    return true;
  }