Commit aa92fbfb by 霍志良

feat:消息对齐、部分UI修改

parent 08c57020
......@@ -17,6 +17,7 @@ public class MsgViewHolderLingxiAnswerQuestion extends MsgViewHolderBase {
CustomAttachLingxiAnswerQuestion customattachLingxiAnswerQuestion;
private ArrayList<QuestionItemBean> itemBeans;
private StringBuffer sb;
private boolean isContainsOther=false;
public MsgViewHolderLingxiAnswerQuestion(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter);
}
......@@ -44,18 +45,34 @@ public class MsgViewHolderLingxiAnswerQuestion extends MsgViewHolderBase {
customattachLingxiAnswerQuestion = ((CustomAttachLingxiAnswerQuestion) message.getAttachment());
itemBeans=customattachLingxiAnswerQuestion.answers;
sb=new StringBuffer();
for (int j=0;j<itemBeans.size();j++){
if (itemBeans.get(j).getOther().trim().length()>0){
isContainsOther=true;
break;
}
}
for (int i=0;i<itemBeans.size();i++){
if (i==(itemBeans.size()-1)&&itemBeans.get(i).getName().contains("其他")){
sb.append("#"+itemBeans.get(i).getName()+"\r\n ").append(itemBeans.get(i).getOther());
if (itemBeans.get(i).getOther().trim().length()>0){
//如果其他有内容就换行
sb.append("#"+itemBeans.get(i).getName()+"\r\n ").append(itemBeans.get(i).getOther());
}else{
sb.append("、"+itemBeans.get(i).getName());
}
}else{
sb.append("#"+itemBeans.get(i).getName()+" ");
if (isContainsOther){
sb.append("#"+itemBeans.get(i).getName()+" ");
}else{
sb.append("、"+itemBeans.get(i).getName()+" ");
}
}
}
if (itemBeans.size()==1&&!itemBeans.get(0).getName().contains("其他")){
answer_question.setText(itemBeans.get(0).getName());
}else{
if (!isContainsOther){
sb.replace(0,1,"");
}
answer_question.setText(sb.toString());
}
}
......
......@@ -87,7 +87,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
@Override
protected void inflateContentView() {
// recycleviewWhichQuestion = findViewById(R.id.which_question_rv);
recycleviewMultipleChoice = findViewById(R.id.multiple_question_rv);
confirm_multiple_choice = findViewById(R.id.confirm_multiple_choice);
multiple_choice_title = findViewById(R.id.multiple_choice_title);
......@@ -128,7 +127,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
if (attachment instanceof CustomAttachLingxiAnswerQuestion) {
CustomAttachLingxiAnswerQuestion customattachlingxianswerquestion = (CustomAttachLingxiAnswerQuestion) attachment;
map1.put(customattachlingxianswerquestion.questionId+customattachlingxianswerquestion.examId, true);
mapMessageFromCustom=map1;
UpdateFromLocalExtention();
}
......@@ -265,10 +263,9 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
break;
}
}
stringBuffer.delete(2, stringBuffer.length());
for (int i = 0; i < selectedStr.size(); i++) {
stringBuffer.append("#").append(selectedStr.get(i));
stringBuffer.append("").append(selectedStr.get(i));
}
isOthers = questionList.get(position).getName().contains("其他");
if (!isOthers){
......@@ -297,7 +294,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
break;
}
}
}
} else {
if (i == position) {
......@@ -323,15 +319,13 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
}
stringBuffer.delete(2, stringBuffer.length());
for (int i = 0; i < selectedStr.size(); i++) {
stringBuffer.append("#").append(selectedStr.get(i));
stringBuffer.append("").append(selectedStr.get(i));
}
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,false));
adapterLingxiMultipleChoice.setTagData(questionList);
}
}
private void updateLocalMsg(Integer position,ArrayList<String> selectedPosition) {
......
......@@ -66,8 +66,6 @@ import com.yidianling.im.event.MultipleSelectedEvent;
import com.yidianling.im.helper.IMChatUtil;
import com.yidianling.im.http.ImRetrofitApi;
import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.extension.CustomAttachLingxiAnswerQuestion;
import com.yidianling.im.session.extension.CustomAttachmentConfirmOrder;
import com.yidianling.im.session.viewholder.bean.AnswerBean;
import com.yidianling.im.session.viewholder.bean.AnswersItem;
import com.yidianling.im.session.viewholder.bean.LingxiAnswerBean;
......@@ -1074,12 +1072,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}, 500);
}else{
//其他是未选中状态
question_multiple.setVisibility(View.GONE);
isOthers=event.getOthersState().getOthersSelect();
inputPanel.onlyShowTextEnd();
}
if (event.getStrSelected().contains("其他")){
question_multiple.setVisibility(View.VISIBLE);
question_multiple.setText(event.getStrSelected());
question_multiple.setText(event.getStrSelected().replace("、","#"));
}
}else{
if (event.getStrSelected().contains("其他")){
......@@ -1135,8 +1134,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
message.setLocalExtension(map);
NIMClient.getService(MsgService.class).updateIMMessage(message);
//通知ui刷新
// message.getMsgAdapter().updateItemAtLocalExtension(message);
}
/*
* 用户回答问题接口
......
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