private void createComboBox(Gene root, LinearLayout view) { this.layoutAux = view; final ComboCodon codon = (ComboCodon) 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() { LayoutParams params = new LayoutParams( 0, LinearLayout.LayoutParams.WRAP_CONTENT, 1 - codon.getWeight()); ArrayAdapter<String> adapter = new ArrayAdapter<String>( activity, android.R.layout.simple_spinner_item, codon.getOptions()); adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item); Spinner spinner = new Spinner(activity); spinner.setAdapter(adapter); layoutAux.addView(spinner, params); } }); actionRunnable.startOnUiAndWait(); }
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(); }
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(); }
private void createRadioButton(Gene root, LinearLayout view) { this.layoutAux = view; final ComboCodon codon = (ComboCodon) 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() { RadioGroup group = new RadioGroup(activity); group.setOrientation(RadioGroup.VERTICAL); for (String option : codon.getOptions()) { RadioButton rb = new RadioButton(activity); rb.setText(option); group.addView(rb); } ((RadioButton) group.getChildAt(0)).setChecked(true); LayoutParams params = new LayoutParams( 0, LinearLayout.LayoutParams.WRAP_CONTENT, 1 - codon.getWeight()); layoutAux.addView(group, params); } }); actionRunnable.startOnUiAndWait(); }