Exemple #1
0
  /**
   * @param time
   * @param location
   * @param data
   */
  public void putWinds(long time, String location, String data) {
    if (!mPref.useAdsbWeather()) {
      return;
    }
    WindsAloft w = new WindsAloft();
    w.station = location;

    /*
     * Clear garbage spaces etc. Convert to Avare format
     */
    String winds[] = data.split(",");
    if (winds.length < 9) {
      return;
    }
    w.w3k = winds[0];
    w.w6k = winds[1];
    w.w9k = winds[2];
    w.w12k = winds[3];
    w.w18k = winds[4];
    w.w24k = winds[5];
    w.w30k = winds[6];
    w.w34k = winds[7];
    w.w39k = winds[8];
    Date dt = new Date(time);
    SimpleDateFormat sdf = new SimpleDateFormat("ddHHmm", Locale.getDefault());
    sdf.setTimeZone(TimeZone.getTimeZone("gmt"));
    w.time = sdf.format(dt) + "Z";

    /*
     * Find lon/lat of station
     */
    float coords[] = new float[2];
    if (!Stations.getStationLocation(location, coords)) {
      return;
    }

    w.lon = coords[0];
    w.lat = coords[1];
    w.timestamp = System.currentTimeMillis();
    mWinds.put(location, w);
  }
Exemple #2
0
  /**
   * Обновление данных поставщика(АЗС не включены).<br>
   * + возможность перейти к списку всех АЗС
   *
   * @param b - true - с переходом ко всем АЗС; false - без перехода
   */
  private void updateTitle(boolean b) {
    try {
      DriverManager.getConnection("jdbc:sqlite:" + Oil.PATH)
          .createStatement()
          .executeUpdate(
              "UPDATE station SET title = '"
                  + text_name.getText()
                  + "' WHERE id LIKE '"
                  + station_id
                  + "';");

      DriverManager.getConnection("jdbc:sqlite:" + Oil.PATH)
          .createStatement()
          .executeUpdate(
              "UPDATE station SET address = '"
                  + text_address.getText()
                  + "' WHERE id LIKE '"
                  + station_id
                  + "';");

      DriverManager.getConnection("jdbc:sqlite:" + Oil.PATH)
          .createStatement()
          .executeUpdate(
              "UPDATE station SET tel = '"
                  + text_tel.getText()
                  + "' WHERE id LIKE '"
                  + station_id
                  + "';");

      DriverManager.getConnection("jdbc:sqlite:" + Oil.PATH)
          .createStatement()
          .executeUpdate(
              "UPDATE station SET district_id = '"
                  + ((ComboItem) cbDistrict.getSelectedItem()).getValue()
                  + "' WHERE id LIKE '"
                  + station_id
                  + "';");

      DriverManager.getConnection("jdbc:sqlite:" + Oil.PATH)
          .createStatement()
          .executeUpdate(
              "UPDATE station SET city_id = '"
                  + ((ComboItem) cbCity.getSelectedItem()).getValue()
                  + "' WHERE id LIKE '"
                  + station_id
                  + "';");

      DriverManager.getConnection("jdbc:sqlite:" + Oil.PATH)
          .createStatement()
          .executeUpdate(
              "UPDATE station SET comm_id = '"
                  + ((ComboItem) cbComm.getSelectedItem()).getValue()
                  + "' WHERE id LIKE '"
                  + station_id
                  + "';");

      DriverManager.getConnection("jdbc:sqlite:" + Oil.PATH)
          .createStatement()
          .executeUpdate(
              "UPDATE station SET active = '"
                  + ((ComboItem) cbStatus.getSelectedItem()).getValue()
                  + "' WHERE id LIKE '"
                  + station_id
                  + "';");

      if (b) {
        main.ini();
      }
    } catch (SQLException e1) {
      // TODO Auto-generated catch block
      e1.printStackTrace();
    }
  }