Commit aa92fbfb by 霍志良

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

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