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
631307b0
Commit
631307b0
authored
Jun 21, 2021
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:im-灵犀2.0-多选UI完成
parent
a076cb9c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
87 additions
and
4 deletions
+87
-4
MsgViewHolderLingxiWhichQuestion.java
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderLingxiWhichQuestion.java
+27
-4
AdapterLingxiMultipleChoice.kt
m-im/src/main/java/com/yidianling/im/session/viewholder/adapter/AdapterLingxiMultipleChoice.kt
+60
-0
No files found.
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderLingxiWhichQuestion.java
View file @
631307b0
...
...
@@ -8,6 +8,7 @@ import com.yidianling.common.tools.ToastUtil;
import
com.yidianling.im.R
;
import
com.yidianling.im.session.extension.CustomAttachLingxiWhichQuestion
;
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.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter
;
...
...
@@ -17,9 +18,12 @@ import org.jetbrains.annotations.NotNull;
import
java.util.ArrayList
;
public
class
MsgViewHolderLingxiWhichQuestion
extends
MsgViewHolderBase
implements
AdapterLingxiWhichQuestion
.
OnQuestionlItemClickListener
{
public
class
MsgViewHolderLingxiWhichQuestion
extends
MsgViewHolderBase
implements
AdapterLingxiWhichQuestion
.
OnQuestionlItemClickListener
,
AdapterLingxiMultipleChoice
.
OnMultiplelItemClickListener
{
private
RecyclerView
recycleviewWhichQuestion
;
private
RecyclerView
recycleviewMultipleChoice
;
private
AdapterLingxiWhichQuestion
adapterLingxiWhichQuestion
;
private
AdapterLingxiMultipleChoice
adapterLingxiMultipleChoice
;
ArrayList
<
String
>
questionList
=
new
ArrayList
<
String
>();
Integer
maxItemSize
=
6
;
Boolean
isSingleChoice
=
true
;
...
...
@@ -47,6 +51,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
@Override
protected
void
inflateContentView
()
{
recycleviewWhichQuestion
=
findViewById
(
R
.
id
.
which_question_rv
);
recycleviewMultipleChoice
=
findViewById
(
R
.
id
.
multiple_question_rv
);
}
...
...
@@ -58,21 +63,39 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
questionList
.
add
(
"aaa"
);
questionList
.
add
(
"aaa"
);
questionList
.
add
(
"aaa"
);
//您想要咨询下列哪类的问题?(单选)
adapterLingxiWhichQuestion
=
new
AdapterLingxiWhichQuestion
();
adapterLingxiWhichQuestion
.
setTagData
(
questionList
);
GridLayoutManager
gridLayoutManager
=
new
GridLayoutManager
(
context
,
2
);
//当list中字段大于6个显示单行,否则显示双行
gridLayoutManager
.
setSpanCount
(
maxItemSize
>
6
?
1
:
2
);
gridLayoutManager
.
setOrientation
(
Linear
LayoutManager
.
VERTICAL
);
gridLayoutManager
.
setOrientation
(
Grid
LayoutManager
.
VERTICAL
);
recycleviewWhichQuestion
.
setLayoutManager
(
gridLayoutManager
);
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
);
}
@Override
public
void
onItemClick
(
@NotNull
LingxiWhichQuestionBean
string
,
int
position
)
{
ToastUtil
.
toastShort
(
"点击了"
+
position
);
ToastUtil
.
toastShort
(
"
单选
点击了"
+
position
);
//todo发送消息
}
@Override
public
void
onMultipleItemClick
(
@NotNull
LingxiWhichQuestionBean
string
,
int
position
)
{
ToastUtil
.
toastShort
(
"多选点击了"
+
position
);
//多选发送消息
}
}
m-im/src/main/java/com/yidianling/im/session/viewholder/adapter/AdapterLingxiMultipleChoice.kt
0 → 100644
View file @
631307b0
package
com.yidianling.im.session.viewholder.adapter
import
androidx.recyclerview.widget.RecyclerView
import
android.view.LayoutInflater
import
android.view.View
import
android.view.ViewGroup
import
android.widget.TextView
import
com.yidianling.im.R
import
com.yidianling.im.session.viewholder.bean.LingxiWhichQuestionBean
/**
* @author huozhiliang
* @描述:
* @Copyright Copyright (c) 2018
* @Company 壹点灵
* @date 2021/6/21
*/
class
AdapterLingxiMultipleChoice
:
RecyclerView
.
Adapter
<
AdapterLingxiMultipleChoice
.
ViewHolder
>()
{
private
lateinit
var
tagList
:
List
<
String
>
private
var
onItemClickListener
:
OnMultiplelItemClickListener
?
=
null
class
ViewHolder
(
itemView
:
View
)
:
RecyclerView
.
ViewHolder
(
itemView
)
{
val
tv_which_question
:
TextView
=
itemView
.
findViewById
(
R
.
id
.
tv_which_question
)
}
override
fun
onCreateViewHolder
(
parent
:
ViewGroup
,
viewType
:
Int
):
ViewHolder
{
return
ViewHolder
(
LayoutInflater
.
from
(
parent
.
context
).
inflate
(
R
.
layout
.
im_lingxi_which_question_item
,
parent
,
false
)
)
}
override
fun
getItemCount
():
Int
{
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
)
}
}
fun
setTagData
(
data
:
List
<
String
>)
{
tagList
=
data
notifyDataSetChanged
()
}
interface
OnMultiplelItemClickListener
{
fun
onMultipleItemClick
(
string
:
LingxiWhichQuestionBean
,
position
:
Int
)
}
}
\ No newline at end of file
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