Commit 9b1cb0a9 by 霍志良

fix:修复单选其他选项

parent c17e8d6f
......@@ -51,7 +51,7 @@ public class MsgViewHolderLingxiAnswerQuestion extends MsgViewHolderBase {
}
}
if (itemBeans.size()==1){
if (itemBeans.size()==1&&!itemBeans.get(0).getName().contains("其他")){
answer_question.setText(itemBeans.get(0).getName());
}else{
answer_question.setText(sb.toString());
......
......@@ -223,17 +223,42 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
public void onItemClick(@NotNull QuestionItemBean itemBean, int position) {
if (isClickable) {
for (int i = 0; i < questionList.size(); i++) {
if (questionList.get(i).isSelected()) {
if (i == position) {
if (questionList.get(i).getName().contains("其他")){
isClickable = true;
questionList.get(i).setSelected(false);
selectedStr.remove(questionList.get(i).getName());
break;
}
}
} else {
if (i == position) {
questionList.get(i).setSelected(true);
selectedStr.add(questionList.get(i).getName());
}
}
questionList.get(i).setSelected(i == position);
}
adapterLingxiWhichQuestion.setTagData(questionList, isSingleChoice);
isClickable = false;
answersItems.add(new AnswersItem(questionList.get(position).getId(),
questionList.get(position).getName(), "", questionList.get(position).getRelates()));
//请求接口发送所选题目
answerLingxiQuestion(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid().toString(), questionId, answersItems);
//更新本地消息
updateLocalMsg(position,null);
stringBuffer.delete(2, stringBuffer.length());
for (int i = 0; i < selectedStr.size(); i++) {
stringBuffer.append("#").append(selectedStr.get(i));
}
isOthers = questionList.get(position).getName().contains("其他");
if (!isOthers){
isClickable = false;
//请求接口发送所选题目
answerLingxiQuestion(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid().toString(), questionId, answersItems);
//更新本地消息
updateLocalMsg(position,null);
}else{
EventBus.getDefault().post(new MultipleSelectedEvent(stringBuffer.toString(), new OthersState(isOthers, questionList.get(position).isSelected()), new MultipleAnswerBean(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid(),
questionId, answersItems,message.getFromAccount()),false));
}
}
}
......
......@@ -1071,6 +1071,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
isOthers=event.getOthersState().getOthersSelect();
inputPanel.onlyShowTextEnd();
}
question_multiple.setText(event.getStrSelected());
}else{
question_multiple.setText(event.getStrSelected());
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment