// Path: app/src/main/java/com/daquexian/chaoli/forum/model/BusinessQuestion.java
// public class BusinessQuestion {
//     private static final String TAG = "BusinessQuestion";
//     public String id;
//     public String question;
//     public Boolean choice;
//     public Boolean multiAnswer;
//     public ObservableList<String> options;
// 
//     public ObservableList<Boolean> isChecked = new ObservableArrayList<>();
//     public ObservableField<String> answer = new ObservableField<>();
// 
//     public BusinessQuestion(Question item) {
//         for (int i = 0; i < 4; i++) isChecked.add(false);
//         id = item._id.$id;
//         question = item.question;
//         choice = Boolean.valueOf(item.choice);
//         multiAnswer = Boolean.valueOf(item.multi_answer);
//         options = new ObservableArrayList<>();
//         options.addAll(item.options);
//         while (options.size() < 4) {
//             options.add(ChaoliApplication.getAppContext().getString(R.string.useless_option));
//         }
//     }
// 
//     public static ArrayList<BusinessQuestion> fromList(List<Question> questionList) {
//         ArrayList<BusinessQuestion> businessQuestionList = new ArrayList<>();
//         for (Question item : questionList) {
//             businessQuestionList.add(new BusinessQuestion(item));
//         }
//         return businessQuestionList;
//     }
// }


import com.daquexian.chaoli.forum.R;
import com.daquexian.chaoli.forum.model.BusinessQuestion;
package com.daquexian.chaoli.forum.binding;


/**
 * Created by jianhao on 16-10-13.
 */

public class QuestionLayoutSelector extends LayoutSelector<BusinessQuestion> {
    private final int CHECK_BTN_ITEM_TYPE = 0;
    private final int RADIO_BTN_ITEM_TYPE = 1;
    private final int EDIT_TEXT_ITEM_TYPE = 2;

    @Override
    int getLayout(int type) {
        switch (type) {
            case EDIT_TEXT_ITEM_TYPE:
                return R.layout.question_item_et;
            case CHECK_BTN_ITEM_TYPE:
                return R.layout.question_item_cb;
            case RADIO_BTN_ITEM_TYPE:
                return R.layout.question_item_rb;
            default:
                throw new IllegalArgumentException("Wrong type");
        }
    }

    @Override
// Path: app/src/main/java/com/daquexian/chaoli/forum/model/BusinessQuestion.java
// public class BusinessQuestion {
//     private static final String TAG = "BusinessQuestion";
//     public String id;
//     public String question;
//     public Boolean choice;
//     public Boolean multiAnswer;
//     public ObservableList<String> options;
// 
//     public ObservableList<Boolean> isChecked = new ObservableArrayList<>();
//     public ObservableField<String> answer = new ObservableField<>();
// 
//     public BusinessQuestion(Question item) {
//         for (int i = 0; i < 4; i++) isChecked.add(false);
//         id = item._id.$id;
//         question = item.question;
//         choice = Boolean.valueOf(item.choice);
//         multiAnswer = Boolean.valueOf(item.multi_answer);
//         options = new ObservableArrayList<>();
//         options.addAll(item.options);
//         while (options.size() < 4) {
//             options.add(ChaoliApplication.getAppContext().getString(R.string.useless_option));
//         }
//     }
// 
//     public static ArrayList<BusinessQuestion> fromList(List<Question> questionList) {
//         ArrayList<BusinessQuestion> businessQuestionList = new ArrayList<>();
//         for (Question item : questionList) {
//             businessQuestionList.add(new BusinessQuestion(item));
//         }
//         return businessQuestionList;
//     }
// }


// Path: app/src/main/java/com/daquexian/chaoli/forum/binding/QuestionLayoutSelector.java
import com.daquexian.chaoli.forum.R;
import com.daquexian.chaoli.forum.model.BusinessQuestion;

package com.daquexian.chaoli.forum.binding;


/**
 * Created by jianhao on 16-10-13.
 */

public class QuestionLayoutSelector extends LayoutSelector<BusinessQuestion> {
    private final int CHECK_BTN_ITEM_TYPE = 0;
    private final int RADIO_BTN_ITEM_TYPE = 1;
    private final int EDIT_TEXT_ITEM_TYPE = 2;

    @Override
    int getLayout(int type) {
        switch (type) {
            case EDIT_TEXT_ITEM_TYPE:
                return R.layout.question_item_et;
            case CHECK_BTN_ITEM_TYPE:
                return R.layout.question_item_cb;
            case RADIO_BTN_ITEM_TYPE:
                return R.layout.question_item_rb;
            default:
                throw new IllegalArgumentException("Wrong type");
        }
    }

    @Override
    int getType(BusinessQuestion item) {