コード例 #1
0
  private void createInput(Gene root, LinearLayout view) {
    this.layoutAux = view;
    final BaseCodon codon = root.getCodon();
    TextView label = new TextView(this.context);
    LayoutParams params =
        new LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, codon.getWeight());
    label.setText(codon.getText());
    this.layoutAux.addView(label, params);

    final SmartObjectGUIActivity activity = (SmartObjectGUIActivity) this.context;
    BlockingOnUIRunnable actionRunnable =
        new BlockingOnUIRunnable(
            activity,
            new IBlockingOnUIRunnableListener() {
              public void runOnUIThread() {
                EditText edit = new EditText(activity);
                LayoutParams params =
                    new LayoutParams(
                        0, LinearLayout.LayoutParams.WRAP_CONTENT, 1 - codon.getWeight());
                edit.setEms(5);
                layoutAux.addView(edit, params);
              }
            });
    actionRunnable.startOnUiAndWait();
  }
コード例 #2
0
  private void createSeekBar(final Gene root, LinearLayout view) {
    this.layoutAux = view;
    final BaseCodon codon = root.getCodon();
    final TextView label = new TextView(this.context);
    LayoutParams params =
        new LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, codon.getWeight());
    label.setText(codon.getText());
    this.layoutAux.addView(label, params);

    final SmartObjectGUIActivity activity = (SmartObjectGUIActivity) this.context;
    BlockingOnUIRunnable actionRunnable =
        new BlockingOnUIRunnable(
            activity,
            new IBlockingOnUIRunnableListener() {
              public void runOnUIThread() {
                NegativeSeekBar seek =
                    new NegativeSeekBar(
                        activity,
                        codon.getMinValue(),
                        codon.getMaxValue(),
                        label,
                        root.getParamType());
                LayoutParams params =
                    new LayoutParams(
                        0, LinearLayout.LayoutParams.WRAP_CONTENT, 1 - codon.getWeight());
                layoutAux.addView(seek, params);
              }
            });
    actionRunnable.startOnUiAndWait();
  }
コード例 #3
0
  private void createCheckBox(Gene root, LinearLayout view) {
    BaseCodon codon = root.getCodon();
    TextView label = new TextView(this.context);
    LayoutParams params =
        new LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, codon.getWeight());
    label.setText(codon.getText());
    view.addView(label, params);

    CheckBox cb = new CheckBox(this.context);
    params = new LayoutParams(0, LinearLayout.LayoutParams.WRAP_CONTENT, 1 - codon.getWeight());
    view.addView(cb, params);
  }