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
a076cb9c
Commit
a076cb9c
authored
Jun 21, 2021
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:im-灵犀2.0-多选UI完成
parent
ec5de0fb
Show whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
130 additions
and
13 deletions
+130
-13
CustomAttachLingxiWhichQuestion.java
m-im/src/main/java/com/yidianling/im/session/extension/CustomAttachLingxiWhichQuestion.java
+8
-3
CustomAttachSimpleDescUQuestion.java
m-im/src/main/java/com/yidianling/im/session/extension/CustomAttachSimpleDescUQuestion.java
+20
-0
CustomAttachmentType.java
m-im/src/main/java/com/yidianling/im/session/extension/CustomAttachmentType.java
+2
-0
MsgViewHolderLingxiWhichQuestion.java
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderLingxiWhichQuestion.java
+24
-5
AdapterLingxiWhichQuestion.kt
m-im/src/main/java/com/yidianling/im/session/viewholder/adapter/AdapterLingxiWhichQuestion.kt
+9
-4
LingxiWhichQuestionBean.kt
m-im/src/main/java/com/yidianling/im/session/viewholder/bean/LingxiWhichQuestionBean.kt
+1
-1
im_background_18dp_1da1f2.xml
m-im/src/main/res/drawable/im_background_18dp_1da1f2.xml
+6
-0
im_background_18dp_ebebeb.xml
m-im/src/main/res/drawable/im_background_18dp_ebebeb.xml
+6
-0
im_nim_lingxi_multiple_choice.xml
m-im/src/main/res/layout/im_nim_lingxi_multiple_choice.xml
+54
-0
No files found.
m-im/src/main/java/com/yidianling/im/session/extension/CustomAttachLingxiWhichQuestion.java
View file @
a076cb9c
...
@@ -3,7 +3,11 @@ package com.yidianling.im.session.extension;
...
@@ -3,7 +3,11 @@ package com.yidianling.im.session.extension;
import
com.alibaba.fastjson.JSONObject
;
import
com.alibaba.fastjson.JSONObject
;
public
class
CustomAttachLingxiWhichQuestion
extends
CustomAttachment
{
public
class
CustomAttachLingxiWhichQuestion
extends
CustomAttachment
{
private
final
String
KEY_STATUS
=
"status"
;
private
final
String
TYPE
=
"type"
;
private
String
type
;
//消息类型
private
String
maxItemSize
;
public
CustomAttachLingxiWhichQuestion
()
{
public
CustomAttachLingxiWhichQuestion
()
{
...
@@ -11,11 +15,12 @@ public class CustomAttachLingxiWhichQuestion extends CustomAttachment {
...
@@ -11,11 +15,12 @@ public class CustomAttachLingxiWhichQuestion extends CustomAttachment {
}
}
@Override
@Override
protected
void
parseData
(
JSONObject
data
)
{
protected
void
parseData
(
JSONObject
data
)
{
this
.
type
=
data
.
getString
(
TYPE
);
}
}
@Override
@Override
protected
JSONObject
packData
()
{
protected
JSONObject
packData
()
{
return
null
;
return
null
;
}
}
}
}
m-im/src/main/java/com/yidianling/im/session/extension/CustomAttachSimpleDescUQuestion.java
0 → 100644
View file @
a076cb9c
package
com
.
yidianling
.
im
.
session
.
extension
;
import
com.alibaba.fastjson.JSONObject
;
public
class
CustomAttachSimpleDescUQuestion
extends
CustomAttachment
{
CustomAttachSimpleDescUQuestion
(
int
type
)
{
super
(
CustomAttachmentType
.
TYPE_LINGXI_SIMPLY_UQUESTION
);
}
@Override
protected
void
parseData
(
JSONObject
data
)
{
}
@Override
protected
JSONObject
packData
()
{
return
null
;
}
}
m-im/src/main/java/com/yidianling/im/session/extension/CustomAttachmentType.java
View file @
a076cb9c
...
@@ -45,5 +45,7 @@ public interface CustomAttachmentType {
...
@@ -45,5 +45,7 @@ public interface CustomAttachmentType {
//灵犀2.0问诊数据
//灵犀2.0问诊数据
int
TYPE_LINGXI_WHICH_QUESTION
=
50
;
//您想要咨询哪类问题
int
TYPE_LINGXI_WHICH_QUESTION
=
50
;
//您想要咨询哪类问题
int
TYPE_LINGXI_SIMPLY_UQUESTION
=
51
;
//请简单描述您的问题
}
}
m-im/src/main/java/com/yidianling/im/session/viewholder/MsgViewHolderLingxiWhichQuestion.java
View file @
a076cb9c
...
@@ -6,7 +6,10 @@ import androidx.recyclerview.widget.RecyclerView;
...
@@ -6,7 +6,10 @@ import androidx.recyclerview.widget.RecyclerView;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
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.AdapterLingxiWhichQuestion
;
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
;
import
com.yidianling.nimbase.common.ui.recyclerview.adapter.BaseMultiItemFetchLoadAdapter
;
import
com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase
;
import
com.yidianling.uikit.business.session.viewholder.MsgViewHolderBase
;
...
@@ -17,15 +20,28 @@ import java.util.ArrayList;
...
@@ -17,15 +20,28 @@ import java.util.ArrayList;
public
class
MsgViewHolderLingxiWhichQuestion
extends
MsgViewHolderBase
implements
AdapterLingxiWhichQuestion
.
OnQuestionlItemClickListener
{
public
class
MsgViewHolderLingxiWhichQuestion
extends
MsgViewHolderBase
implements
AdapterLingxiWhichQuestion
.
OnQuestionlItemClickListener
{
private
RecyclerView
recycleviewWhichQuestion
;
private
RecyclerView
recycleviewWhichQuestion
;
private
AdapterLingxiWhichQuestion
adapterLingxiWhichQuestion
;
private
AdapterLingxiWhichQuestion
adapterLingxiWhichQuestion
;
ArrayList
<
String
>
questionList
=
new
ArrayList
<
String
>();
ArrayList
<
String
>
questionList
=
new
ArrayList
<
String
>();
Integer
maxItemSize
=
6
;
Boolean
isSingleChoice
=
true
;
public
MsgViewHolderLingxiWhichQuestion
(
BaseMultiItemFetchLoadAdapter
adapter
)
{
public
MsgViewHolderLingxiWhichQuestion
(
BaseMultiItemFetchLoadAdapter
adapter
)
{
super
(
adapter
);
super
(
adapter
);
}
}
@Override
@Override
protected
int
getContentResId
()
{
protected
int
getContentResId
()
{
CustomAttachLingxiWhichQuestion
customAttachLingxiWhichQuestion
=
((
CustomAttachLingxiWhichQuestion
)
message
.
getAttachment
());
switch
(
customAttachLingxiWhichQuestion
.
getType
()){
case
1
:
//您想要咨询下列哪类的问题?(单选)
return
R
.
layout
.
im_nim_lingxi_which_question
;
case
2
:
//请问是发生了什么事情导致的呢?(多选)
return
R
.
layout
.
im_nim_lingxi_multiple_choice
;
case
3
:
return
R
.
layout
.
im_nim_lingxi_which_question
;
case
4
:
return
R
.
layout
.
im_nim_lingxi_which_question
;
return
R
.
layout
.
im_nim_lingxi_which_question
;
default
:
return
R
.
layout
.
im_nim_lingxi_which_question
;
}
}
}
@Override
@Override
...
@@ -44,8 +60,11 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
...
@@ -44,8 +60,11 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
questionList
.
add
(
"aaa"
);
questionList
.
add
(
"aaa"
);
adapterLingxiWhichQuestion
=
new
AdapterLingxiWhichQuestion
();
adapterLingxiWhichQuestion
=
new
AdapterLingxiWhichQuestion
();
adapterLingxiWhichQuestion
.
setTagData
(
questionList
);
adapterLingxiWhichQuestion
.
setTagData
(
questionList
);
GridLayoutManager
gridLayoutManager
=
new
GridLayoutManager
(
context
,
2
);
GridLayoutManager
gridLayoutManager
=
new
GridLayoutManager
(
context
,
2
);
//当list中字段大于6个显示单行,否则显示双行
gridLayoutManager
.
setSpanCount
(
maxItemSize
>
6
?
1
:
2
);
gridLayoutManager
.
setOrientation
(
LinearLayoutManager
.
VERTICAL
);
gridLayoutManager
.
setOrientation
(
LinearLayoutManager
.
VERTICAL
);
recycleviewWhichQuestion
.
setLayoutManager
(
gridLayoutManager
);
recycleviewWhichQuestion
.
setLayoutManager
(
gridLayoutManager
);
recycleviewWhichQuestion
.
setAdapter
(
adapterLingxiWhichQuestion
);
recycleviewWhichQuestion
.
setAdapter
(
adapterLingxiWhichQuestion
);
...
@@ -53,7 +72,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
...
@@ -53,7 +72,7 @@ public class MsgViewHolderLingxiWhichQuestion extends MsgViewHolderBase implemen
@Override
@Override
public
void
onItemClick
(
@NotNull
LingxiWhichQuestionBean
string
,
int
position
)
{
public
void
onItemClick
(
@NotNull
LingxiWhichQuestionBean
string
,
int
position
)
{
ToastUtil
.
toastShort
(
"点击了"
+
position
);
ToastUtil
.
toastShort
(
"点击了"
+
position
);
//todo发送消息
//todo发送消息
}
}
}
}
m-im/src/main/java/com/yidianling/im/session/viewholder/adapter/AdapterLingxiWhichQuestion.kt
View file @
a076cb9c
...
@@ -5,9 +5,8 @@ import android.view.LayoutInflater
...
@@ -5,9 +5,8 @@ import android.view.LayoutInflater
import
android.view.View
import
android.view.View
import
android.view.ViewGroup
import
android.view.ViewGroup
import
android.widget.TextView
import
android.widget.TextView
import
com.ydl.ydl_image.module.GlideApp
import
com.yidianling.im.R
import
com.yidianling.im.R
import
com.yidianling.im.session.viewholder.LingxiWhichQuestionBean
import
com.yidianling.im.session.viewholder.
bean.
LingxiWhichQuestionBean
/**
/**
* @author huozhiliang
* @author huozhiliang
...
@@ -42,7 +41,12 @@ class AdapterLingxiWhichQuestion : RecyclerView.Adapter<AdapterLingxiWhichQuesti
...
@@ -42,7 +41,12 @@ class AdapterLingxiWhichQuestion : RecyclerView.Adapter<AdapterLingxiWhichQuesti
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
override
fun
onBindViewHolder
(
holder
:
ViewHolder
,
position
:
Int
)
{
// holder.tv_which_question.setText("")
// holder.tv_which_question.setText("")
holder
.
tv_which_question
.
setOnClickListener
{
holder
.
tv_which_question
.
setOnClickListener
{
onItemClickListener
?.
onItemClick
(
LingxiWhichQuestionBean
(
true
,
"aa"
,
"aaa"
),
position
)
onItemClickListener
?.
onItemClick
(
LingxiWhichQuestionBean
(
true
,
"aa"
,
"aaa"
),
position
)
}
}
}
}
fun
setTagData
(
data
:
List
<
String
>)
{
fun
setTagData
(
data
:
List
<
String
>)
{
...
@@ -50,6 +54,6 @@ class AdapterLingxiWhichQuestion : RecyclerView.Adapter<AdapterLingxiWhichQuesti
...
@@ -50,6 +54,6 @@ class AdapterLingxiWhichQuestion : RecyclerView.Adapter<AdapterLingxiWhichQuesti
notifyDataSetChanged
()
notifyDataSetChanged
()
}
}
interface
OnQuestionlItemClickListener
{
interface
OnQuestionlItemClickListener
{
fun
onItemClick
(
string
:
LingxiWhichQuestionBean
,
position
:
Int
)
fun
onItemClick
(
string
:
LingxiWhichQuestionBean
,
position
:
Int
)
}
}
}
}
\ No newline at end of file
m-im/src/main/java/com/yidianling/im/session/viewholder/LingxiWhichQuestionBean.kt
→
m-im/src/main/java/com/yidianling/im/session/viewholder/
bean/
LingxiWhichQuestionBean.kt
View file @
a076cb9c
package
com.yidianling.im.session.viewholder
package
com.yidianling.im.session.viewholder
.bean
data class
LingxiWhichQuestionBean
(
data class
LingxiWhichQuestionBean
(
var
isSelected
:
Boolean
,
var
isSelected
:
Boolean
,
...
...
m-im/src/main/res/drawable/im_background_18dp_1da1f2.xml
0 → 100644
View file @
a076cb9c
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#1da1f2"
/>
<corners
android:radius=
"@dimen/platform_dp_18"
/>
</shape>
m-im/src/main/res/drawable/im_background_18dp_ebebeb.xml
0 → 100644
View file @
a076cb9c
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<solid
android:color=
"#ebebeb"
/>
<corners
android:radius=
"@dimen/platform_dp_18"
/>
</shape>
m-im/src/main/res/layout/im_nim_lingxi_multiple_choice.xml
0 → 100644
View file @
a076cb9c
<?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_height=
"wrap_content"
xmlns:app=
"http://schemas.android.com/apk/res-auto"
xmlns:tools=
"http://schemas.android.com/tools"
android:background=
"@drawable/im_custom_message_round_white_6dp_bg"
android:paddingLeft=
"@dimen/platform_dp_12"
android:paddingRight=
"@dimen/platform_dp_3"
>
<TextView
android:layout_width=
"239dp"
android:layout_height=
"wrap_content"
android:id=
"@+id/multiple_choice_title"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintLeft_toLeftOf=
"parent"
tools:text=
"请问是发生了什么事情导致的呢?(多选)?"
android:textSize=
"@dimen/im_text_size_17"
android:textColor=
"@color/im_color_242424"
>
</TextView>
<androidx.recyclerview.widget.RecyclerView
android:id=
"@+id/multiple_question_rv"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
android:orientation=
"vertical"
app:layout_constraintTop_toBottomOf=
"@id/multiple_choice_title"
app:layout_constraintStart_toStartOf=
"@id/multiple_choice_title"
tools:itemCount=
"6"
app:spanCount=
"2"
tools:listitem=
"@layout/im_lingxi_which_question_item"
app:layoutManager=
"androidx.recyclerview.widget.GridLayoutManager"
/>
<TextView
android:id=
"@+id/confirm_multiple_choice"
android:layout_width=
"110dp"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toBottomOf=
"@id/multiple_question_rv"
android:text=
"确定(2)"
android:layout_marginTop=
"@dimen/platform_dp_24"
android:textSize=
"@dimen/im_text_size_15"
app:layout_constraintEnd_toEndOf=
"@id/multiple_question_rv"
android:layout_marginEnd=
"@dimen/platform_dp_12"
android:background=
"@drawable/im_background_18dp_ebebeb"
android:paddingTop=
"@dimen/platform_dp_8"
android:paddingBottom=
"@dimen/platform_dp_8"
android:gravity=
"center"
android:layout_marginBottom=
"@dimen/platform_dp_20"
app:layout_constraintBottom_toBottomOf=
"parent"
>
</TextView>
</androidx.constraintlayout.widget.ConstraintLayout>
\ 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