Ejemplo n.º 1
0
  public void draw(DrawWindow dw) {
    // Check if GPS enabled
    if (!ctx.gpsEnabled()) {
      ARXMessages.putMessage(
          "GPS_ENABLED",
          "GPS not Enabled (see Settings->Security & location->Enable GPS)",
          ARXMessages.errorIcon,
          500);
    } else if (!ctx.gpsSignalReceived()) {
      // Check if GPS signal received
      ARXMessages.putMessage("GPS_WAIT", "Waiting for GPS signal", ARXMessages.worldIcon, 500);
    }

    // Check for compass accuracy
    if (ctx.isCompassAccuracyLow()) {
      ARXMessages.putMessage(
          "COMPASS_ACCURACY", "Compass accuracy low", ARXMessages.compassIcon, 1000);
    }

    //        if (ctx.gpsEnabled()) {
    drawDimension(dw);
    //        } else {
    //            purgeEvents();
    //        }

    ARXMessages.expireMessages();
    int msgCount = ARXMessages.getMessageCount();
    float msgHeight = 0, msgWidth = 0;
    float msgPad = 10;
    int startMsg = 0, maxMsg = 1;

    if (state.isMessagesVisible() && msgCount > maxMsg) {
      startMsg = msgCount - maxMsg;
    }

    for (int i = startMsg; i < msgCount; i++) {
      Message msg = (Message) ARXMessages.getMessage(i);
      if (!msg.init) msg.init(dw, width - msgPad * 2);

      if (state.isMessagesVisible()) {
        msg.showFullMessage(true);
        msgHeight += msg.getHeight() + 1;
        dw.drawObject(msg, msgPad, height - msgHeight - msgPad, 0, 1);
      } else {
        if (msg.isImportant()) {
          msgHeight = msg.getHeight();
          msg.showFullMessage(false);
          dw.drawObject(msg, msgPad + msgWidth, height - msgHeight - msgPad, 0, 1);
          msgWidth += msg.getWidth() + 1;
        }
      }
    }
  }
Ejemplo n.º 2
0
  public void createMenuEvent(List<MenuItem> menu) {
    if (!ctx.gpsEnabled()) return;

    if (dialogState == INFO_DIALOG) menu.add(miHideInfo);
    else menu.add(miShowInfo);

    if (state.getLayer().xmlRadarAvailable) {
      // if (state.radarVisible)
      // menu.add(miHideRadar);
      // else
      // menu.add(miShowRadar);
    }

    if (state.getLayer().distancesVisible) menu.add(miHideDistances);
    else menu.add(miShowDistances);

    if (state.isMessagesVisible()) menu.add(miHideMessages);
    else menu.add(miShowMessages);

    if (state.getNextLayerStatus() == ARXState.READY) {
      menu.add(miRefresh);
      //            menu.add(miHome);
    }
  }