Skip to content

Commit

Permalink
Added picker elements to form
Browse files Browse the repository at this point in the history
  • Loading branch information
jparrell committed Apr 7, 2021
1 parent d6c2a06 commit b7441be
Showing 1 changed file with 31 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,18 @@

import me.riddhimanadib.formmaster.FormBuilder;
import me.riddhimanadib.formmaster.model.BaseFormElement;
import me.riddhimanadib.formmaster.model.FormElementPickerDate;
import me.riddhimanadib.formmaster.model.FormElementPickerMulti;
import me.riddhimanadib.formmaster.model.FormElementPickerSingle;
import me.riddhimanadib.formmaster.model.FormElementPickerTime;
import me.riddhimanadib.formmaster.model.FormElementSwitch;
import me.riddhimanadib.formmaster.model.FormElementTextEmail;
import me.riddhimanadib.formmaster.model.FormElementTextMultiLine;
import me.riddhimanadib.formmaster.model.FormElementTextNumber;
import me.riddhimanadib.formmaster.model.FormElementTextPassword;
import me.riddhimanadib.formmaster.model.FormElementTextPhone;
import me.riddhimanadib.formmaster.model.FormElementTextSingleLine;
import me.riddhimanadib.formmaster.model.FormHeader;

public class WaterWayForm extends AppCompatActivity {
//HQ form
Expand Down Expand Up @@ -48,17 +59,23 @@ public class WaterWayForm extends AppCompatActivity {
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

setContentView(R.layout.activity_sample_fordm);
recyclerView = findViewById(R.id.recyclerView2);
setupHQForm();

setupForm();
}

private void setupHQForm() {
private void setupForm() {

formBuilder = new FormBuilder(this, recyclerView);
FormElementTextNumber subSize = FormElementTextNumber.createInstance().setTitle("Substrate Size").setValue("0");
List<String> array_subSize = new ArrayList<>();
array_subSize.add("14: Large(4\" or larger)");
array_subSize.add("10: Medium(1\" to 4\")");
array_subSize.add("6: Small(.25\" to 1\")");

array_subSize.add("0: Fine(granular)");


FormElementPickerSingle subSize = FormElementPickerSingle.createInstance().setTitle("Substrate Size").setOptions(array_subSize).setPickerTitle("Pick one option");
FormElementTextNumber smothering = FormElementTextNumber.createInstance().setTitle("Smothering").setValue("0");
FormElementTextNumber silting = FormElementTextNumber.createInstance().setTitle("Silting").setValue("0");
FormElementTextNumber rootwads = FormElementTextNumber.createInstance().setTitle("Rootwads").setValue("0");
Expand Down Expand Up @@ -99,9 +116,16 @@ private void setupHQForm() {
formItems.add(bankErosion);

formBuilder.addFormElements(formItems);
int index = subSize.getValue().indexOf(":");
if (index > 0)
{
subVal = Double.parseDouble(subSize.getValue().substring(0,index));
}
else
{
subVal = 0;
}


subVal = Double.parseDouble(subSize.getValue());
smothVal = Double.parseDouble(smothering.getValue());
siltVal = Double.parseDouble(silting.getValue());
rootVal = Double.parseDouble(rootwads.getValue());
Expand Down

0 comments on commit b7441be

Please sign in to comment.