/**
  * Show dialog
  *
  * @see Dialog#show(android.support.v4.app.FragmentActivity)
  */
 public void showDialog(String content, String apkUrl) {
   Dialog d = new Dialog();
   Bundle args = new Bundle();
   args.putString(Constants.APK_UPDATE_CONTENT, content);
   args.putString(Constants.APK_DOWNLOAD_URL, apkUrl);
   d.setArguments(args);
   d.show(mContext.getSupportFragmentManager(), null);
 }
예제 #2
0
  @Override
  public TowerWindow show() {
    super.show();

    progressDialog.show();
    progressDialog.clearActions();
    progressDialog.getColor().a = 1f;

    return this;
  }
예제 #3
0
 /** Shows the ListDemo main view. Displays a confirmation query if needed. */
 protected void back() {
   if (hasChanged() && confirmationQuery) {
     int[] tmp = new int[originalSelectedIndices.length];
     System.arraycopy(originalSelectedIndices, 0, tmp, 0, tmp.length);
     if (Dialog.show("save changes", "Save changes made?", "Yes", "No")) {
       showSelectedDialog(); // Proceed with the changes
     } else {
       setSelectedIndices(tmp); // Abandon changes
       DemoMidlet.getMainForm().show();
     }
   } else {
     DemoMidlet.getMainForm().show();
   }
 }
예제 #4
0
  /** Shows a Dialog displaying the selected indices and then shows the MIDlet main view. */
  public void showSelectedDialog() {
    String text = (getSelectedIndices().length == 0 ? "No selected items." : "");
    for (int i = 0; i < getSelectedIndices().length; i++) {
      text += "List item " + (getSelectedIndices()[i] + 1) + " selected.\n";
    }

    Dialog.show(
        Compatibility.toLowerCaseIfFT("Selected"),
        text,
        new Command(Compatibility.toUpperCaseIfFT("Continue")),
        null,
        Dialog.TYPE_INFO,
        null,
        1500L);

    DemoMidlet.getMainForm().show();
  }
        @Override
        public void handleMessage(Message msg) {
          switch (msg.what) {
            case BluetoothStatus.DISCONNECTED:
              {
                Dialog.show(getApplicationContext(), "Disconnected...");
                break;
              }
            case BluetoothStatus.CONNECTING:
              {
                Dialog.show(getApplicationContext(), "Connecting...");
                break;
              }
            case BluetoothStatus.CONNECTING_FAILED:
              {
                Dialog.show(getApplicationContext(), "Connecting Failed...");
                finish();
                break;
              }
            case BluetoothStatus.CONNECTED:
              {
                Dialog.show(getApplicationContext(), "Connected...");
                buttonStartTest.setEnabled(true);
                break;
              }
            case BluetoothStatus.DATA_RECEIVED:
              {
                if (isStarted == false) {
                  return;
                }
                try {
                  final String value = (String) msg.obj;

                  // ArrayAdapter<String> adapter = (ArrayAdapter<String>)
                  // listViewData.getAdapter();
                  // call ArrayAdapter.add, no need to call notifyDataSetChanged as add does this
                  // if (adapter.getCount() > 20) {
                  //  adapter.remove(adapter.getItem(1));
                  // }

                  JSONObject json = new JSONObject(value);
                  JSONObject device = new JSONObject(json.getString("Device"));
                  String analogValue = device.getString("analogValue");

                  float bac = offset + (Float.parseFloat(analogValue) * ratio);

                  if (bac < 0.034f) {
                    bac = 0.00f;
                  }

                  DecimalFormat decimalFormat = new DecimalFormat("0.0000");
                  textViewBacValue.setTypeface(Typeface.MONOSPACE);
                  textViewBacValue.setText(decimalFormat.format(bac).toString());
                  // adapter.add(analogValue);
                  // adapter.add(value);
                  // clear old title
                  // add_act_title.setText("");
                  // adapter.notifyDataSetChanged();

                  // listViewData.smoothScrollToPosition(adapter.getCount() - 1);

                } catch (Exception exception) {
                  Dialog.show(getApplicationContext(), exception.toString());
                }
                break;
              }
          }
        }
예제 #6
0
 public void actionPerformed(ActionEvent e) {
   Dialog d = new ToeDialog(Integer.parseInt(rows.getText()), Integer.parseInt(cols.getText()));
   d.show();
 }
예제 #7
0
  public static int crossOver(int version, JoConnection conn, Config config) throws Exception {
    Dialog dlg = null;
    try {
      if (version < 1002) {
        // ----------------------------------------------------
        //  New Columns GamePlayer.Color and GamePlayer.Result
        // ----------------------------------------------------

        dlg =
            JoDialog.createMessageDialog(
                "Database Update",
                "jose will now update the database structure.\n"
                    + "This may take up to some minutes.",
                false);
        dlg.show();
        dlg.paint(dlg.getGraphics());

        Setup setup = new Setup(config, "MAIN", conn);
        /*
        				setup.addColumn("GamePlayer","Color",3);
        				setup.addColumn("GamePlayer","Result",4);
        /*
        					alter table gameplayer
        					modify column PId integer not null,
        					add column Color tinyint not null,
        					add index GamePlayer_3 (Color),
        					add column Result tinyint not null,
        					add index GamePlayer_4 (Result)
        * /
        				//  fill in values
        				String upd1 =
        				        "UPDATE GamePlayer, Game" +
        				        " SET GamePlayer.Color = 1, GamePlayer.Result = Game.Result" +
        				        " WHERE GamePlayer.GId = Game.Id" +
        				        "   AND GamePlayer.PId = Game.WhiteId";
        				/** Color = 1 = White
        				 *  Result = Game.Result (from white's perspective)
        				 * /
        				conn.executeUpdate(upd1);

        				String upd2 =
        				        "UPDATE GamePlayer, Game" +
        				        " SET GamePlayer.Result = CASE WHEN Game.Result < 0 THEN Game.Result ELSE 2-Game.Result END" +
        				        " WHERE GamePlayer.GId = Game.Id" +
        				        "   AND GamePlayer.PId = Game.BlackId";
        				/** Color = 0 = Black
        				 *  Result = 2-Game.Result (from black's perspective)
        				 * /
        				conn.executeUpdate(upd2);
        */
        System.err.print("[create GamePlayer");
        try {
          setup.dropTable("GamePlayer");
        } catch (Exception e) {
          Application.error(e);
        }

        setup.createTable(null, setup.getTable("GamePlayer"), null, true);
        JoConnection.getAdapter().disableConstraints("GamePlayer", conn);

        String ins =
            "INSERT INTO GamePlayer"
                + " SELECT Id, WhiteId, 1, Result FROM Game "
                + " UNION"
                + " SELECT Id, BlackId, 0, CASE WHEN Result<0 THEN Result ELSE 2-Result END FROM Game";

        conn.executeUpdate(ins);
        JoConnection.getAdapter().enableConstraints("GamePlayer", conn);
        System.err.println("]");

        Setup.setTableVersion(conn, "MAIN", "GamePlayer", 102);
        Setup.setSchemaVersion(conn, "MAIN", version = 1002);
      }

      return version;

    } finally {
      if (dlg != null) dlg.dispose();
    }
  }
예제 #8
0
 public void calculMitjaPressure(ActionEvent actionEvent) {
   double pressio = temp.mitjaPressure();
   setMitjas("Pressió:", pressio, "hPa");
   mitjas.show();
 }
예제 #9
0
 public void calculMitjaHumidity(ActionEvent actionEvent) {
   double humitat = temp.mitjaHumidity();
   setMitjas("Humitat:", humitat, "%");
   mitjas.show();
 }
예제 #10
0
 public void calculMitjaTempsMax(ActionEvent actionEvent) {
   double max = temp.mitjaTempsMax();
   String unitats = (units == 0) ? "ºC" : "ºF";
   setMitjas("Temperatura Màxima:", max, unitats);
   mitjas.show();
 }
예제 #11
0
 public void calculMitjaTempsMin(ActionEvent actionEvent) {
   double min = temp.mitjaTempsMin();
   String unitats = (units == 0) ? "ºC" : "ºF";
   setMitjas("Temperatura Mínima:", min, unitats);
   mitjas.show();
 }
예제 #12
0
 public void listViewClick(Event event) {
   event.getSource();
   dialog.show();
 }