Commit 78b46c65 by 刘鹏

Merge remote-tracking branch 'origin/4.2.60' into 4.2.60

# Conflicts:
#	config.gradle
parents 36b12cf9 73d2635b
...@@ -10,7 +10,7 @@ ext { ...@@ -10,7 +10,7 @@ ext {
"m-fm" : "0.0.30.03", "m-fm" : "0.0.30.03",
"m-user" : "0.0.61.37", "m-user" : "0.0.61.37",
"m-home" : "0.0.22.67", "m-home" : "0.0.22.67",
"m-im" : "0.0.19.37", "m-im" : "0.0.19.39",
"m-dynamic" : "0.0.7.24", "m-dynamic" : "0.0.7.24",
"m-article" : "0.0.0.10", "m-article" : "0.0.0.10",
...@@ -93,7 +93,7 @@ ext { ...@@ -93,7 +93,7 @@ ext {
"m-fm" : "0.0.30.01", "m-fm" : "0.0.30.01",
"m-user" : "0.0.61.37", "m-user" : "0.0.61.37",
"m-home" : "0.0.22.67", "m-home" : "0.0.22.67",
"m-im" : "0.0.19.36", "m-im" : "0.0.19.39",
"m-dynamic" : "0.0.7.24", "m-dynamic" : "0.0.7.24",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
......
...@@ -9,10 +9,12 @@ import java.util.ArrayList; ...@@ -9,10 +9,12 @@ import java.util.ArrayList;
public class CustomAttachLingxiAnswerQuestion extends CustomAttachment{ public class CustomAttachLingxiAnswerQuestion extends CustomAttachment{
private final String ANSWERS = "answers"; private final String ANSWERS = "answers";
private final String QUESTIONID = "questionId"; private final String QUESTIONID = "questionId";
private final String EXAMID = "examId";
public ArrayList<QuestionItemBean> answers; public ArrayList<QuestionItemBean> answers;
public String questionId; public String questionId;
public String examId;
public CustomAttachLingxiAnswerQuestion() { public CustomAttachLingxiAnswerQuestion() {
super(CustomAttachmentType.TYPE_LINGXI_ANSWER_QUESTION); super(CustomAttachmentType.TYPE_LINGXI_ANSWER_QUESTION);
...@@ -21,6 +23,7 @@ public class CustomAttachLingxiAnswerQuestion extends CustomAttachment{ ...@@ -21,6 +23,7 @@ public class CustomAttachLingxiAnswerQuestion extends CustomAttachment{
protected void parseData(JSONObject data) { protected void parseData(JSONObject data) {
this.answers=(ArrayList<QuestionItemBean>) JSON.parseArray(data.getString(ANSWERS), QuestionItemBean.class); this.answers=(ArrayList<QuestionItemBean>) JSON.parseArray(data.getString(ANSWERS), QuestionItemBean.class);
this.questionId = data.getString(QUESTIONID); this.questionId = data.getString(QUESTIONID);
this.examId = data.getString(EXAMID);
} }
@Override @Override
...@@ -28,6 +31,7 @@ public class CustomAttachLingxiAnswerQuestion extends CustomAttachment{ ...@@ -28,6 +31,7 @@ public class CustomAttachLingxiAnswerQuestion extends CustomAttachment{
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put(ANSWERS, answers); data.put(ANSWERS, answers);
data.put(QUESTIONID, questionId); data.put(QUESTIONID, questionId);
data.put(EXAMID, examId);
return data; return data;
} }
} }
package com.yidianling.im.session.viewholder; package com.yidianling.im.session.viewholder;
import android.view.View;
import android.widget.TextView; import android.widget.TextView;
import com.yidianling.im.R; import com.yidianling.im.R;
...@@ -16,6 +17,7 @@ public class MsgViewHolderLingxiAnswerQuestion extends MsgViewHolderBase { ...@@ -16,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);
} }
...@@ -39,21 +41,38 @@ public class MsgViewHolderLingxiAnswerQuestion extends MsgViewHolderBase { ...@@ -39,21 +41,38 @@ public class MsgViewHolderLingxiAnswerQuestion extends MsgViewHolderBase {
@Override @Override
protected void bindContentView() { protected void bindContentView() {
avatarLeft.setVisibility(View.INVISIBLE);
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());
} }
} }
......
...@@ -25,7 +25,6 @@ import com.yidianling.im.router.ImIn; ...@@ -25,7 +25,6 @@ import com.yidianling.im.router.ImIn;
import com.yidianling.im.session.extension.CustomAttachLingxiAnswerQuestion; import com.yidianling.im.session.extension.CustomAttachLingxiAnswerQuestion;
import com.yidianling.im.session.extension.CustomAttachLingxiWhichQuestion; import com.yidianling.im.session.extension.CustomAttachLingxiWhichQuestion;
import com.yidianling.im.session.viewholder.adapter.AdapterLingxiMultipleChoice; import com.yidianling.im.session.viewholder.adapter.AdapterLingxiMultipleChoice;
import com.yidianling.im.session.viewholder.adapter.AdapterLingxiWhichQuestion;
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;
...@@ -47,7 +46,7 @@ import io.reactivex.schedulers.Schedulers; ...@@ -47,7 +46,7 @@ import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implements AdapterLingxiMultipleChoice.OnMultiplelItemClickListener { public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implements AdapterLingxiMultipleChoice.OnMultiplelItemClickListener {
private RecyclerView recycleviewMultipleChoice; private RecyclerView recycleviewMultipleChoice;
private TextView confirm_multiple_choice; private TextView confirm_multiple_choice;
private TextView multiple_choice_title; private TextView multiple_choice_title;
...@@ -59,7 +58,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -59,7 +58,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
CustomAttachLingxiWhichQuestion customAttachLingxiWhichQuestion; CustomAttachLingxiWhichQuestion customAttachLingxiWhichQuestion;
private StringBuffer stringBuffer = new StringBuffer("已选:"); private StringBuffer stringBuffer = new StringBuffer("已选:");
ArrayList<String> selectedStr = new ArrayList<String>(); ArrayList<String> selectedStr = new ArrayList<String>();
private Boolean isClickable = true;
private Boolean isOthers; private Boolean isOthers;
//回答试卷接口 //回答试卷接口
private String examId; private String examId;
...@@ -69,6 +67,8 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -69,6 +67,8 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
private ArrayList<AnswersItem> answersItems = new ArrayList<>(); private ArrayList<AnswersItem> answersItems = new ArrayList<>();
Map<String, Object> mapMessageFromCustom; Map<String, Object> mapMessageFromCustom;
Map map1 = new HashMap(); Map map1 = new HashMap();
private ArrayList<String> multipleAnswers = new ArrayList<>();
private ArrayList<String> answersItemsMap = new ArrayList<>();
public MsgViewHolderLingxiWhichQuestion(BaseMultiItemFetchLoadAdapter adapter) { public MsgViewHolderLingxiWhichQuestion(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter); super(adapter);
...@@ -77,26 +77,24 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -77,26 +77,24 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
@Override @Override
protected int getContentResId() { protected int getContentResId() {
customAttachLingxiWhichQuestion = ((CustomAttachLingxiWhichQuestion) message.getAttachment()); customAttachLingxiWhichQuestion = ((CustomAttachLingxiWhichQuestion) message.getAttachment());
singleOrMultipletype=customAttachLingxiWhichQuestion.type; singleOrMultipletype = customAttachLingxiWhichQuestion.type;
if (customAttachLingxiWhichQuestion.type != null) { if (customAttachLingxiWhichQuestion.type != null) {
return R.layout.im_nim_lingxi_multiple_choice; return R.layout.im_nim_lingxi_multiple_choice;
} else { } else {
return R.layout.im_nim_lingxi_which_question; return R.layout.im_nim_lingxi_multiple_choice;
} }
} }
@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);
} }
@Override @Override
protected void bindContentView() { protected void bindContentView() {
avatarRight.setVisibility(View.INVISIBLE);
ImIn.INSTANCE.setImMessage(message); ImIn.INSTANCE.setImMessage(message);
customAttachLingxiWhichQuestion = ((CustomAttachLingxiWhichQuestion) message.getAttachment()); customAttachLingxiWhichQuestion = ((CustomAttachLingxiWhichQuestion) message.getAttachment());
examId = customAttachLingxiWhichQuestion.examId; examId = customAttachLingxiWhichQuestion.examId;
...@@ -114,11 +112,13 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -114,11 +112,13 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
} }
} }
if (customAttachLingxiWhichQuestion.type != null) { if (customAttachLingxiWhichQuestion.type != null) {
singleOrMultipletype=customAttachLingxiWhichQuestion.type; singleOrMultipletype = customAttachLingxiWhichQuestion.type;
UpdateFromLocal();
initMultipleChoice(); initMultipleChoice();
} }
//进入消息列表时候,保存当type为56的时候的,将ID作为key保存 //进入消息列表时候,保存当type为56的时候的,将ID作为key保存
NIMClient.getService(MsgService.class).queryMessageList(message.getSessionId(),SessionTypeEnum.P2P,0,100).setCallback(new RequestCallback<List<IMMessage>>() { NIMClient.getService(MsgService.class).queryMessageList(message.getSessionId(), SessionTypeEnum.P2P, 0, 100).setCallback(new RequestCallback<List<IMMessage>>() {
@Override @Override
public void onSuccess(List<IMMessage> param) { public void onSuccess(List<IMMessage> param) {
if (param != null && param.size() > 0) { if (param != null && param.size() > 0) {
...@@ -127,13 +127,9 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -127,13 +127,9 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
MsgAttachment attachment = msg.getAttachment(); MsgAttachment attachment = msg.getAttachment();
if (attachment instanceof CustomAttachLingxiAnswerQuestion) { if (attachment instanceof CustomAttachLingxiAnswerQuestion) {
CustomAttachLingxiAnswerQuestion customattachlingxianswerquestion = (CustomAttachLingxiAnswerQuestion) attachment; CustomAttachLingxiAnswerQuestion customattachlingxianswerquestion = (CustomAttachLingxiAnswerQuestion) attachment;
map1.put(customattachlingxianswerquestion.questionId, true); map1.put(customattachlingxianswerquestion.questionId + customattachlingxianswerquestion.examId, true);
mapMessageFromCustom=map1; mapMessageFromCustom = map1;
UpdateFromLocalExtention(); UpdateFromLocalExtention();
LogUtil.e("aaaaaquestionID:"+customattachlingxianswerquestion.questionId);
}else{
//用户没有回答问题;
} }
} }
} }
...@@ -141,45 +137,86 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -141,45 +137,86 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
@Override @Override
public void onFailed(int code) { public void onFailed(int code) {
LogUtil.e("获取消息onFailed:"+code); LogUtil.e("获取消息onFailed:" + code);
} }
@Override @Override
public void onException(Throwable exception) { public void onException(Throwable exception) {
LogUtil.e("获取消息exception:"+exception.getLocalizedMessage()); LogUtil.e("获取消息exception:" + exception.getLocalizedMessage());
} }
}); });
} }
private void UpdateFromLocalExtention() { private void UpdateFromLocal() {
try { try {
Map<String, Object> mapMessage; Map<String, Object> map = message.getLocalExtension();
if (mapMessageFromCustom!=null){ if (map != null) {
mapMessage=mapMessageFromCustom; Object obj = map.get("isSure");
}else{ Object position = map.get("position");
mapMessage= message.getLocalExtension(); Object multiple = map.get("multiple");
if (obj != null) {
boolean b = (boolean) obj;
Integer posi = (Integer) position;
if (b) {
//不可点击
if (posi != null) {
questionList.get(posi).setSelected(true);
}
}
} else {
//可点击
}
if (multiple != null) {
multipleAnswers = (ArrayList<String>) multiple;
for (int i = 0; i < questionList.size(); i++) {
for (int j = 0; j < multipleAnswers.size(); j++) {
if (questionList.get(i).getName().contains(multipleAnswers.get(j))) {
questionList.get(i).setSelected(true);
}
}
}
if (multipleAnswers.size() > 0) {
confirm_multiple_choice.setEnabled(true);
confirm_multiple_choice.setBackground(context.getResources().getDrawable(R.drawable.im_background_18dp_1da1f2));
} else {
confirm_multiple_choice.setEnabled(false);
confirm_multiple_choice.setBackground(context.getResources().getDrawable(R.drawable.im_background_18dp_ebebeb));
}
}
} else {
//可点击
} }
} catch (Exception e) {
LogUtil.e("aaaaa" + e.getLocalizedMessage());
}
}
private void UpdateFromLocalExtention() {
try {
Map<String, Object> mapMessage = new HashMap<>();
if (mapMessageFromCustom != null) {
mapMessage = mapMessageFromCustom;
}
if (mapMessage != null) { if (mapMessage != null) {
Object questionPaperId=mapMessage.get(customAttachLingxiWhichQuestion.id); Object questionPaperId = mapMessage.get(customAttachLingxiWhichQuestion.id + customAttachLingxiWhichQuestion.examId);
LogUtil.e("aaaaaIDIDI:"+customAttachLingxiWhichQuestion.id);
if (questionPaperId != null) { if (questionPaperId != null) {
boolean b = (boolean) questionPaperId; boolean b = (boolean) questionPaperId;
if (b) { if (b) {
//隐藏回答的信息 //隐藏回答的信息
recycleviewMultipleChoice.setVisibility(View.GONE); recycleviewMultipleChoice.setVisibility(View.GONE);
confirm_multiple_choice.setVisibility(View.GONE); confirm_multiple_choice.setVisibility(View.GONE);
}else{ } else {
recycleviewMultipleChoice.setVisibility(View.VISIBLE); recycleviewMultipleChoice.setVisibility(View.VISIBLE);
confirm_multiple_choice.setVisibility(View.VISIBLE); confirm_multiple_choice.setVisibility(View.VISIBLE);
} }
}else{ } else {
//隐藏回答的信息 if (singleOrMultipletype.contains("radio")) {
if (singleOrMultipletype.contains("radio")){
recycleviewMultipleChoice.setVisibility(View.VISIBLE); recycleviewMultipleChoice.setVisibility(View.VISIBLE);
}else{ } else {
recycleviewMultipleChoice.setVisibility(View.VISIBLE); recycleviewMultipleChoice.setVisibility(View.VISIBLE);
confirm_multiple_choice.setVisibility(View.VISIBLE); confirm_multiple_choice.setVisibility(View.VISIBLE);
} }
...@@ -192,16 +229,16 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -192,16 +229,16 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
} }
private void initMultipleChoice() { private void initMultipleChoice() {
if (singleOrMultipletype.contains("radio")){ if (singleOrMultipletype.contains("radio")) {
confirm_multiple_choice.setVisibility(View.GONE); confirm_multiple_choice.setVisibility(View.GONE);
}else{ } else {
confirm_multiple_choice.setVisibility(View.VISIBLE); confirm_multiple_choice.setVisibility(View.VISIBLE);
} }
confirm_multiple_choice.setOnClickListener(view -> { confirm_multiple_choice.setOnClickListener(view -> {
//请求接口发送所选题目,通过发通知到YDLMessageFragment统一回答问题。 //请求接口发送所选题目,通过发通知到YDLMessageFragment统一回答问题。
EventBus.getDefault().post(new MultipleSelectedEvent(null, null, EventBus.getDefault().post(new MultipleSelectedEvent(null, null,
new MultipleAnswerBean(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid(), new MultipleAnswerBean(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid(),
questionId, answersItems,message.getFromAccount()),false,false)); questionId, answersItems, message.getFromAccount()), false, false));
}); });
multiple_choice_title.setText(customAttachLingxiWhichQuestion.name); multiple_choice_title.setText(customAttachLingxiWhichQuestion.name);
adapterLingxiMultipleChoice = new AdapterLingxiMultipleChoice(); adapterLingxiMultipleChoice = new AdapterLingxiMultipleChoice();
...@@ -216,7 +253,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -216,7 +253,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
} }
/* /*
* 用户回答问题接口 * 用户回答问题接口
* */ * */
...@@ -237,125 +273,126 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -237,125 +273,126 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
@Override @Override
public void onMultipleItemClick(@NotNull QuestionItemBean string, int position) { public void onMultipleItemClick(@NotNull QuestionItemBean string, int position) {
if (singleOrMultipletype.contains("radio")){ if (singleOrMultipletype.contains("radio")) {
/* /*
* 单选题:分其他选项和非其他选项 * 单选题:分其他选项和非其他选项
* 其他选项,唤起输入框 * 其他选项,唤起输入框
* 点击非其他选项直接发送答案 * 点击非其他选项直接发送答案
* */ * */
for (int i = 0; i < questionList.size(); i++) { for (int i = 0; i < questionList.size(); i++) {
if (questionList.get(i).isSelected()) { if (questionList.get(i).isSelected()) {
if (i == position) { if (i == position) {
if (questionList.get(i).getName().contains("其他")){ if (questionList.get(i).getName().contains("其他")) {
isClickable = true; questionList.get(i).setSelected(false);
questionList.get(i).setSelected(false); selectedStr.remove(questionList.get(i).getName());
selectedStr.remove(questionList.get(i).getName()); break;
} }
} }
} else { } else {
if (i == position) { if (i == position) {
questionList.get(i).setSelected(true); questionList.get(i).setSelected(true);
selectedStr.add(questionList.get(i).getName()); selectedStr.add(questionList.get(i).getName());
}else{ } else {
questionList.get(i).setSelected(false); questionList.get(i).setSelected(false);
if (questionList.get(i).getName().contains("其他")){ if (questionList.get(i).getName().contains("其他")) {
selectedStr.remove(questionList.get(i).getName()); selectedStr.remove(questionList.get(i).getName());
} }
} }
} }
questionList.get(i).setSelected(i == position); questionList.get(i).setSelected(i == position);
} }
adapterLingxiMultipleChoice.setTagData(questionList); adapterLingxiMultipleChoice.setTagData(questionList);
for (int i = 0; i < questionList.size(); i++) { for (int i = 0; i < questionList.size(); i++) {
if (questionList.get(i).isSelected()){ if (questionList.get(i).isSelected()) {
answersItems.clear(); answersItems.clear();
answersItems.add(new AnswersItem(questionList.get(position).getId(), answersItems.add(new AnswersItem(questionList.get(position).getId(),
questionList.get(position).getName(), "", questionList.get(position).getRelates())); questionList.get(position).getName(), "", questionList.get(position).getRelates()));
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){ //请求接口发送所选题目
isClickable = false; answerLingxiQuestion(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid().toString(), questionId, answersItems);
//请求接口发送所选题目 //更新本地消息
answerLingxiQuestion(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid().toString(), questionId, answersItems); updateLocalMsg(position, null);
//更新本地消息 //发通知取消隐藏输入框表情等符号
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));
EventBus.getDefault().post(new MultipleSelectedEvent(stringBuffer.toString(), new OthersState(isOthers, questionList.get(position).isSelected()), new MultipleAnswerBean(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid(), } else {
questionId, answersItems,message.getFromAccount()),false,true)); EventBus.getDefault().post(new MultipleSelectedEvent(stringBuffer.toString(), new OthersState(isOthers, questionList.get(position).isSelected()), new MultipleAnswerBean(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid(),
}else{ questionId, answersItems, message.getFromAccount()), false, false));
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)); } else {
} //多选发送消息
}else{ for (int i = 0; i < questionList.size(); i++) {
//多选发送消息 if (questionList.get(i).isSelected()) {
for (int i = 0; i < questionList.size(); i++) { if (i == position) {
if (questionList.get(i).isSelected()) { questionList.get(i).setSelected(false);
if (i == position) { selectedStr.remove(questionList.get(i).getName());
questionList.get(i).setSelected(false); for (int j = 0; j < answersItems.size(); j++) {
selectedStr.remove(questionList.get(i).getName()); if (questionList.get(i).getName() == answersItems.get(j).getName()) {
for (int j=0;j<answersItems.size();j++){ answersItems.remove(j);
if (questionList.get(i).getName()==answersItems.get(j).getName()){ break;
answersItems.remove(j); }
break; }
} }
} } else {
if (i == position) {
} questionList.get(i).setSelected(true);
} else { selectedStr.add(questionList.get(i).getName());
if (i == position) { answersItems.add(new AnswersItem(questionList.get(position).getId(),
questionList.get(i).setSelected(true); questionList.get(position).getName(), "", questionList.get(position).getRelates()));
selectedStr.add(questionList.get(i).getName()); }
answersItems.add(new AnswersItem(questionList.get(position).getId(), }
questionList.get(position).getName(), "", questionList.get(position).getRelates())); }
} confirm_multiple_choice.setText(String.format("确定(%d)", selectedStr.size()));
} if (selectedStr.size() > 0) {
} confirm_multiple_choice.setEnabled(true);
confirm_multiple_choice.setText(String.format("确定(%d)", selectedStr.size())); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
if (selectedStr.size() > 0) { confirm_multiple_choice.setBackground(context.getResources().getDrawable(R.drawable.im_background_18dp_1da1f2));
confirm_multiple_choice.setEnabled(true); }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { } else {
confirm_multiple_choice.setBackground(context.getResources().getDrawable(R.drawable.im_background_18dp_1da1f2)); confirm_multiple_choice.setEnabled(false);
} confirm_multiple_choice.setText("确定");
} else { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
confirm_multiple_choice.setEnabled(false); confirm_multiple_choice.setBackground(context.getDrawable(R.drawable.im_background_18dp_ebebeb));
confirm_multiple_choice.setText("确定"); }
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { }
confirm_multiple_choice.setBackground(context.getDrawable(R.drawable.im_background_18dp_ebebeb)); stringBuffer.delete(2, stringBuffer.length());
} for (int i = 0; i < selectedStr.size(); i++) {
} stringBuffer.append("、").append(selectedStr.get(i));
stringBuffer.delete(2, stringBuffer.length()); }
for (int i = 0; i < selectedStr.size(); i++) { isOthers = questionList.get(position).getName().contains("其他");
stringBuffer.append("#").append(selectedStr.get(i)); 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));
isOthers = questionList.get(position).getName().contains("其他"); adapterLingxiMultipleChoice.setTagData(questionList);
EventBus.getDefault().post(new MultipleSelectedEvent(stringBuffer.toString(), new OthersState(isOthers, questionList.get(position).isSelected()), new MultipleAnswerBean(examId, questionPaperId, ImIn.INSTANCE.getUserInfo().getUid(), answersItemsMap.clear();
questionId, answersItems,message.getFromAccount()),false,false)); for (int i = 0; i < answersItems.size(); i++) {
adapterLingxiMultipleChoice.setTagData(questionList); if (!answersItemsMap.contains(answersItems.get(i).getName())) {
} answersItemsMap.add(i, answersItems.get(i).getName());
}
}
updateLocalMsg(null, answersItemsMap);
}
} }
private void updateLocalMsg(Integer position,ArrayList<String> selectedPosition) { private void updateLocalMsg(Integer position, ArrayList<String> selectedPosition) {
//更新本地消息 //更新本地消息
Map<String, Object> map = message.getLocalExtension(); Map<String, Object> map = message.getLocalExtension();
if (map == null) { map = new HashMap();
map = new HashMap();
}
map.put("isSure", true); map.put("isSure", true);
if (position!=null){ if (position != null) {
map.put("position", position); map.put("position", position);
} }
if (selectedPosition!=null){ if (selectedPosition != null) {
map.put("multiple", selectedPosition); map.put("multiple", selectedPosition);
} }
message.setLocalExtension(null);
message.setLocalExtension(map); message.setLocalExtension(map);
NIMClient.getService(MsgService.class).updateIMMessage(message); NIMClient.getService(MsgService.class).updateIMMessage(message);
//通知ui刷新 //通知ui刷新
......
...@@ -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);
} }
/* /*
* 用户回答问题接口 * 用户回答问题接口
......
...@@ -271,7 +271,6 @@ public class MessageListPanelEx { ...@@ -271,7 +271,6 @@ public class MessageListPanelEx {
private void doScrollToBottom() { private void doScrollToBottom() {
messageListView.scrollToPosition(adapter.getBottomDataPosition()); messageListView.scrollToPosition(adapter.getBottomDataPosition());
} }
public void onIncomingMessage(List<IMMessage> messages) { public void onIncomingMessage(List<IMMessage> messages) {
boolean needScrollToBottom = isLastMessageVisible(); boolean needScrollToBottom = isLastMessageVisible();
boolean needRefresh = false; boolean needRefresh = false;
...@@ -299,9 +298,10 @@ public class MessageListPanelEx { ...@@ -299,9 +298,10 @@ public class MessageListPanelEx {
IMMessage lastMsg = messages.get(messages.size() - 1); IMMessage lastMsg = messages.get(messages.size() - 1);
if (isMyMessage(lastMsg)) { if (isMyMessage(lastMsg)) {
if (needScrollToBottom) { if (needScrollToBottom) {
doScrollToBottom(); messageListView.smoothScrollToPosition(adapter.getBottomDataPosition());
} else if (incomingMsgPrompt != null && lastMsg.getSessionType() != SessionTypeEnum.ChatRoom) { } else if (incomingMsgPrompt != null && lastMsg.getSessionType() != SessionTypeEnum.ChatRoom) {
incomingMsgPrompt.show(lastMsg); incomingMsgPrompt.show(lastMsg);
messageListView.smoothScrollToPosition(adapter.getBottomDataPosition());
} }
} }
} }
......
...@@ -58,8 +58,8 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem ...@@ -58,8 +58,8 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem
protected TextView readReceiptTextView; protected TextView readReceiptTextView;
protected TextView ackMsgTextView; protected TextView ackMsgTextView;
private HeadImageView avatarLeft; public HeadImageView avatarLeft;
private HeadImageView avatarRight; public HeadImageView avatarRight;
public ImageView nameIconView; public ImageView nameIconView;
...@@ -424,11 +424,11 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem ...@@ -424,11 +424,11 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem
} }
} }
public void setAvatarLeftInVisibity(){ public void setAvatarLeftInVisibity() {
avatarLeft.setVisibility(View.INVISIBLE); avatarLeft.setVisibility(View.INVISIBLE);
} }
public void setAvatarRightInVisibity(){ public void setAvatarRightInVisibity() {
avatarRight.setVisibility(View.INVISIBLE); avatarRight.setVisibility(View.INVISIBLE);
} }
...@@ -448,7 +448,7 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem ...@@ -448,7 +448,7 @@ public abstract class MsgViewHolderBase extends RecyclerViewHolder<BaseMultiItem
if (isReceivedMessage()) { if (isReceivedMessage()) {
audioRightSmallTip.setVisibility(View.VISIBLE); audioRightSmallTip.setVisibility(View.VISIBLE);
audioLeftSmallTip.setVisibility(View.GONE); audioLeftSmallTip.setVisibility(View.GONE);
}else { } else {
audioRightSmallTip.setVisibility(View.GONE); audioRightSmallTip.setVisibility(View.GONE);
audioLeftSmallTip.setVisibility(View.VISIBLE); audioLeftSmallTip.setVisibility(View.VISIBLE);
} }
......
...@@ -51,9 +51,11 @@ public class MsgViewHolderText extends MsgViewHolderBase { ...@@ -51,9 +51,11 @@ public class MsgViewHolderText extends MsgViewHolderBase {
private void layoutDirection() { private void layoutDirection() {
if (isReceivedMessage()) { if (isReceivedMessage()) {
bodyTextView.setTextColor(context.getResources().getColor(R.color.im_color_242424));
bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageLeftBackground); bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageLeftBackground);
bodyTextView.setPadding(ScreenUtil.dip2px(13), ScreenUtil.dip2px(7), ScreenUtil.dip2px(13), ScreenUtil.dip2px(7)); bodyTextView.setPadding(ScreenUtil.dip2px(13), ScreenUtil.dip2px(7), ScreenUtil.dip2px(13), ScreenUtil.dip2px(7));
} else { } else {
bodyTextView.setTextColor(context.getResources().getColor(R.color.white));
bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageRightBackground); bodyTextView.setBackgroundResource(NimUIKitImpl.getOptions().messageRightBackground);
bodyTextView.setPadding(ScreenUtil.dip2px(13), ScreenUtil.dip2px(7), ScreenUtil.dip2px(13), ScreenUtil.dip2px(7)); bodyTextView.setPadding(ScreenUtil.dip2px(13), ScreenUtil.dip2px(7), ScreenUtil.dip2px(13), ScreenUtil.dip2px(7));
} }
......
...@@ -18,6 +18,8 @@ ...@@ -18,6 +18,8 @@
app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintLeft_toLeftOf="parent"
tools:text="请问是发生了什么事情导致的呢?(多选)?" tools:text="请问是发生了什么事情导致的呢?(多选)?"
android:textSize="@dimen/im_text_size_17" android:textSize="@dimen/im_text_size_17"
android:includeFontPadding="false"
android:lineSpacingExtra="3dip"
android:textColor="@color/im_color_242424" android:textColor="@color/im_color_242424"
android:paddingBottom="@dimen/platform_dp_16" android:paddingBottom="@dimen/platform_dp_16"
> >
......
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="@drawable/im_custom_message_round_white_6dp_bg"
android:paddingLeft="@dimen/platform_dp_12"
android:paddingRight="@dimen/platform_dp_3"
android:paddingTop="@dimen/platform_dp_12"
>
<TextView
android:id="@+id/which_question_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:maxWidth="263dp"
android:textColor="@color/im_color_242424"
android:textSize="@dimen/im_text_size_17"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:text="您想要咨询下类哪类问?"
android:layout_marginBottom="@dimen/platform_dp_16"
app:layout_constraintBottom_toTopOf="@id/which_question_rv"
/>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/which_question_rv"
android:layout_width="0dp"
android:layout_height="wrap_content"
android:layout_marginBottom="@dimen/dp_4"
android:orientation="vertical"
app:layoutManager="androidx.recyclerview.widget.GridLayoutManager"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="@id/which_question_title"
app:layout_constraintTop_toBottomOf="@id/which_question_title"
app:spanCount="2"
tools:itemCount="6"
tools:listitem="@layout/im_lingxi_which_question_item" />
</androidx.constraintlayout.widget.ConstraintLayout>
\ No newline at end of file
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<TextView xmlns:android="http://schemas.android.com/apk/res/android" <TextView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools" xmlns:tools="http://schemas.android.com/tools"
android:id="@+id/textViewAlreadyRead" android:id="@+id/textViewAlreadyRead"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginBottom="3dip"
android:background="@color/im_transparent"
android:layout_marginLeft="2dp" android:layout_marginLeft="2dp"
android:layout_marginRight="2dp" android:layout_marginRight="2dp"
android:text="@string/im_readed" android:layout_marginBottom="3dip"
android:textColor="#666666" android:background="@color/im_transparent"
android:textSize="12sp" android:text="@string/im_readed"
android:visibility="gone" android:textColor="#999999"
tools:visibility="visible" android:textSize="12sp"
/> android:visibility="gone"
tools:visibility="visible" />
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