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
c843762f
Commit
c843762f
authored
Jun 23, 2021
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:im-灵犀2.0-Json字段调整
parent
604a6502
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
87 additions
and
52 deletions
+87
-52
CustomAttachLingxiWhichQuestion.java
m-im/src/main/java/com/yidianling/im/session/extension/CustomAttachLingxiWhichQuestion.java
+19
-6
MsgViewHolderLingxiWhichQuestion.java
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderLingxiWhichQuestion.java
+20
-19
AdapterLingxiMultipleChoice.kt
m-im/src/main/java/com/yidianling/im/session/viewholder/adapter/AdapterLingxiMultipleChoice.kt
+20
-11
AdapterLingxiWhichQuestion.kt
m-im/src/main/java/com/yidianling/im/session/viewholder/adapter/AdapterLingxiWhichQuestion.kt
+12
-11
LingxiWhichQuestionBean.kt
m-im/src/main/java/com/yidianling/im/session/viewholder/bean/LingxiWhichQuestionBean.kt
+15
-4
im_nim_lingxi_which_question.xml
m-im/src/main/res/layout/im_nim_lingxi_which_question.xml
+1
-1
No files found.
m-im/src/main/java/com/yidianling/im/session/extension/CustomAttachLingxiWhichQuestion.java
View file @
c843762f
package
com
.
yidianling
.
im
.
session
.
extension
;
import
com.alibaba.fastjson.JSON
;
import
com.alibaba.fastjson.JSONObject
;
import
com.yidianling.im.session.viewholder.bean.LingxiWhichQuestionBean
;
import
com.yidianling.im.session.viewholder.bean.QuestionItemBean
;
import
com.yidianling.uikit.custom.http.response.RecommendExpertBean
;
import
java.util.ArrayList
;
import
java.util.List
;
public
class
CustomAttachLingxiWhichQuestion
extends
CustomAttachment
{
private
final
String
XQUESTIONPAPERID
=
"xquestionPaperId"
;
//试卷id
...
...
@@ -11,12 +18,12 @@ public class CustomAttachLingxiWhichQuestion extends CustomAttachment {
private
final
String
SELECTVALS
=
"selectVals"
;
//选项
p
rivate
String
xquestionPaperId
;
p
rivate
String
xquestionPaperName
;
p
rivate
String
questionId
;
p
rivate
String
questionTitle
;
p
rivate
String
selectType
;
p
rivate
String
selectVals
;
p
ublic
String
xquestionPaperId
;
p
ublic
String
xquestionPaperName
;
p
ublic
String
questionId
;
p
ublic
String
questionTitle
;
p
ublic
String
selectType
;
p
ublic
List
<
QuestionItemBean
>
selectVals
;
public
CustomAttachLingxiWhichQuestion
()
{
super
(
CustomAttachmentType
.
TYPE_LINGXI_WHICH_QUESTION
);
...
...
@@ -25,6 +32,12 @@ public class CustomAttachLingxiWhichQuestion extends CustomAttachment {
@Override
protected
void
parseData
(
JSONObject
data
)
{
this
.
xquestionPaperId
=
data
.
getString
(
XQUESTIONPAPERID
);
this
.
xquestionPaperName
=
data
.
getString
(
XQUESTIONPAPERNAME
);
this
.
questionId
=
data
.
getString
(
QUESTIONID
);
this
.
questionTitle
=
data
.
getString
(
QUESTIONTITLE
);
this
.
selectType
=
data
.
getString
(
SELECTTYPE
);
this
.
selectVals
=(
ArrayList
<
QuestionItemBean
>)
JSON
.
parseArray
(
data
.
getString
(
SELECTVALS
),
QuestionItemBean
.
class
);
}
@Override
...
...
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderLingxiWhichQuestion.java
View file @
c843762f
...
...
@@ -11,6 +11,7 @@ import com.yidianling.im.session.extension.CustomAttachmentOrderStatus;
import
com.yidianling.im.session.viewholder.adapter.AdapterLingxiMultipleChoice
;
import
com.yidianling.im.session.viewholder.adapter.AdapterLingxiWhichQuestion
;
import
com.yidianling.im.session.viewholder.bean.LingxiWhichQuestionBean
;
import
com.yidianling.im.session.viewholder.bean.QuestionItemBean
;
import
com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter
;
import
com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase
;
...
...
@@ -24,17 +25,18 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
private
AdapterLingxiWhichQuestion
adapterLingxiWhichQuestion
;
private
AdapterLingxiMultipleChoice
adapterLingxiMultipleChoice
;
ArrayList
<
String
>
questionList
=
new
ArrayList
<
String
>();
ArrayList
<
QuestionItemBean
>
questionList
=
new
ArrayList
<
QuestionItemBean
>();
Integer
maxItemSize
=
6
;
Boolean
isSingleChoice
=
true
;
CustomAttachLingxiWhichQuestion
customAttachLingxiWhichQuestion
;
public
MsgViewHolderLingxiWhichQuestion
(
BaseMultiItemFetchLoadAdapter
adapter
)
{
super
(
adapter
);
}
@Override
protected
int
getContentResId
()
{
CustomAttachLingxiWhichQuestion
customAttachLingxiWhichQuestion
=
((
CustomAttachLingxiWhichQuestion
)
message
.
getAttachment
());
switch
(
customAttachLingxiWhichQuestion
.
getType
(
)){
customAttachLingxiWhichQuestion
=
((
CustomAttachLingxiWhichQuestion
)
message
.
getAttachment
());
switch
(
Integer
.
parseInt
(
customAttachLingxiWhichQuestion
.
selectType
)){
case
1
:
//您想要咨询下列哪类的问题?(单选)
return
R
.
layout
.
im_nim_lingxi_which_question
;
case
2
:
//请问是发生了什么事情导致的呢?(多选)
...
...
@@ -55,16 +57,15 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
@Override
protected
void
bindContentView
()
{
questionList
.
add
(
"aaa"
);
questionList
.
add
(
"aaa"
);
questionList
.
add
(
"aaa"
);
questionList
.
add
(
"aaa"
);
questionList
.
add
(
"aaa"
);
questionList
.
add
(
"aaa"
);
customAttachLingxiWhichQuestion
=
((
CustomAttachLingxiWhichQuestion
)
message
.
getAttachment
());
//您想要咨询下列哪类的问题?(单选)
adapterLingxiWhichQuestion
=
new
AdapterLingxiWhichQuestion
();
for
(
int
i
=
0
;
i
<
8
;
i
++){
questionList
.
add
(
new
QuestionItemBean
(
"1"
,
"婚姻情感"
));
}
adapterLingxiWhichQuestion
.
setTagData
(
questionList
);
adapterLingxiWhichQuestion
.
setItemListener
(
this
);
GridLayoutManager
gridLayoutManager
=
new
GridLayoutManager
(
context
,
2
);
//当list中字段大于6个显示单行,否则显示双行
gridLayoutManager
.
setSpanCount
(
maxItemSize
>
6
?
1
:
2
);
...
...
@@ -73,19 +74,19 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
recycleviewWhichQuestion
.
setAdapter
(
adapterLingxiWhichQuestion
);
//请问是发生了什么事情导致的呢?(多选)
adapterLingxiMultipleChoice
=
new
AdapterLingxiMultipleChoice
();
adapterLingxiMultipleChoice
.
setTagData
(
questionList
);
GridLayoutManager
multipleChoiceManager
=
new
GridLayoutManager
(
context
,
2
);
//当list中字段大于6个显示单行,否则显示双行
multipleChoiceManager
.
setSpanCount
(
maxItemSize
>
6
?
1
:
2
);
multipleChoiceManager
.
setOrientation
(
GridLayoutManager
.
VERTICAL
);
recycleviewWhichQuestion
.
setLayoutManager
(
multipleChoiceManager
);
recycleviewWhichQuestion
.
setAdapter
(
adapterLingxiMultipleChoice
);
//
adapterLingxiMultipleChoice = new AdapterLingxiMultipleChoice();
////
adapterLingxiMultipleChoice.setTagData(questionList);
//
GridLayoutManager multipleChoiceManager = new GridLayoutManager(context, 2);
//
//当list中字段大于6个显示单行,否则显示双行
//
multipleChoiceManager.setSpanCount(maxItemSize > 6 ? 1 : 2);
//
multipleChoiceManager.setOrientation(GridLayoutManager.VERTICAL);
//
recycleviewWhichQuestion.setLayoutManager(multipleChoiceManager);
//
recycleviewWhichQuestion.setAdapter(adapterLingxiMultipleChoice);
}
@Override
public
void
onItemClick
(
@NotNull
LingxiWhichQuestion
Bean
string
,
int
position
)
{
public
void
onItemClick
(
@NotNull
QuestionItem
Bean
string
,
int
position
)
{
ToastUtil
.
toastShort
(
"单选点击了"
+
position
);
//todo发送消息
...
...
@@ -93,7 +94,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
}
@Override
public
void
onMultipleItemClick
(
@NotNull
LingxiWhichQuestion
Bean
string
,
int
position
)
{
public
void
onMultipleItemClick
(
@NotNull
QuestionItem
Bean
string
,
int
position
)
{
ToastUtil
.
toastShort
(
"多选点击了"
+
position
);
//多选发送消息
...
...
m-im/src/main/java/com/yidianling/im/session/viewholder/adapter/AdapterLingxiMultipleChoice.kt
View file @
c843762f
...
...
@@ -7,6 +7,7 @@ import android.view.ViewGroup
import
android.widget.TextView
import
com.yidianling.im.R
import
com.yidianling.im.session.viewholder.bean.LingxiWhichQuestionBean
import
com.yidianling.im.session.viewholder.bean.QuestionItemBean
/**
* @author huozhiliang
...
...
@@ -16,7 +17,7 @@ import com.yidianling.im.session.viewholder.bean.LingxiWhichQuestionBean
* @date 2021/6/21
*/
class
AdapterLingxiMultipleChoice
:
RecyclerView
.
Adapter
<
AdapterLingxiMultipleChoice
.
ViewHolder
>()
{
private
lateinit
var
tagList
:
List
<
String
>
private
lateinit
var
tagList
:
List
<
String
>
private
var
onItemClickListener
:
OnMultiplelItemClickListener
?
=
null
class
ViewHolder
(
itemView
:
View
)
:
...
...
@@ -35,25 +36,32 @@ class AdapterLingxiMultipleChoice : RecyclerView.Adapter<AdapterLingxiMultipleCh
}
override
fun
getItemCount
():
Int
{
return
tagList
.
size
?:
0
return
tagList
.
size
?:
0
}
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
// holder.tv_which_question.setText("")
holder
.
tv_which_question
.
setOnClickListener
{
onItemClickListener
?.
onMultipleItemClick
(
LingxiWhichQuestionBean
(
true
,
"aa"
,
"aaa"
),
position
)
}
// holder.tv_which_question.setOnClickListener {
// onItemClickListener?.onMultipleItemClick(
// LingxiWhichQuestionBean(
// isSelected = true,
// xquestionPaperId = "0",
// xquestionPaperName = "l",
// questionId = "1",
// questionTitle = "1",
// selectType = "1",
// selectVals = listOf<QuestionItemBean>(QuestionItemBean(id = "1",name = "2"))
// ), position
// )
// }
}
fun
setTagData
(
data
:
List
<
String
>)
{
tagList
=
data
notifyDataSetChanged
()
}
interface
OnMultiplelItemClickListener
{
fun
onMultipleItemClick
(
string
:
LingxiWhichQuestion
Bean
,
position
:
Int
)
fun
onMultipleItemClick
(
string
:
QuestionItem
Bean
,
position
:
Int
)
}
}
\ No newline at end of file
m-im/src/main/java/com/yidianling/im/session/viewholder/adapter/AdapterLingxiWhichQuestion.kt
View file @
c843762f
...
...
@@ -7,6 +7,7 @@ import android.view.ViewGroup
import
android.widget.TextView
import
com.yidianling.im.R
import
com.yidianling.im.session.viewholder.bean.LingxiWhichQuestionBean
import
com.yidianling.im.session.viewholder.bean.QuestionItemBean
/**
* @author huozhiliang
...
...
@@ -16,12 +17,12 @@ import com.yidianling.im.session.viewholder.bean.LingxiWhichQuestionBean
* @date 2021/6/21
*/
class
AdapterLingxiWhichQuestion
:
RecyclerView
.
Adapter
<
AdapterLingxiWhichQuestion
.
ViewHolder
>()
{
private
lateinit
var
tagList
:
List
<
String
>
private
lateinit
var
tagList
:
List
<
QuestionItemBean
>
private
var
onItemClickListener
:
OnQuestionlItemClickListener
?
=
null
class
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
val
tv
_which_q
uestion
:
TextView
=
itemView
.
findViewById
(
R
.
id
.
tv_which_question
)
val
tv
WhichQ
uestion
:
TextView
=
itemView
.
findViewById
(
R
.
id
.
tv_which_question
)
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
...
...
@@ -39,21 +40,20 @@ class AdapterLingxiWhichQuestion : RecyclerView.Adapter<AdapterLingxiWhichQuesti
}
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
// holder.tv_which_question.setText("")
holder
.
tv
_which_q
uestion
.
setOnClickListener
{
holder
.
tvWhichQuestion
.
text
=
tagList
[
position
].
name
holder
.
tv
WhichQ
uestion
.
setOnClickListener
{
onItemClickListener
?.
onItemClick
(
LingxiWhichQuestionBean
(
true
,
"aa"
,
"aaa"
),
position
)
tagList
[
position
],
position
)
}
}
fun
setTagData
(
data
:
List
<
String
>)
{
fun
setTagData
(
data
:
List
<
QuestionItemBean
>)
{
tagList
=
data
notifyDataSetChanged
()
}
interface
OnQuestionlItemClickListener
{
fun
onItemClick
(
string
:
LingxiWhichQuestionBean
,
position
:
Int
)
fun
onItemClick
(
string
:
QuestionItemBean
,
position
:
Int
)
}
fun
setItemListener
(
listener
:
OnQuestionlItemClickListener
)
{
this
.
onItemClickListener
=
listener
}
}
\ No newline at end of file
m-im/src/main/java/com/yidianling/im/session/viewholder/bean/LingxiWhichQuestionBean.kt
View file @
c843762f
package
com.yidianling.im.session.viewholder.bean
data class
LingxiWhichQuestionBean
(
var
isSelected
:
Boolean
,
var
name
:
String
,
var
id
:
String
import
com.google.gson.annotations.SerializedName
data class
LingxiWhichQuestionBean
(
var
isSelected
:
Boolean
,
var
xquestionPaperId
:
String
?,
//试卷ID
var
xquestionPaperName
:
String
?,
//试卷名称
var
questionId
:
String
?,
//问题ID
var
questionTitle
:
String
?,
//问题题目
var
selectType
:
String
?,
//试卷type 1单选 2多选
var
selectVals
:
ArrayList
<
QuestionItemBean
>?
//选项
)
data class
QuestionItemBean
(
var
id
:
String
?,
var
name
:
String
?
)
\ No newline at end of file
m-im/src/main/res/layout/im_nim_lingxi_which_question.xml
View file @
c843762f
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"
wrap_content
"
android:layout_width=
"
260dp
"
android:layout_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
...
...
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