Commit d6ce4af1 by YKai

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

# Conflicts:
#	m-im/src/main/java/com/yidianling/uikit/business/session/view/QuestionInformationView.kt
#	m-im/src/main/res_uikit/layout/im_view_question_infomation.xml
parents 599eaae4 5a40b1e4
package com.yidianling.uikit.business.session.view.question; package com.yidianling.uikit.business.session.view.question;
import android.graphics.Color;
import android.text.SpannableString;
import android.text.Spanned;
import android.text.style.ForegroundColorSpan;
import android.view.View; import android.view.View;
import android.widget.ImageView; import android.widget.ImageView;
import android.widget.TextView; import android.widget.TextView;
import androidx.core.content.ContextCompat;
import androidx.recyclerview.widget.GridLayoutManager; import androidx.recyclerview.widget.GridLayoutManager;
import androidx.recyclerview.widget.RecyclerView; import androidx.recyclerview.widget.RecyclerView;
...@@ -39,6 +44,8 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem ...@@ -39,6 +44,8 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
addItemType(3, R.layout.item_left_one_check_layout); addItemType(3, R.layout.item_left_one_check_layout);
//左----多选 //左----多选
addItemType(4, R.layout.item_left_more_check_layout); addItemType(4, R.layout.item_left_more_check_layout);
//左----描述题
addItemType(5, R.layout.item_left_describe_layout);
} }
...@@ -65,45 +72,50 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem ...@@ -65,45 +72,50 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
break; break;
case 3: case 3:
//单选 //单选
RecyclerView OneRecycle = helper.getView(R.id.tv_one_list); convertType3(helper, item);
TextView oneTitle = helper.getView(R.id.multiple_choice_title);
oneTitle.setText(item.questionsBean.name);
int oneMaxSize = 0;
for (OptionsBean option : item.questionsBean.options) {
int length = option.name.length();
if (length > mTextMaxSize) {
oneMaxSize = length;
break; break;
} else if (oneMaxSize < length) { case 4:
oneMaxSize = option.name.length(); //多选
} convertType4(helper, item);
}
GridLayoutManager gridLayoutManager = new GridLayoutManager(AVChatKit.getContext(), oneMaxSize > mTextMaxSize ? 1 : 2); break;
OneRecycle.setLayoutManager(gridLayoutManager); case 5:
QuestionOneCheckAdapter oneCheckAdapter = new QuestionOneCheckAdapter(item.questionsBean.options); helper.setText(R.id.multiple_choice_title, item.type5Bean.question);
OneRecycle.setAdapter(oneCheckAdapter); helper.setText(R.id.example, item.type5Bean.example);
oneCheckAdapter.setOnItemClickListener(new OnItemClickListener() { SpannableString spannableString = new SpannableString(mContext.getResources().getString(R.string.question_notes));
spannableString.setSpan(new ForegroundColorSpan(Color.parseColor("#1DA1F2")), 28, spannableString.length(), Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
helper.setText(R.id.tv_notes, spannableString);
View line = helper.getView(R.id.line);
TextView example = helper.getView(R.id.example);
if (example.getVisibility() == View.GONE) {
line.setVisibility(View.VISIBLE);
example.setVisibility(View.VISIBLE);
} else {
line.setVisibility(View.GONE);
example.setVisibility(View.GONE);
}
helper.setOnClickListener(R.id.tv_notes, new View.OnClickListener() {
@Override @Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) { public void onClick(View v) {
List<OptionsBean> data = oneCheckAdapter.getData(); if (example.getVisibility() == View.GONE) {
if ("其他".equals(data.get(position).name)) { line.setVisibility(View.VISIBLE);
List<OptionsBean> checkList = getCheckOptionsBeans(oneCheckAdapter); example.setVisibility(View.VISIBLE);
mOneCheckListener.showOtherEdit(checkList); } else {
}else { line.setVisibility(View.GONE);
for (OptionsBean datum : data) { example.setVisibility(View.GONE);
if (datum.check) {
return;
}
}
oneCheckAdapter.getData().get(position).check = true;
oneCheckAdapter.notifyDataSetChanged();
mOneCheckListener.itemClick(data.get(position),item.questionsBean.id);
} }
} }
}); });
break; break;
case 4: default:
//多选 break;
}
}
private void convertType4(BaseViewHolder helper, QuestionMultiItem item) {
RecyclerView moreRecycle = helper.getView(R.id.tv_more_list); RecyclerView moreRecycle = helper.getView(R.id.tv_more_list);
TextView tv_more_define = helper.getView(R.id.tv_more_define); TextView tv_more_define = helper.getView(R.id.tv_more_define);
TextView moreTitle = helper.getView(R.id.more_title); TextView moreTitle = helper.getView(R.id.more_title);
...@@ -126,27 +138,85 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem ...@@ -126,27 +138,85 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
moreCheckAdapter.setOnItemClickListener(new OnItemClickListener() { moreCheckAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override @Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) { public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
if (item.type4CanClick) {
OptionsBean optionsBean = moreCheckAdapter.getData().get(position); OptionsBean optionsBean = moreCheckAdapter.getData().get(position);
boolean check = optionsBean.check;
moreCheckAdapter.getData().get(position).check = !check;
if ("其他".equals(optionsBean.name)) { if ("其他".equals(optionsBean.name)) {
List<OptionsBean> checkList = getCheckOptionsBeans(moreCheckAdapter); List<OptionsBean> checkList = getCheckOptionsBeans(moreCheckAdapter);
mOneCheckListener.showOtherEdit(checkList);
mOneCheckListener.showOtherEdit(checkList, item.questionsBean.id);
return;
}
boolean check = optionsBean.check;
if (check) {
moreCheckAdapter.getData().get(position).check = false;
} else {
moreCheckAdapter.getData().get(position).check = true;
}
moreCheckAdapter.notifyDataSetChanged();
if (getCheckOptionsBeans(moreCheckAdapter).size() > 0) {
tv_more_define.setBackground(ContextCompat.getDrawable(mContext, R.drawable.im_background_18dp_1da1f2));
tv_more_define.setEnabled(true);
tv_more_define.setText("确定(" + getCheckOptionsBeans(moreCheckAdapter).size() + ")");
} else {
tv_more_define.setBackground(ContextCompat.getDrawable(mContext, R.drawable.im_background_18dp_ebebeb));
tv_more_define.setEnabled(false);
tv_more_define.setText("确定");
} }
} }
}
}); });
tv_more_define.setOnClickListener(new View.OnClickListener() { tv_more_define.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
if (item.type4CanClick) {
List<OptionsBean> checkList = getCheckOptionsBeans(moreCheckAdapter); List<OptionsBean> checkList = getCheckOptionsBeans(moreCheckAdapter);
mOneCheckListener.moreDefineItemClick(checkList); mOneCheckListener.moreDefineItemClick(checkList, item.questionsBean.id);
}
} }
}); });
}
private void convertType3(BaseViewHolder helper, QuestionMultiItem item) {
RecyclerView OneRecycle = helper.getView(R.id.tv_one_list);
TextView oneTitle = helper.getView(R.id.multiple_choice_title);
oneTitle.setText(item.questionsBean.name);
int oneMaxSize = 0;
for (OptionsBean option : item.questionsBean.options) {
int length = option.name.length();
if (length > mTextMaxSize) {
oneMaxSize = length;
break; break;
default: } else if (oneMaxSize < length) {
break; oneMaxSize = option.name.length();
}
}
GridLayoutManager gridLayoutManager = new GridLayoutManager(AVChatKit.getContext(), oneMaxSize > mTextMaxSize ? 1 : 2);
OneRecycle.setLayoutManager(gridLayoutManager);
QuestionOneCheckAdapter oneCheckAdapter = new QuestionOneCheckAdapter(item.questionsBean.options);
OneRecycle.setAdapter(oneCheckAdapter);
oneCheckAdapter.setOnItemClickListener(new OnItemClickListener() {
@Override
public void onItemClick(BaseQuickAdapter adapter, View view, int position) {
List<OptionsBean> data = oneCheckAdapter.getData();
if ("其他".equals(data.get(position).name)) {
List<OptionsBean> checkList = getCheckOptionsBeans(oneCheckAdapter);
mOneCheckListener.showOtherEdit(checkList, item.questionsBean.id);
} else {
for (OptionsBean datum : data) {
if (datum.check) {
return;
}
} }
oneCheckAdapter.getData().get(position).check = true;
oneCheckAdapter.notifyDataSetChanged();
mOneCheckListener.itemClick(data.get(position), item.questionsBean.id);
}
}
});
} }
private List<OptionsBean> getCheckOptionsBeans(QuestionOneCheckAdapter moreCheckAdapter) { private List<OptionsBean> getCheckOptionsBeans(QuestionOneCheckAdapter moreCheckAdapter) {
......
...@@ -2,11 +2,12 @@ package com.yidianling.uikit.business.session.view.question; ...@@ -2,11 +2,12 @@ package com.yidianling.uikit.business.session.view.question;
import com.chad.library.adapter.base.entity.MultiItemEntity; import com.chad.library.adapter.base.entity.MultiItemEntity;
import com.yidianling.uikit.custom.http.response.question.QuestionsBean; import com.yidianling.uikit.custom.http.response.question.QuestionsBean;
import com.yidianling.uikit.custom.http.response.question.QuestionsBeanExample;
/** /**
* Created by hzchenkang on 2017/6/21. * @author liupeng
*/ */
public class QuestionMultiItem implements MultiItemEntity { public class QuestionMultiItem implements MultiItemEntity {
public int viewType; public int viewType;
...@@ -15,6 +16,9 @@ public class QuestionMultiItem implements MultiItemEntity { ...@@ -15,6 +16,9 @@ public class QuestionMultiItem implements MultiItemEntity {
public String type2Text; public String type2Text;
/***type 3 单选 type 4 多选 */ /***type 3 单选 type 4 多选 */
public QuestionsBean questionsBean; public QuestionsBean questionsBean;
public boolean type4CanClick;
public QuestionsBeanExample type5Bean;
@Override @Override
......
...@@ -6,15 +6,15 @@ interface QuestionOneCheckListener { ...@@ -6,15 +6,15 @@ interface QuestionOneCheckListener {
/** /**
* 单选点击获取item信息 * 单选点击获取item信息
*/ */
fun itemClick(bean: OptionsBean?,questionId:String) fun itemClick(bean: OptionsBean?, questionId: String)
/** /**
* 多选确定按钮点击 * 多选确定按钮点击
*/ */
fun moreDefineItemClick(list: List<OptionsBean?>?) fun moreDefineItemClick(list: List<OptionsBean?>?, questionId: String)
/** /**
* 展示其他 * 展示其他
*/ */
fun showOtherEdit(list: List<OptionsBean?>?) fun showOtherEdit(list: List<OptionsBean?>?, questionId: String)
} }
\ No newline at end of file
...@@ -24,7 +24,7 @@ public class QuestionsBean { ...@@ -24,7 +24,7 @@ public class QuestionsBean {
public int isDeleted; public int isDeleted;
public String questionPaperId; public String questionPaperId;
public String category; public String category;
public int order; public String order;
public String name; public String name;
/***类型: /***类型:
* radio(单选) * radio(单选)
......
package com.yidianling.uikit.custom.http.response.question; package com.yidianling.uikit.custom.http.response.question;
import java.util.List; import java.util.List;
import java.util.Map;
public class QuestionsInfoBean { public class QuestionsInfoBean {
...@@ -21,19 +20,8 @@ public class QuestionsInfoBean { ...@@ -21,19 +20,8 @@ public class QuestionsInfoBean {
* question_chains : {"601128318581870592":{"id":"601145789934211072","create_time":"2021-06-12 17:39:50","update_time":"2021-06-12 17:41:31","question_paper_id":"601128023407726592","question_id":"601128318581870592","head":true,"options":{"601128318544121856":"601128931717812224"}}} * question_chains : {"601128318581870592":{"id":"601145789934211072","create_time":"2021-06-12 17:39:50","update_time":"2021-06-12 17:41:31","question_paper_id":"601128023407726592","question_id":"601128318581870592","head":true,"options":{"601128318544121856":"601128931717812224"}}}
* questions : {"601128318581870592":{"id":"601128318581870592","create_time":"2021-06-12 16:30:25","update_time":"2021-06-12 16:30:25","is_deleted":0,"question_paper_id":"601128023407726592","category":"pre_diagnosis","order":1,"name":"服药历","type":"radio","remarks":["请问你有服药史么?"],"options":[{"id":"601128318544121856","name":"1~3 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121857","name":"4~6 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121858","name":"7~9 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121859","name":"10~12 个月","relates":[{"category":"症状","name":"幻觉"}]}]},"601128931717812224":{"id":"601128931717812224","create_time":"2021-06-12 16:32:51","update_time":"2021-06-12 16:32:51","is_deleted":0,"question_paper_id":"601128023407726592","category":"pre_diagnosis","order":2,"name":"晚上睡觉会醒几次","type":"radio","remarks":["晚上睡觉会醒几次?"],"options":[{"id":"601128931680063488","name":"1~3 次","relates":[{"category":"症状","name":"思绪混乱"}]},{"id":"601128931680063489","name":"4~6 次","relates":[{"category":"症状","name":"思绪混乱"}]},{"id":"601128931680063490","name":"7~9 次","relates":[{"category":"症状","name":"思绪混乱"}]},{"id":"601128931680063491","name":"10~12 次","relates":[{"category":"症状","name":"思绪混乱"}]}]},"601129312090853376":{"id":"601129312090853376","create_time":"2021-06-12 16:34:22","update_time":"2021-06-12 16:34:22","is_deleted":0,"question_paper_id":"601128023407726592","category":"pre_diagnosis","order":3,"name":"有逃离的想法么?","type":"radio","remarks":["有逃离的想法么?"],"options":[{"id":"601129312040521728","name":"有","relates":[{"category":"症状","name":"妄想症"}]},{"id":"601129312040521729","name":"无","relates":[{"category":"症状","name":"妄想症"}]},{"id":"601129312040521730","name":"其他"}]}} * questions : {"601128318581870592":{"id":"601128318581870592","create_time":"2021-06-12 16:30:25","update_time":"2021-06-12 16:30:25","is_deleted":0,"question_paper_id":"601128023407726592","category":"pre_diagnosis","order":1,"name":"服药历","type":"radio","remarks":["请问你有服药史么?"],"options":[{"id":"601128318544121856","name":"1~3 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121857","name":"4~6 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121858","name":"7~9 个月","relates":[{"category":"症状","name":"幻觉"}]},{"id":"601128318544121859","name":"10~12 个月","relates":[{"category":"症状","name":"幻觉"}]}]},"601128931717812224":{"id":"601128931717812224","create_time":"2021-06-12 16:32:51","update_time":"2021-06-12 16:32:51","is_deleted":0,"question_paper_id":"601128023407726592","category":"pre_diagnosis","order":2,"name":"晚上睡觉会醒几次","type":"radio","remarks":["晚上睡觉会醒几次?"],"options":[{"id":"601128931680063488","name":"1~3 次","relates":[{"category":"症状","name":"思绪混乱"}]},{"id":"601128931680063489","name":"4~6 次","relates":[{"category":"症状","name":"思绪混乱"}]},{"id":"601128931680063490","name":"7~9 次","relates":[{"category":"症状","name":"思绪混乱"}]},{"id":"601128931680063491","name":"10~12 次","relates":[{"category":"症状","name":"思绪混乱"}]}]},"601129312090853376":{"id":"601129312090853376","create_time":"2021-06-12 16:34:22","update_time":"2021-06-12 16:34:22","is_deleted":0,"question_paper_id":"601128023407726592","category":"pre_diagnosis","order":3,"name":"有逃离的想法么?","type":"radio","remarks":["有逃离的想法么?"],"options":[{"id":"601129312040521728","name":"有","relates":[{"category":"症状","name":"妄想症"}]},{"id":"601129312040521729","name":"无","relates":[{"category":"症状","name":"妄想症"}]},{"id":"601129312040521730","name":"其他"}]}}
*/ */
public QuestionPaperBean questionPaper;
public List<QuestionsBeanExample> questions;
public String id;
public String createTime;
public String updateTime;
public int isDeleted;
public String category;
public String name;
public long cateId;
public String cateName;
public int questionNum;
public int status;
public String remark;
public Map<String, QuestionChainsBean> questionChains;
public Map<String, QuestionsBean> questions;
} }
...@@ -53,12 +53,13 @@ ...@@ -53,12 +53,13 @@
android:layout_width="110dp" android:layout_width="110dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="right" android:layout_gravity="right"
android:textColor="@color/white"
android:layout_marginTop="8dp" android:layout_marginTop="8dp"
android:background="@drawable/im_background_18dp_ebebeb" android:background="@drawable/im_background_18dp_ebebeb"
android:gravity="center" android:gravity="center"
android:paddingTop="@dimen/platform_dp_8" android:paddingTop="@dimen/platform_dp_8"
android:paddingBottom="@dimen/platform_dp_8" android:paddingBottom="@dimen/platform_dp_8"
android:text="确定(2)" android:text="确定"
android:textSize="@dimen/im_text_size_15"> android:textSize="@dimen/im_text_size_15">
</TextView> </TextView>
......
...@@ -245,5 +245,6 @@ ...@@ -245,5 +245,6 @@
<string name="im_chat_private_title">私聊须知</string> <string name="im_chat_private_title">私聊须知</string>
<string name="im_chat_pivate_content">如系统检测到涉黄、涉爆、涉政等信息,可能会封号处理并追究法律责任!</string> <string name="im_chat_pivate_content">如系统检测到涉黄、涉爆、涉政等信息,可能会封号处理并追究法律责任!</string>
<string name="im_video_play">视频播放</string> <string name="im_video_play">视频播放</string>
<string name="question_notes">注:描述中请包涵问题持续时间、问题发生原因、当前的问题。如何描述?</string>
</resources> </resources>
...@@ -60,7 +60,7 @@ ...@@ -60,7 +60,7 @@
android:background="@color/color_f8f8f8" android:background="@color/color_f8f8f8"
app:layout_constraintBottom_toTopOf="@id/cl_input" app:layout_constraintBottom_toTopOf="@id/cl_input"
app:layout_constraintTop_toTopOf="parent" app:layout_constraintTop_toTopOf="parent"
android:paddingBottom="50dp" android:paddingBottom="12dp"
app:layout_constraintVertical_weight="1" /> app:layout_constraintVertical_weight="1" />
<androidx.constraintlayout.widget.ConstraintLayout <androidx.constraintlayout.widget.ConstraintLayout
......
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