Commit 928ed8dc by 霍志良

fix:修复单选其他

parent 2dc5f8aa
......@@ -6,7 +6,8 @@ public class MultipleSelectedEvent (
val strSelected:String?,
var othersState:OthersState?,
var multipleAnswerBean:MultipleAnswerBean?,
var isFromInputPanel:Boolean
var isFromInputPanel:Boolean,
var recoverInput:Boolean
)
data class OthersState(
var isOthers:Boolean,
......
......@@ -193,7 +193,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
//请求接口发送所选题目,通过发通知到YDLMessageFragment统一回答问题。
EventBus.getDefault().post(new MultipleSelectedEvent(null, null,
new MultipleAnswerBean(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid(),
questionId, answersItems,message.getFromAccount()),false));
questionId, answersItems,message.getFromAccount()),false,false));
});
multiple_choice_title.setText(customAttachLingxiWhichQuestion.name);
adapterLingxiMultipleChoice = new AdapterLingxiMultipleChoice();
......@@ -229,21 +229,32 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
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());
}else{
questionList.get(i).setSelected(false);
if (questionList.get(i).getName().contains("其他")){
selectedStr.remove(questionList.get(i).getName());
}
}
}
questionList.get(i).setSelected(i == position);
}
adapterLingxiWhichQuestion.setTagData(questionList, isSingleChoice);
for (int i = 0; i < questionList.size(); i++) {
if (questionList.get(i).isSelected()){
answersItems.clear();
answersItems.add(new AnswersItem(questionList.get(position).getId(),
questionList.get(position).getName(), "", questionList.get(position).getRelates()));
break;
}
}
answersItems.add(new AnswersItem(questionList.get(position).getId(),
questionList.get(position).getName(), "", questionList.get(position).getRelates()));
stringBuffer.delete(2, stringBuffer.length());
for (int i = 0; i < selectedStr.size(); i++) {
stringBuffer.append("#").append(selectedStr.get(i));
......@@ -255,9 +266,12 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
answerLingxiQuestion(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid().toString(), questionId, answersItems);
//更新本地消息
updateLocalMsg(position,null);
//发通知取消隐藏输入框表情等符号
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,true));
}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));
questionId, answersItems,message.getFromAccount()),false,false));
}
}
}
......@@ -325,7 +339,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
}
isOthers = questionList.get(position).getName().contains("其他");
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));
questionId, answersItems,message.getFromAccount()),false,false));
adapterLingxiMultipleChoice.setTagData(questionList);
}
}
......
......@@ -1055,6 +1055,10 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
answersItems=event.getMultipleAnswerBean().getAnswersItems();
multipleAnswerBean=event.getMultipleAnswerBean();
multipleAnswerBean.setAnswersItems(answersItems);
if (event.getRecoverInput()){
inputPanel.onlyShowTextEnd();
return;
}
if (event.getOthersState().isOthers()){
//用户点击了其他事件
if (event.getOthersState().getOthersSelect()){
......
......@@ -418,7 +418,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
} else if (v == sendMessageButtonInInputBar) {
if (onlyShowInputTest){
EventBus.getDefault().post(new MultipleSelectedEvent(null, null,
null,true));
null,true,false));
}else{
onTextMessageSendButtonPressed();
}
......
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