Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
Y
YDL-Component-Medical
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
杨凯
YDL-Component-Medical
Commits
8de7acb0
Commit
8de7acb0
authored
Jul 03, 2021
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
信息收集部分逻辑优化
parent
a50a6fe1
Hide whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
335 additions
and
186 deletions
+335
-186
config.gradle
config.gradle
+1
-1
AndroidManifest.xml
m-im/src/main/AndroidManifest.xml
+1
-0
IMChatUtil.kt
m-im/src/main/java/com/yidianling/im/helper/IMChatUtil.kt
+2
-2
CmsExamQuestionPaperActivity.kt
m-im/src/main/java/com/yidianling/im/ui/activity/CmsExamQuestionPaperActivity.kt
+236
-146
QuestionAdapter.java
m-im/src/main/java/com/yidianling/uikit/business/session/view/question/QuestionAdapter.java
+77
-33
QuestionMultiItem.java
m-im/src/main/java/com/yidianling/uikit/business/session/view/question/QuestionMultiItem.java
+3
-1
QuestionOneCheckListener.kt
m-im/src/main/java/com/yidianling/uikit/business/session/view/question/QuestionOneCheckListener.kt
+7
-0
QuestionsBean.java
m-im/src/main/java/com/yidianling/uikit/custom/http/response/question/QuestionsBean.java
+3
-0
QuestionsInfoBean.java
m-im/src/main/java/com/yidianling/uikit/custom/http/response/question/QuestionsInfoBean.java
+2
-1
im_view_question_infomation.xml
m-im/src/main/res_uikit/layout/im_view_question_infomation.xml
+3
-2
No files found.
config.gradle
View file @
8de7acb0
...
...
@@ -10,7 +10,7 @@ ext {
"m-fm"
:
"0.0.30.03"
,
"m-user"
:
"0.0.61.37"
,
"m-home"
:
"0.0.22.65"
,
"m-im"
:
"0.0.19.2
0
"
,
"m-im"
:
"0.0.19.2
5
"
,
"m-dynamic"
:
"0.0.7.22"
,
"m-article"
:
"0.0.0.10"
,
...
...
m-im/src/main/AndroidManifest.xml
View file @
8de7acb0
...
...
@@ -71,6 +71,7 @@
<activity
android:name=
".ui.activity.CmsExamQuestionPaperActivity"
android:screenOrientation=
"portrait"
android:launchMode=
"singleTask"
android:theme=
"@style/platform_NoTitleTheme"
/>
<!-- 云信 集成配置 -->
...
...
m-im/src/main/java/com/yidianling/im/helper/IMChatUtil.kt
View file @
8de7acb0
...
...
@@ -105,7 +105,7 @@ object IMChatUtil {
.
subscribe
({
res
:
BaseResponse
<
UserTypeBean
>
->
if
(
res
.
code
==
200
&&
res
.
data
!=
null
)
{
if
(
res
.
data
!!
.
collectEvent
&&
TextUtils
.
equals
(
res
.
data
!!
.
userType
,
USER_TYPE_ASSISTANT
.
toString
())
&&
res
.
data
!!
.
collectEvent
)
{
if
(
res
.
data
!!
.
collectEvent
&&
TextUtils
.
equals
(
res
.
data
!!
.
userType
,
USER_TYPE_ASSISTANT
.
toString
()))
{
//和助理私聊需要打开信息采集弹窗
prepareAssistantChatData
(
context
,
...
...
@@ -209,7 +209,7 @@ object IMChatUtil {
})
{
t
:
Throwable
?
->
handleError
(
context
,
t
!!
)
}
}
else
if
(
TextUtils
.
equals
(
res
.
data
!!
.
userType
,
USER_TYPE_ASSISTANT
.
toString
())
&&
res
.
data
!!
.
collectEvent
)
{
//助理
}
else
if
(
TextUtils
.
equals
(
res
.
data
!!
.
userType
,
USER_TYPE_ASSISTANT
.
toString
()))
{
//助理
prepareAssistantChatData
(
context
,
toUid
,
object
:
ChatDataRequestListener
{
override
fun
onSuccess
(
expertInfo
:
IMExpertBuild
)
{
//新前置信息收集入口
CmsExamQuestionPaperActivity
.
start
(
...
...
m-im/src/main/java/com/yidianling/im/ui/activity/CmsExamQuestionPaperActivity.kt
View file @
8de7acb0
...
...
@@ -56,7 +56,10 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
private
var
otherQuestionsBean
:
QuestionsBean
?
=
null
/**用于云信聊天界面添加数据使用*/
private
var
mType70RequestList
=
ArrayList
<
AnswerQuestionType70RequestBean
>();
private
var
mType70RequestList
=
ArrayList
<
AnswerQuestionType70RequestBean
>()
/**主诉消息*/
private
var
mType71RequestList
=
ArrayList
<
AnswerQuestionType71RequestBean
>()
/**题库*/
private
var
mQuestionBean
:
QuestionsInfoBean
?
=
null
...
...
@@ -71,6 +74,7 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
private
var
lastAnswer
=
""
private
var
noMore
=
false
private
var
haveLingxiQuestion
=
false
companion
object
{
private
lateinit
var
expertInfo
:
IMExpertBuild
...
...
@@ -92,11 +96,11 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
}
override
fun
initDataAndEvent
()
{
//
if (isJumpToIm()) {
//
//如果今天打过题,跳转到聊天界面
//
skipToIm()
//
return
//
}
if
(
isJumpToIm
())
{
//如果今天打过题,跳转到聊天界面
skipToIm
()
return
}
//初始化
initRecycle
()
//设置view事件
...
...
@@ -157,6 +161,14 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
hideInputMethod
(
et_input_problem
)
}
override
fun
zsItemClick
(
answer
:
String
,
postion
:
Int
)
{
//主诉
addType71Request
(
answer
)
mackType2
(
answer
)
makeType6
(
postion
+
1
)
}
})
mQuestionAdapter
.
setOnItemChildClickListener
{
adapter
,
view
,
position
->
...
...
@@ -195,43 +207,17 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
showSkipDialog
()
}
tv_finish
.
setOnClickListener
{
mType70RequestList
.
forEach
{
instance
.
lingxiAnswerQuestion
(
JSON
.
toJSONString
(
it
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
Schedulers
.
io
())
.
subscribe
()
}
val
answerQuestionType71RequestBean
=
AnswerQuestionType71RequestBean
()
val
dataBean
=
AnswerQuestionType71RequestBean
.
DataBean
()
dataBean
.
answer
=
lastAnswer
answerQuestionType71RequestBean
.
data
=
dataBean
answerQuestionType71RequestBean
.
toUid
=
toUid
answerQuestionType71RequestBean
.
fromUid
=
ImIn
.
getUserInfo
()
?.
uid
instance
.
lingxiAnswerQuestion
(
JSON
.
toJSONString
(
answerQuestionType71RequestBean
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
Schedulers
.
io
())
.
subscribe
()
Handler
().
postDelayed
({
skipToIm
()
},
500L
)
skipToIm
()
}
tv_send
.
setOnClickListener
{
if
(
noMore
)
{
//最后一题 点击发送
lastAnswer
=
et_input_problem
.
text
.
toString
()
tv_finish
.
visibility
=
View
.
VISIBLE
addType71Request
(
et_input_problem
.
text
.
toString
())
val
questionMultiItem
=
QuestionMultiItem
()
questionMultiItem
.
type2Text
=
lastAnswer
questionMultiItem
.
viewType
=
2
mData
.
add
(
questionMultiItem
)
mQuestionAdapter
.
notifyDataSetChanged
()
tv_finish
.
visibility
=
View
.
VISIBLE
mackType2
(
lastAnswer
)
//滑动到底部
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
mData
.
forEachIndexed
{
index
,
_
->
...
...
@@ -386,70 +372,14 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
}
mData
.
add
(
questionMultiItem2
)
}
else
{
//没有下一题了,展示描述题
val
questionMultiItem5
=
QuestionMultiItem
()
questionMultiItem5
.
type5Bean
=
mQuestionBean
!!
.
questions
[
1
]
questionMultiItem5
.
viewType
=
5
mData
.
add
(
questionMultiItem5
)
//最后一提,
noMore
=
true
//显示输入框
cl_input
.
visibility
=
LinearLayout
.
VISIBLE
tv_problem
.
visibility
=
LinearLayout
.
GONE
hsv_problem_tips
.
visibility
=
LinearLayout
.
VISIBLE
et_input_problem
.
hint
=
"请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod
(
et_input_problem
)
// 滚动到底部
Handler
().
postDelayed
({
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
},
500L
)
//没有下一题了,跳转按钮展示
tv_finish
.
visibility
=
View
.
VISIBLE
}
mQuestionAdapter
.
notifyDataSetChanged
()
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
}
/**
* 创建回答问题 并刷新多选状态为不可选
* @param otherInput 点击其他输入文字
* */
private
fun
sendAnswerText
(
list
:
List
<
OptionsBean
>,
otherInput
:
String
)
{
var
answerStr
=
""
list
.
forEach
{
if
(
answerStr
.
isNotEmpty
())
{
answerStr
=
if
(
"其他"
==
it
.
name
)
{
"$answerStr、$otherInput"
}
else
{
answerStr
+
"、"
+
it
.
name
}
}
else
{
answerStr
+=
if
(
"其他"
==
it
.
name
)
{
otherInput
}
else
{
it
.
name
}
}
}
val
questionMultiItem
=
QuestionMultiItem
()
questionMultiItem
.
type2Text
=
answerStr
questionMultiItem
.
viewType
=
2
mData
.
add
(
questionMultiItem
)
mQuestionAdapter
.
notifyDataSetChanged
()
//刷新已回答问题,将多选设置成不可再选
mData
.
forEachIndexed
{
index
,
_
->
mData
[
index
].
type4CanClick
=
false
}
}
/**
* 回答单选问题
* @param question 问题
* @param list 选中回答的选项list
...
...
@@ -461,34 +391,12 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
list
:
List
<
OptionsBean
>,
otherInput
:
String
)
{
val
answerQuestionRequestBean
=
AnswerQuestionRequestBean
()
answerQuestionRequestBean
.
examId
=
answerQuestionId
answerQuestionRequestBean
.
questionId
=
question
.
id
answerQuestionRequestBean
.
questionPaperId
=
question
.
questionPaperId
answerQuestionRequestBean
.
uid
=
ImIn
.
getUserInfo
()
?.
uid
var
answersBeanList
=
ArrayList
<
AnswersBean
>()
for
(
optionsBean
in
list
)
{
var
answersBean
=
AnswersBean
()
answersBean
.
name
=
optionsBean
.
name
answersBean
.
optionId
=
optionsBean
.
id
answersBean
.
relates
=
optionsBean
.
relates
if
(
"其他"
==
optionsBean
.
name
&&
otherInput
.
isNotEmpty
())
{
answersBean
.
other
=
otherInput
}
answersBeanList
.
add
(
answersBean
)
}
answerQuestionRequestBean
.
answers
=
answersBeanList
val
type70RequestBean
=
AnswerQuestionType70RequestBean
()
type70RequestBean
.
data
=
answerQuestionRequestBean
type70RequestBean
.
fromUid
=
ImIn
.
getUserInfo
()
?.
uid
type70RequestBean
.
toUid
=
toUid
//添加回答数据到
mType70RequestList
.
add
(
type70RequestBean
)
//回答问题参数创建
val
answerQuestionRequestBean
=
answerQuestionRequestBean
(
question
,
list
,
otherInput
)
//灵犀消息 参数创建
addType70Request
(
answerQuestionRequestBean
)
//请求接口 回答问题
instance
.
answerQuestion
(
answerQuestionId
,
JSON
.
toJSONString
(
answerQuestionRequestBean
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
...
...
@@ -511,10 +419,17 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
//设置数据,清空list数据
mData
.
clear
()
//取到问候语
getFirstQuestion
(
resp
.
data
)
getFirstQuestion
()
//取出第二条消息
setSecondQuestion
()
createExams
()
if
(
resp
.
data
.
questions
.
size
>
0
)
{
haveLingxiQuestion
=
true
setSecondQuestionByLx
()
createExams
()
}
else
{
haveLingxiQuestion
=
false
makeType6
(
0
)
}
}
else
{
//无答题数据,跳转到聊天界面
IMChatUtil
.
startChatSessionByCms
(
...
...
@@ -554,48 +469,207 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
})
}
/***取到问候语*/
private
fun
getFirstQuestion
(
questionInfo
:
QuestionsInfoBean
)
{
/***
* 取到问候语
* */
private
fun
getFirstQuestion
()
{
val
questionMultiItem
=
QuestionMultiItem
()
questionMultiItem
.
type1Text
=
questionInfo
.
questions
[
0
].
question
questionMultiItem
.
type1Text
=
"你好,为了更好的帮助您我们需要了解些基本信息,我们将会严格保护你的隐私安全,请放心。"
questionMultiItem
.
viewType
=
1
mData
.
add
(
questionMultiItem
)
mQuestionAdapter
.
notifyDataSetChanged
()
}
/***问候语之后第一道题*/
private
fun
setSecondQuestion
()
{
/***问候语之后
灵犀
第一道题*/
private
fun
setSecondQuestion
ByLx
()
{
val
questionMultiItem2
=
QuestionMultiItem
()
mQuestionBean
!!
.
questionPaper
.
questionChains
.
forEach
{
(
k
,
v
)
->
if
(
v
.
head
)
{
// 代表第一题 ,使用questionId 去questions取到对应的提
val
questionsBean
=
mQuestionBean
!!
.
questionPaper
.
questions
[
v
.
questionId
]
questionMultiItem2
.
questionsBean
=
questionsBean
if
(
"radio"
==
questionsBean
?.
type
)
{
questionMultiItem2
.
viewType
=
3
}
else
{
questionMultiItem2
.
viewType
=
4
questionMultiItem2
.
type4CanClick
=
true
}
mData
.
add
(
questionMultiItem2
)
mQuestionAdapter
.
notifyDataSetChanged
()
makeType3OrType4
(
v
,
questionMultiItem2
)
return
@forEach
}
}
}
/**
* 创建回答问题 并刷新多选状态为不可选
* @param otherInput 点击其他输入文字
* */
private
fun
sendAnswerText
(
list
:
List
<
OptionsBean
>,
otherInput
:
String
)
{
var
answerStr
=
""
list
.
forEach
{
answerStr
=
"$answerStr#${it.name}"
}
if
(
otherInput
.
isNotEmpty
())
{
answerStr
=
"$answerStr \n \n otherInput"
}
mackType2
(
answerStr
)
//刷新已回答问题,将多选设置成不可再选
mData
.
forEachIndexed
{
index
,
_
->
mData
[
index
].
type4CanClick
=
false
}
}
/**
* 创建消息类型2
*
* @param answerStr 用户展示的文字回复
* */
private
fun
mackType2
(
answerStr
:
String
)
{
val
questionMultiItem
=
QuestionMultiItem
()
questionMultiItem
.
type2Text
=
answerStr
questionMultiItem
.
viewType
=
2
mData
.
add
(
questionMultiItem
)
mQuestionAdapter
.
notifyDataSetChanged
()
}
/**
* 创建消息类型3 类型4
* */
private
fun
makeType3OrType4
(
questionChain
:
QuestionChainsBean
,
questionMultiItem2
:
QuestionMultiItem
)
{
val
questionsBean
=
mQuestionBean
!!
.
questionPaper
.
questions
[
questionChain
.
questionId
]
questionMultiItem2
.
questionsBean
=
questionsBean
if
(
"radio"
==
questionsBean
?.
type
)
{
questionMultiItem2
.
viewType
=
3
}
else
{
questionMultiItem2
.
viewType
=
4
questionMultiItem2
.
type4CanClick
=
true
}
mData
.
add
(
questionMultiItem2
)
mQuestionAdapter
.
notifyDataSetChanged
()
}
/**最后一条道题*/
private
fun
makeType5
()
{
val
questionMultiItem5
=
QuestionMultiItem
()
questionMultiItem5
.
type5Bean
=
mQuestionBean
!!
.
questions
[
0
]
questionMultiItem5
.
viewType
=
5
mData
.
add
(
questionMultiItem5
)
//最后一提,
noMore
=
true
//显示输入框
cl_input
.
visibility
=
LinearLayout
.
VISIBLE
tv_problem
.
visibility
=
LinearLayout
.
GONE
hsv_problem_tips
.
visibility
=
LinearLayout
.
VISIBLE
et_input_problem
.
hint
=
"请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod
(
et_input_problem
)
// 滚动到底部
Handler
().
postDelayed
({
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
},
500L
)
}
/***
*
* 问候语之后 主诉题消息创建
*
* */
private
fun
makeType6
(
position
:
Int
)
{
val
extraQuestions
=
mQuestionBean
!!
.
extraQuestions
if
(
position
<
extraQuestions
.
size
)
{
// 代表第一题 ,使用questionId 去questions取到对应的提
val
questionMultiItem2
=
QuestionMultiItem
()
val
questionsBean
=
mQuestionBean
!!
.
extraQuestions
[
position
]
questionMultiItem2
.
questionsBean
=
questionsBean
questionMultiItem2
.
type6Position
=
position
questionMultiItem2
.
viewType
=
6
mData
.
add
(
questionMultiItem2
)
mQuestionAdapter
.
notifyDataSetChanged
()
}
else
{
makeType5
()
}
}
/**
* 创建 回答问题参数
* */
private
fun
answerQuestionRequestBean
(
question
:
QuestionsBean
,
list
:
List
<
OptionsBean
>,
otherInput
:
String
):
AnswerQuestionRequestBean
{
val
answerQuestionRequestBean
=
AnswerQuestionRequestBean
()
answerQuestionRequestBean
.
examId
=
answerQuestionId
answerQuestionRequestBean
.
questionId
=
question
.
id
answerQuestionRequestBean
.
questionPaperId
=
question
.
questionPaperId
answerQuestionRequestBean
.
uid
=
ImIn
.
getUserInfo
()
?.
uid
var
answersBeanList
=
ArrayList
<
AnswersBean
>()
for
(
optionsBean
in
list
)
{
var
answersBean
=
AnswersBean
()
answersBean
.
name
=
optionsBean
.
name
answersBean
.
optionId
=
optionsBean
.
id
answersBean
.
relates
=
optionsBean
.
relates
if
(
"其他"
==
optionsBean
.
name
&&
otherInput
.
isNotEmpty
())
{
answersBean
.
other
=
otherInput
}
answersBeanList
.
add
(
answersBean
)
}
answerQuestionRequestBean
.
answers
=
answersBeanList
return
answerQuestionRequestBean
}
/**
* 创建灵犀消息参数
* */
private
fun
addType70Request
(
answerQuestionRequestBean
:
AnswerQuestionRequestBean
)
{
val
type70RequestBean
=
AnswerQuestionType70RequestBean
()
type70RequestBean
.
data
=
answerQuestionRequestBean
type70RequestBean
.
fromUid
=
ImIn
.
getUserInfo
()
?.
uid
type70RequestBean
.
toUid
=
toUid
//添加回答数据到
mType70RequestList
.
add
(
type70RequestBean
)
}
/**
* 创建主诉消息参数
* */
private
fun
addType71Request
(
answer
:
String
)
{
val
answerQuestionType71RequestBean
=
AnswerQuestionType71RequestBean
()
val
dataBean
=
AnswerQuestionType71RequestBean
.
DataBean
()
dataBean
.
answer
=
answer
answerQuestionType71RequestBean
.
data
=
dataBean
answerQuestionType71RequestBean
.
toUid
=
toUid
answerQuestionType71RequestBean
.
fromUid
=
ImIn
.
getUserInfo
()
?.
uid
mType71RequestList
.
add
(
answerQuestionType71RequestBean
)
}
/***
* 判断今天是否展示过
* */
private
fun
isJumpToIm
():
Boolean
{
val
time
=
Calendar
.
getInstance
()[
Calendar
.
YEAR
].
toString
()
+
"-"
+
Calendar
.
getInstance
()[
Calendar
.
MONTH
]
+
Calendar
.
getInstance
()[
Calendar
.
DAY_OF_MONTH
]
return
TextUtils
.
equals
(
time
,
SharedPreferencesEditor
.
getString
(
"skip_time_"
+
ImIn
.
getUserInfo
()
?.
uid
)
)
val
time
=
System
.
currentTimeMillis
()
val
skipTime
=
SharedPreferencesEditor
.
getString
(
"skip_time_"
)
if
(
skipTime
==
null
||
skipTime
.
isEmpty
())
{
return
false
}
val
timeDifference
=
time
-
skipTime
.
toLong
()
val
second
=
1000
val
minute
=
second
*
60
val
hour
=
minute
*
60
val
day
=
hour
*
24
return
timeDifference
>
2
*
second
}
/**
...
...
@@ -623,6 +697,22 @@ class CmsExamQuestionPaperActivity : BaseActivity() {
* 跳过,直接取IM界面
* */
private
fun
skipToIm
()
{
SharedPreferencesEditor
.
putString
(
"skip_time_"
,
System
.
currentTimeMillis
().
toString
())
mType70RequestList
.
forEach
{
instance
.
lingxiAnswerQuestion
(
JSON
.
toJSONString
(
it
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
Schedulers
.
io
())
.
subscribe
()
}
mType71RequestList
.
forEach
{
instance
.
lingxiAnswerQuestion
(
JSON
.
toJSONString
(
it
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
Schedulers
.
io
())
.
subscribe
()
}
IMChatUtil
.
startChatSessionByCms
(
toUid
,
expertInfo
,
isFromQingShu
,
this
@CmsExamQuestionPaperActivity
)
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/view/question/QuestionAdapter.java
View file @
8de7acb0
...
...
@@ -46,6 +46,8 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
addItemType
(
4
,
R
.
layout
.
item_left_more_check_layout
);
//左----描述题
addItemType
(
5
,
R
.
layout
.
item_left_describe_layout
);
//主诉----单选
addItemType
(
6
,
R
.
layout
.
item_left_one_check_layout
);
}
...
...
@@ -77,46 +79,88 @@ public class QuestionAdapter extends BaseMultiItemQuickAdapter<QuestionMultiItem
case
4
:
//多选
convertType4
(
helper
,
item
);
break
;
case
5
:
helper
.
setText
(
R
.
id
.
multiple_choice_title
,
item
.
type5Bean
.
question
);
helper
.
setText
(
R
.
id
.
example
,
item
.
type5Bean
.
example
);
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
);
convertType5
(
helper
,
item
);
break
;
case
6
:
convertType6
(
helper
,
item
);
break
;
default
:
break
;
}
}
/**
* 主诉消息
* */
private
void
convertType6
(
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
;
}
else
if
(
oneMaxSize
<
length
)
{
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
();
for
(
OptionsBean
datum
:
data
)
{
if
(
datum
.
check
)
{
//如果已有选项被选择,择不触发后续事件
return
;
}
}
oneCheckAdapter
.
getData
().
get
(
position
).
check
=
true
;
oneCheckAdapter
.
notifyDataSetChanged
();
mOneCheckListener
.
zsItemClick
(
data
.
get
(
position
).
name
,
item
.
type6Position
);
}
});
}
View
type5_line
=
helper
.
getView
(
R
.
id
.
type5_line
);
TextView
example
=
helper
.
getView
(
R
.
id
.
example
);
private
void
convertType5
(
BaseViewHolder
helper
,
QuestionMultiItem
item
)
{
helper
.
setText
(
R
.
id
.
multiple_choice_title
,
item
.
type5Bean
.
question
);
helper
.
setText
(
R
.
id
.
example
,
item
.
type5Bean
.
example
);
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
);
if
(
example
.
getVisibility
()
==
View
.
GONE
)
{
type5_line
.
setVisibility
(
View
.
VISIBLE
);
example
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
type5_line
.
setVisibility
(
View
.
GONE
);
example
.
setVisibility
(
View
.
GONE
);
}
if
(
item
.
type5Open
)
{
type5_line
.
setVisibility
(
View
.
VISIBLE
);
example
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
type5_line
.
setVisibility
(
View
.
GONE
);
example
.
setVisibility
(
View
.
GONE
);
}
if
(
item
.
type5CanClick
){
helper
.
getView
(
R
.
id
.
type5_parent
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
mOneCheckListener
.
showKeyboard
();
}
});
View
type5_line
=
helper
.
getView
(
R
.
id
.
type5_line
);
TextView
example
=
helper
.
getView
(
R
.
id
.
example
);
helper
.
addOnClickListener
(
R
.
id
.
tv_notes
);
if
(
example
.
getVisibility
()
==
View
.
GONE
)
{
type5_line
.
setVisibility
(
View
.
VISIBLE
);
example
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
type5_line
.
setVisibility
(
View
.
GONE
);
example
.
setVisibility
(
View
.
GONE
);
}
if
(
item
.
type5Open
)
{
type5_line
.
setVisibility
(
View
.
VISIBLE
);
example
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
type5_line
.
setVisibility
(
View
.
GONE
);
example
.
setVisibility
(
View
.
GONE
);
}
if
(
item
.
type5CanClick
)
{
helper
.
getView
(
R
.
id
.
type5_parent
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
mOneCheckListener
.
showKeyboard
();
}
});
break
;
default
:
break
;
helper
.
addOnClickListener
(
R
.
id
.
tv_notes
);
}
}
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/view/question/QuestionMultiItem.java
View file @
8de7acb0
...
...
@@ -14,7 +14,7 @@ public class QuestionMultiItem implements MultiItemEntity {
public
String
type1Text
;
public
String
type2Text
;
/***type 3 单选 type 4 多选 */
/***type 3 单选 type 4 多选
type 6
*/
public
QuestionsBean
questionsBean
;
public
boolean
type4CanClick
;
...
...
@@ -26,6 +26,8 @@ public class QuestionMultiItem implements MultiItemEntity {
/***type5 展开or 收起*/
public
boolean
type5Open
=
true
;
public
int
type6Position
;
@Override
public
int
getItemType
()
{
return
viewType
;
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/view/question/QuestionOneCheckListener.kt
View file @
8de7acb0
...
...
@@ -21,4 +21,10 @@ interface QuestionOneCheckListener {
* 隐藏其他
*/
fun
hideOtherEdit
()
/**
* 主诉单选点击 多选确定按钮点击获取item信息
*/
fun
zsItemClick
(
answer
:
String
,
postion
:
Int
)
}
\ No newline at end of file
m-im/src/main/java/com/yidianling/uikit/custom/http/response/question/QuestionsBean.java
View file @
8de7acb0
...
...
@@ -3,6 +3,9 @@ package com.yidianling.uikit.custom.http.response.question;
import
java.io.Serializable
;
import
java.util.List
;
/**
* @author liupeng
*/
public
class
QuestionsBean
implements
Serializable
{
/**
...
...
m-im/src/main/java/com/yidianling/uikit/custom/http/response/question/QuestionsInfoBean.java
View file @
8de7acb0
...
...
@@ -27,6 +27,7 @@ public class QuestionsInfoBean {
*/
public
QuestionPaperBean
questionPaper
;
public
List
<
QuestionsBeanExample
>
questions
;
//无数据的默认题
public
List
<
QuestionsBean
>
extraQuestions
;
}
m-im/src/main/res_uikit/layout/im_view_question_infomation.xml
View file @
8de7acb0
...
...
@@ -64,11 +64,12 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:id=
"@+id/cl_input"
android:layout_width=
"match_parent"
app:layout_constraintBottom_toTopOf=
"@id/tv_finish"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
tools:visibility=
"
visibl
e"
>
tools:visibility=
"
gon
e"
>
<TextView
android:id=
"@+id/tv_problem"
...
...
@@ -199,7 +200,7 @@
android:textSize=
"16sp"
android:visibility=
"gone"
app:layout_constraintBottom_toBottomOf=
"parent"
tools:visibility=
"
gon
e"
/>
tools:visibility=
"
visibl
e"
/>
</androidx.constraintlayout.widget.ConstraintLayout>
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment