Search in sources :

Example 1 with ImageOptionView

use of org.eyeseetea.malariacare.views.option.ImageOptionView in project pictureapp by EyeSeeTea.

the class ImageOptionSingleQuestionView method setValue.

@Override
public void setValue(Value value) {
    if (value == null || value.getValue() == null) {
        return;
    }
    for (int i = 0; i < mImageOptionViews.size(); i++) {
        ImageOptionView imageOptionView = mImageOptionViews.get(i);
        boolean selected = imageOptionView.getOption().equals(value.getOption());
        imageOptionView.setSelectedOption(selected);
    }
}
Also used : ImageOptionView(org.eyeseetea.malariacare.views.option.ImageOptionView)

Example 2 with ImageOptionView

use of org.eyeseetea.malariacare.views.option.ImageOptionView in project pictureapp by EyeSeeTea.

the class ImageOptionSingleQuestionView method createOptionView.

@NonNull
private ImageOptionView createOptionView(Option option) {
    ImageOptionView imageOptionView = new ImageOptionView(getContext());
    imageOptionView.setOption(option, mQuestion);
    imageOptionView.setOnOptionSelectedListener(this);
    imageOptionView.setEnabled(isEnabled());
    imageOptionView.setLayoutParams(new TableRow.LayoutParams(TableRow.LayoutParams.MATCH_PARENT, TableRow.LayoutParams.MATCH_PARENT, 1));
    return imageOptionView;
}
Also used : TableRow(android.widget.TableRow) ImageOptionView(org.eyeseetea.malariacare.views.option.ImageOptionView) NonNull(android.support.annotation.NonNull)

Example 3 with ImageOptionView

use of org.eyeseetea.malariacare.views.option.ImageOptionView in project pictureapp by EyeSeeTea.

the class ImageOptionSingleQuestionView method setOptions.

@Override
public void setOptions(List<Option> options) {
    TableRow tableRow = null;
    for (int i = 0; i < options.size(); i++) {
        Option option = options.get(i);
        if (isNewRow(i)) {
            tableRow = new TableRow(getContext());
            tableRow.setLayoutParams(new TableLayout.LayoutParams(TableLayout.LayoutParams.MATCH_PARENT, TableLayout.LayoutParams.MATCH_PARENT, 1));
            mImageOptionsContainer.addView(tableRow);
        }
        ImageOptionView imageOptionView = createOptionView(option);
        tableRow.addView(imageOptionView);
        mImageOptionViews.add(imageOptionView);
    }
}
Also used : TableRow(android.widget.TableRow) Option(org.eyeseetea.malariacare.data.database.model.Option) TableLayout(android.widget.TableLayout) ImageOptionView(org.eyeseetea.malariacare.views.option.ImageOptionView)

Example 4 with ImageOptionView

use of org.eyeseetea.malariacare.views.option.ImageOptionView in project pictureapp by EyeSeeTea.

the class ImageOptionSingleQuestionView method setEnabled.

@Override
public void setEnabled(boolean enabled) {
    super.setEnabled(enabled);
    for (int i = 0; i < mImageOptionViews.size(); i++) {
        ImageOptionView imageOptionView = mImageOptionViews.get(i);
        imageOptionView.setEnabled(enabled);
    }
}
Also used : ImageOptionView(org.eyeseetea.malariacare.views.option.ImageOptionView)

Aggregations

ImageOptionView (org.eyeseetea.malariacare.views.option.ImageOptionView)4 TableRow (android.widget.TableRow)2 NonNull (android.support.annotation.NonNull)1 TableLayout (android.widget.TableLayout)1 Option (org.eyeseetea.malariacare.data.database.model.Option)1