Search in sources :

Example 1 with FormEntryActivity

use of org.odk.collect.android.activities.FormEntryActivity in project collect by opendatakit.

the class SelectImageMapWidget method refreshSelectedItemsLabel.

protected void refreshSelectedItemsLabel() {
    StringBuilder stringBuilder = new StringBuilder();
    if (!selections.isEmpty()) {
        stringBuilder.append("<b>").append(getContext().getString(R.string.selected)).append("</b> ");
        for (Selection selection : selections) {
            String choiceName = getFormEntryPrompt().getSelectChoiceText(selection.choice);
            CharSequence choiceDisplayName = TextUtils.textToHtml(choiceName);
            stringBuilder.append(choiceDisplayName);
            if (selections.indexOf(selection) < selections.size() - 1) {
                stringBuilder.append(", ");
            }
        }
    }
    ((FormEntryActivity) getContext()).runOnUiThread(() -> selectedAreasLabel.setText(Html.fromHtml(stringBuilder.toString())));
}
Also used : Selection(org.javarosa.core.model.data.helper.Selection) FormEntryActivity(org.odk.collect.android.activities.FormEntryActivity)

Example 2 with FormEntryActivity

use of org.odk.collect.android.activities.FormEntryActivity in project collect by opendatakit.

the class AllWidgetsFormTest method prepareDependencies.

@Before
public void prepareDependencies() {
    FormEntryActivity activity = activityTestRule.getActivity();
    activity.setActivityAvailability(activityAvailability);
    activity.setShouldOverrideAnimations(true);
}
Also used : FormEntryActivity(org.odk.collect.android.activities.FormEntryActivity) Before(org.junit.Before)

Aggregations

FormEntryActivity (org.odk.collect.android.activities.FormEntryActivity)2 Selection (org.javarosa.core.model.data.helper.Selection)1 Before (org.junit.Before)1