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
1f960adc
Commit
1f960adc
authored
Jun 25, 2021
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:代码提交
parent
d6ce4af1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
97 additions
and
14 deletions
+97
-14
QuestionInformationView.kt
m-im/src/main/java/com/yidianling/uikit/business/session/view/QuestionInformationView.kt
+97
-14
No files found.
m-im/src/main/java/com/yidianling/uikit/business/session/view/QuestionInformationView.kt
View file @
1f960adc
...
...
@@ -18,9 +18,6 @@ import androidx.recyclerview.widget.LinearLayoutManager
import
androidx.recyclerview.widget.RecyclerView
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.view.dialog.CommonDialog
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxKeyboardTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.R
import
com.yidianling.listener.SoftKeyBoardListener
import
com.yidianling.uikit.business.session.view.question.QuestionAdapter
...
...
@@ -49,7 +46,7 @@ class QuestionInformationView(
)
:
LinearLayout
(
mContext
)
{
private
var
dialog
:
CommonDialog
?
=
null
private
lateinit
var
mQuestionAdapter
:
QuestionAdapter
private
var
mQuestionAdapter
:
QuestionAdapter
private
var
mData
=
ArrayList
<
QuestionMultiItem
>();
private
var
mQuestionBean
:
QuestionsInfoBean
?
=
null
private
var
problemContent
=
""
...
...
@@ -78,20 +75,21 @@ class QuestionInformationView(
recycle
.
adapter
=
mQuestionAdapter
mQuestionAdapter
.
setOneCheckListener
(
object
:
QuestionOneCheckListener
{
override
fun
itemClick
(
bean
:
OptionsBean
?,
questionId
:
String
)
{
val
questionMultiItem
=
QuestionMultiItem
()
questionMultiItem
.
type2Text
=
bean
?.
name
questionMultiItem
.
viewType
=
2
mData
.
add
(
questionMultiItem
)
mQuestionAdapter
.
notifyDataSetChanged
()
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
val
questionMultiItem2
=
QuestionMultiItem
()
// 使用问题questionId 去questionChains取到选项配置
val
options
=
mQuestionBean
!!
.
questionChains
[
questionId
]
?.
options
val
options
=
mQuestionBean
!!
.
question
Paper
.
question
Chains
[
questionId
]
?.
options
//从配置里找到下一题id
val
nextQuestionId
=
options
?.
get
(
bean
?.
id
)
//使用下一题nextQuestionId 取到题
val
questionsBean
=
mQuestionBean
!!
.
questions
[
nextQuestionId
]
val
questionsBean
=
mQuestionBean
!!
.
question
Paper
.
question
s
[
nextQuestionId
]
if
(
questionsBean
!=
null
)
{
//还有下一题
questionMultiItem2
.
questionsBean
=
questionsBean
...
...
@@ -99,21 +97,102 @@ class QuestionInformationView(
questionMultiItem2
.
viewType
=
3
}
else
{
questionMultiItem2
.
viewType
=
4
questionMultiItem2
.
type4CanClick
=
true
}
mData
.
add
(
questionMultiItem2
)
}
else
{
//没有下一题了
//没有下一题了,展示描述=题
for
((
index
,
item
)
in
mData
.
withIndex
())
{
mData
[
index
].
type4CanClick
=
false
}
val
questionMultiItem5
=
QuestionMultiItem
()
questionMultiItem5
.
type5Bean
=
mQuestionBean
!!
.
questions
[
1
]
questionMultiItem5
.
viewType
=
5
mData
.
add
(
questionMultiItem5
)
//显示输入框
cl_input
.
visibility
=
VISIBLE
tv_problem
.
visibility
=
GONE
hsv_problem_tips
.
visibility
=
VISIBLE
et_input_problem
.
hint
=
"请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod
(
et_input_problem
)
// 滚动到底部
Handler
().
postDelayed
({
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
},
500L
)
}
mQuestionAdapter
.
notifyDataSetChanged
()
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
}
override
fun
moreDefineItemClick
(
list
:
List
<
OptionsBean
?>?)
{
override
fun
moreDefineItemClick
(
list
:
List
<
OptionsBean
?>?
,
questionId
:
String
)
{
//多选确定
var
anwserStr
=
""
list
?.
forEach
{
if
(
anwserStr
.
isNotEmpty
())
{
anwserStr
=
anwserStr
+
"、"
+
it
?.
name
}
else
{
anwserStr
+=
it
?.
name
}
}
val
bean
=
list
?.
get
(
0
)
val
questionMultiItem
=
QuestionMultiItem
()
questionMultiItem
.
type2Text
=
anwserStr
questionMultiItem
.
viewType
=
2
mData
.
add
(
questionMultiItem
)
mQuestionAdapter
.
notifyDataSetChanged
()
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
val
questionMultiItem2
=
QuestionMultiItem
()
// 使用问题questionId 去questionChains取到选项配置
val
options
=
mQuestionBean
!!
.
questionPaper
.
questionChains
[
questionId
]
?.
options
//从配置里找到下一题id
val
nextQuestionId
=
options
?.
get
(
bean
?.
id
)
//使用下一题nextQuestionId 取到题
val
questionsBean
=
mQuestionBean
!!
.
questionPaper
.
questions
[
nextQuestionId
]
if
(
questionsBean
!=
null
)
{
//还有下一题
questionMultiItem2
.
questionsBean
=
questionsBean
if
(
"radio"
==
questionsBean
?.
type
)
{
questionMultiItem2
.
viewType
=
3
}
else
{
questionMultiItem2
.
viewType
=
4
questionMultiItem2
.
type4CanClick
=
true
}
mData
.
add
(
questionMultiItem2
)
}
else
{
//没有下一题了,展示描述=题
for
((
index
,
item
)
in
mData
.
withIndex
())
{
mData
[
index
].
type4CanClick
=
false
}
val
questionMultiItem5
=
QuestionMultiItem
()
questionMultiItem5
.
type5Bean
=
mQuestionBean
!!
.
questions
[
1
]
questionMultiItem5
.
viewType
=
5
mData
.
add
(
questionMultiItem5
)
//显示输入框
cl_input
.
visibility
=
VISIBLE
tv_problem
.
visibility
=
GONE
hsv_problem_tips
.
visibility
=
VISIBLE
et_input_problem
.
hint
=
"请简单描述遇到的问题……\n\n\n"
// 打开软件盘
showInputMethod
(
et_input_problem
)
// 滚动到底部
Handler
().
postDelayed
({
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
},
500L
)
}
mQuestionAdapter
.
notifyDataSetChanged
()
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
}
override
fun
showOtherEdit
(
list
:
List
<
OptionsBean
?>?)
{
override
fun
showOtherEdit
(
list
:
List
<
OptionsBean
?>?
,
questionId
:
String
)
{
//显示输入框
cl_input
.
visibility
=
VISIBLE
tv_problem
.
visibility
=
VISIBLE
...
...
@@ -141,20 +220,21 @@ class QuestionInformationView(
mQuestionBean
=
questionInfo
mData
.
clear
()
val
questionMultiItem
=
QuestionMultiItem
()
questionMultiItem
.
type1Text
=
questionInfo
.
name
questionMultiItem
.
type1Text
=
questionInfo
.
questions
[
0
].
question
questionMultiItem
.
viewType
=
1
mData
.
add
(
questionMultiItem
)
val
questionMultiItem2
=
QuestionMultiItem
()
mQuestionBean
!!
.
questionChains
.
forEach
{
(
k
,
v
)
->
mQuestionBean
!!
.
question
Paper
.
question
Chains
.
forEach
{
(
k
,
v
)
->
if
(
v
.
head
)
{
// 代表第一题 ,使用questionId 去questions取到对应的提
val
questionsBean
=
mQuestionBean
!!
.
questions
[
v
.
questionId
]
val
questionsBean
=
mQuestionBean
!!
.
question
Paper
.
question
s
[
v
.
questionId
]
questionMultiItem2
.
questionsBean
=
questionsBean
if
(
"radio"
==
questionsBean
?.
type
)
{
questionMultiItem2
.
viewType
=
3
}
else
{
questionMultiItem2
.
viewType
=
4
questionMultiItem2
.
type4CanClick
=
true
}
mData
.
add
(
questionMultiItem2
)
return
@forEach
...
...
@@ -163,6 +243,8 @@ class QuestionInformationView(
tv_send
.
setOnClickListener
{
et_input_problem
.
setText
(
""
)
hideInputMethod
(
et_input_problem
)
//隐藏输入框
cl_input
.
visibility
=
GONE
}
tv_cur_problem
.
setOnClickListener
{
problemContent
=
et_input_problem
.
text
.
toString
()
...
...
@@ -185,7 +267,7 @@ class QuestionInformationView(
et_input_problem
.
addTextChangedListener
(
object
:
TextWatcher
{
override
fun
afterTextChanged
(
p0
:
Editable
?)
{
// 动态监听输入行数大于等于4行,滚动列表到底部
if
(
et_input_problem
.
lineCount
>=
4
&&
recycle
.
canScrollVertically
(
1
))
{
if
(
et_input_problem
.
lineCount
>=
3
&&
recycle
.
canScrollVertically
(
1
))
{
recycle
.
smoothScrollToPosition
(
mData
.
size
-
1
)
}
}
...
...
@@ -218,6 +300,7 @@ class QuestionInformationView(
object
:
SoftKeyBoardListener
.
OnSoftKeyBoardChangeListener
{
override
fun
keyBoardShow
(
height
:
Int
)
{
recycle
.
smoothScrollToPosition
(
mData
.
size
-
1
)
recycle
.
scrollToPosition
(
mData
.
size
-
1
)
}
override
fun
keyBoardHide
(
height
:
Int
)
{
...
...
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