Commit 36b12cf9 by 刘鹏

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

# Conflicts:
#	config.gradle
parents 339f40ea 4b9462e5
...@@ -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.33", "m-im" : "0.0.19.36",
"m-dynamic" : "0.0.7.24", "m-dynamic" : "0.0.7.24",
"m-article" : "0.0.0.8", "m-article" : "0.0.0.8",
......
...@@ -8,7 +8,7 @@ import java.util.ArrayList; ...@@ -8,7 +8,7 @@ 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 = "questionPaperId"; private final String QUESTIONID = "questionId";
public ArrayList<QuestionItemBean> answers; public ArrayList<QuestionItemBean> answers;
......
...@@ -47,14 +47,11 @@ import io.reactivex.schedulers.Schedulers; ...@@ -47,14 +47,11 @@ import io.reactivex.schedulers.Schedulers;
import okhttp3.MediaType; import okhttp3.MediaType;
import okhttp3.RequestBody; import okhttp3.RequestBody;
public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implements AdapterLingxiWhichQuestion.OnQuestionlItemClickListener, AdapterLingxiMultipleChoice.OnMultiplelItemClickListener { public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implements AdapterLingxiMultipleChoice.OnMultiplelItemClickListener {
private RecyclerView recycleviewWhichQuestion;
private RecyclerView recycleviewMultipleChoice; private RecyclerView recycleviewMultipleChoice;
private TextView confirm_multiple_choice; private TextView confirm_multiple_choice;
private TextView which_question_title;
private TextView multiple_choice_title; private TextView multiple_choice_title;
private AdapterLingxiWhichQuestion adapterLingxiWhichQuestion;
private AdapterLingxiMultipleChoice adapterLingxiMultipleChoice; private AdapterLingxiMultipleChoice adapterLingxiMultipleChoice;
ArrayList<QuestionItemBean> questionList = new ArrayList<QuestionItemBean>(); ArrayList<QuestionItemBean> questionList = new ArrayList<QuestionItemBean>();
...@@ -71,6 +68,8 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -71,6 +68,8 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
private String singleOrMultipletype; private String singleOrMultipletype;
private ArrayList<AnswersItem> answersItems = new ArrayList<>(); private ArrayList<AnswersItem> answersItems = new ArrayList<>();
Map<String, Object> mapMessageFromCustom; Map<String, Object> mapMessageFromCustom;
Map map1 = new HashMap();
public MsgViewHolderLingxiWhichQuestion(BaseMultiItemFetchLoadAdapter adapter) { public MsgViewHolderLingxiWhichQuestion(BaseMultiItemFetchLoadAdapter adapter) {
super(adapter); super(adapter);
} }
...@@ -80,14 +79,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -80,14 +79,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
customAttachLingxiWhichQuestion = ((CustomAttachLingxiWhichQuestion) message.getAttachment()); customAttachLingxiWhichQuestion = ((CustomAttachLingxiWhichQuestion) message.getAttachment());
singleOrMultipletype=customAttachLingxiWhichQuestion.type; singleOrMultipletype=customAttachLingxiWhichQuestion.type;
if (customAttachLingxiWhichQuestion.type != null) { if (customAttachLingxiWhichQuestion.type != null) {
switch (customAttachLingxiWhichQuestion.type) {
case "radio"://您想要咨询下列哪类的问题?(单选)
return R.layout.im_nim_lingxi_which_question;
case "check"://请问是发生了什么事情导致的呢?(多选)
return R.layout.im_nim_lingxi_multiple_choice; return R.layout.im_nim_lingxi_multiple_choice;
default:
return R.layout.im_nim_lingxi_which_question;
}
} else { } else {
return R.layout.im_nim_lingxi_which_question; return R.layout.im_nim_lingxi_which_question;
} }
...@@ -96,10 +88,9 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -96,10 +88,9 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
@Override @Override
protected void inflateContentView() { protected void inflateContentView() {
recycleviewWhichQuestion = findViewById(R.id.which_question_rv); // 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);
which_question_title = findViewById(R.id.which_question_title);
multiple_choice_title = findViewById(R.id.multiple_choice_title); multiple_choice_title = findViewById(R.id.multiple_choice_title);
} }
...@@ -116,7 +107,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -116,7 +107,6 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
if (customAttachLingxiWhichQuestion.options != null) { if (customAttachLingxiWhichQuestion.options != null) {
questionList = (ArrayList<QuestionItemBean>) customAttachLingxiWhichQuestion.options; questionList = (ArrayList<QuestionItemBean>) customAttachLingxiWhichQuestion.options;
} }
adapterLingxiWhichQuestion = new AdapterLingxiWhichQuestion();
for (int i = 0; i < questionList.size(); i++) { for (int i = 0; i < questionList.size(); i++) {
questionList.get(i).setSelected(false); questionList.get(i).setSelected(false);
if (questionList.get(i).getName().length() > 5) { if (questionList.get(i).getName().length() > 5) {
...@@ -124,35 +114,26 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -124,35 +114,26 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
} }
} }
if (customAttachLingxiWhichQuestion.type != null) { if (customAttachLingxiWhichQuestion.type != null) {
switch (customAttachLingxiWhichQuestion.type) { singleOrMultipletype=customAttachLingxiWhichQuestion.type;
case "radio"://您想要咨询下列哪类的问题?(单选)
if (questionList != null && questionList.size() != 0) {
initSingleChoice();
}
break;
case "check"://请问是发生了什么事情导致的呢?(多选)
initMultipleChoice(); initMultipleChoice();
break;
default:
break;
}
} }
//进入消息列表时候,保存当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) {
for (IMMessage msg : param) { for (IMMessage msg : param) {
MsgAttachment attachment = msg.getAttachment(); MsgAttachment attachment = msg.getAttachment();
if (attachment instanceof CustomAttachLingxiAnswerQuestion) { if (attachment instanceof CustomAttachLingxiAnswerQuestion) {
CustomAttachLingxiAnswerQuestion customattachlingxianswerquestion = (CustomAttachLingxiAnswerQuestion) attachment; CustomAttachLingxiAnswerQuestion customattachlingxianswerquestion = (CustomAttachLingxiAnswerQuestion) attachment;
Map map1 = msg.getLocalExtension();
map1 = new HashMap();
if (!map1.containsKey(customattachlingxianswerquestion.questionId)){
map1.put(customattachlingxianswerquestion.questionId, true); map1.put(customattachlingxianswerquestion.questionId, true);
}
mapMessageFromCustom=map1; mapMessageFromCustom=map1;
UpdateFromLocalExtention(); UpdateFromLocalExtention();
LogUtil.e("aaaaaquestionID:"+customattachlingxianswerquestion.questionId);
}else{
//用户没有回答问题;
} }
} }
} }
...@@ -181,18 +162,26 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -181,18 +162,26 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
} }
if (mapMessage != null) { if (mapMessage != null) {
Object questionPaperId=mapMessage.get(customAttachLingxiWhichQuestion.questionPaperId); Object questionPaperId=mapMessage.get(customAttachLingxiWhichQuestion.id);
LogUtil.e("aaaaaIDIDI:"+customAttachLingxiWhichQuestion.id);
if (questionPaperId != null) { if (questionPaperId != null) {
boolean b = (boolean) questionPaperId; boolean b = (boolean) questionPaperId;
if (b) { if (b) {
//隐藏回答的信息 //隐藏回答的信息
if (singleOrMultipletype.contains("radio")){
recycleviewWhichQuestion.setVisibility(View.GONE);
}else{
recycleviewMultipleChoice.setVisibility(View.GONE); recycleviewMultipleChoice.setVisibility(View.GONE);
confirm_multiple_choice.setVisibility(View.GONE); confirm_multiple_choice.setVisibility(View.GONE);
}else{
recycleviewMultipleChoice.setVisibility(View.VISIBLE);
confirm_multiple_choice.setVisibility(View.VISIBLE);
} }
}else{
//隐藏回答的信息
if (singleOrMultipletype.contains("radio")){
recycleviewMultipleChoice.setVisibility(View.VISIBLE);
}else{
recycleviewMultipleChoice.setVisibility(View.VISIBLE);
confirm_multiple_choice.setVisibility(View.VISIBLE);
} }
} }
} }
...@@ -203,7 +192,11 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -203,7 +192,11 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
} }
private void initMultipleChoice() { private void initMultipleChoice() {
if (singleOrMultipletype.contains("radio")){
confirm_multiple_choice.setVisibility(View.GONE);
}else{
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,
...@@ -222,27 +215,34 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -222,27 +215,34 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
recycleviewMultipleChoice.setAdapter(adapterLingxiMultipleChoice); recycleviewMultipleChoice.setAdapter(adapterLingxiMultipleChoice);
} }
private void initSingleChoice() {
which_question_title.setText(customAttachLingxiWhichQuestion.name);
adapterLingxiWhichQuestion.setTagData(questionList, isSingleChoice); /*
adapterLingxiWhichQuestion.setItemListener(this); * 用户回答问题接口
GridLayoutManager gridLayoutManager = new GridLayoutManager(context, 2); * */
//当list中字段大于6个显示单行,否则显示双行 private void answerLingxiQuestion(String examID, String questionPaperId, String uid, String questionId, ArrayList<AnswersItem> answersItems) {
gridLayoutManager.setSpanCount(isSingleChoice ? 1 : 2); String str = new Gson().toJson(new LingxiAnswerBean(new AnswerBean(examID, questionPaperId, uid, questionId, answersItems), uid, "56", message.getFromAccount()));
gridLayoutManager.setOrientation(GridLayoutManager.VERTICAL); RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str);
recycleviewWhichQuestion.setLayoutManager(gridLayoutManager); Disposable subscribe = ImRetrofitApi.Companion.getImRetrofitApi().lingxiAnswerQuestion(body)
recycleviewWhichQuestion.setAdapter(adapterLingxiWhichQuestion); .compose(RxUtils.INSTANCE.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(it -> {
LogUtil.e("answerQuestion" + it.toString());
}, throwable ->
LogUtil.e(throwable.getMessage())
);
} }
@Override
public void onItemClick(@NotNull QuestionItemBean itemBean, int position) {
@Override
public void onMultipleItemClick(@NotNull QuestionItemBean string, int position) {
if (singleOrMultipletype.contains("radio")){
/* /*
* 单选题:分其他选项和非其他选项 * 单选题:分其他选项和非其他选项
* 其他选项,唤起输入框 * 其他选项,唤起输入框
* 点击非其他选项直接发送答案 * 点击非其他选项直接发送答案
* */ * */
if (isClickable) {
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) {
...@@ -265,7 +265,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -265,7 +265,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
} }
questionList.get(i).setSelected(i == position); questionList.get(i).setSelected(i == position);
} }
adapterLingxiWhichQuestion.setTagData(questionList, isSingleChoice); 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();
...@@ -293,30 +293,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -293,30 +293,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
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));
} }
} }else{
}
/*
* 用户回答问题接口
* */
private void answerLingxiQuestion(String examID, String questionPaperId, String uid, String questionId, ArrayList<AnswersItem> answersItems) {
String str = new Gson().toJson(new LingxiAnswerBean(new AnswerBean(examID, questionPaperId, uid, questionId, answersItems), uid, "56", message.getFromAccount()));
RequestBody body = RequestBody.create(MediaType.parse("application/json; charset=utf-8"), str);
Disposable subscribe = ImRetrofitApi.Companion.getImRetrofitApi().lingxiAnswerQuestion(body)
.compose(RxUtils.INSTANCE.resultJavaData())
.subscribeOn(Schedulers.io())
.observeOn(AndroidSchedulers.mainThread())
.subscribe(it -> {
LogUtil.e("answerQuestion" + it.toString());
}, throwable ->
LogUtil.e(throwable.getMessage())
);
}
@Override
public void onMultipleItemClick(@NotNull QuestionItemBean string, int position) {
if (isClickable){
//多选发送消息 //多选发送消息
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()) {
...@@ -362,6 +339,8 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen ...@@ -362,6 +339,8 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
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) {
......
...@@ -285,8 +285,13 @@ public class MessageListPanelEx { ...@@ -285,8 +285,13 @@ public class MessageListPanelEx {
} }
if (needRefresh) { if (needRefresh) {
sortMessages(items); sortMessages(items);
new Handler().post(new Runnable() {
@Override
public void run() {
adapter.notifyDataSetChanged(); adapter.notifyDataSetChanged();
} }
});
}
adapter.updateShowTimeItem(addedListItems, false, true); adapter.updateShowTimeItem(addedListItems, false, true);
......
...@@ -13,6 +13,6 @@ ...@@ -13,6 +13,6 @@
android:includeFontPadding="false" android:includeFontPadding="false"
android:lineSpacingExtra="3dip" android:lineSpacingExtra="3dip"
android:minHeight="40dp" android:minHeight="40dp"
android:textColor="@color/white" android:textColor="@color/im_color_242424"
android:textSize="17dp"/> android:textSize="17dp"/>
</LinearLayout> </LinearLayout>
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