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
a64527e7
Commit
a64527e7
authored
Apr 22, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'MDT群聊搭建' into dev_mdt_av
# Conflicts: # config.gradle
parents
86c77660
64a2ee78
Hide whitespace changes
Inline
Side-by-side
Showing
29 changed files
with
662 additions
and
93 deletions
+662
-93
config.gradle
config.gradle
+2
-2
TeamAlreadyReadBean.java
m-im/src/main/java/com/yidianling/im/bean/TeamAlreadyReadBean.java
+13
-0
ChatGroupStatusEvent.kt
m-im/src/main/java/com/yidianling/im/event/ChatGroupStatusEvent.kt
+4
-0
ImApi.kt
m-im/src/main/java/com/yidianling/im/http/ImApi.kt
+1
-0
ImHttp.kt
m-im/src/main/java/com/yidianling/im/http/ImHttp.kt
+2
-0
ImRetrofitApi.kt
m-im/src/main/java/com/yidianling/im/http/ImRetrofitApi.kt
+5
-0
SessionHelper.java
m-im/src/main/java/com/yidianling/im/session/SessionHelper.java
+3
-1
NewMultiMessageFragment.kt
m-im/src/main/java/com/yidianling/im/ui/page/NewMultiMessageFragment.kt
+2
-1
ChatFragment.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/ChatFragment.kt
+28
-1
ChatAdapter.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/adapter/ChatAdapter.kt
+22
-1
ChatItemBean.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/bean/ChatItemBean.kt
+4
-2
ChatItemView.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/view/ChatItemView.kt
+43
-12
ChatParam.kt
m-im/src/main/java/com/yidianling/im/ui/param/ChatParam.kt
+2
-2
AitManager.java
m-im/src/main/java/com/yidianling/uikit/business/ait/AitManager.java
+2
-1
YDLP2PMessageActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLP2PMessageActivity.java
+4
-2
YDLTeamMessageActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLTeamMessageActivity.java
+4
-2
YDLMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
+43
-13
YDLTeamMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLTeamMessageFragment.java
+178
-0
TeamNotificationHelper.java
m-im/src/main/java/com/yidianling/uikit/business/session/helper/TeamNotificationHelper.java
+6
-1
InputPanel.java
m-im/src/main/java/com/yidianling/uikit/business/session/module/input/InputPanel.java
+6
-7
MsgViewHolderNotification.java
m-im/src/main/java/com/yidianling/uikit/business/session/viewholder/MsgViewHolderNotification.java
+11
-0
TeamCreateHelper.java
m-im/src/main/java/com/yidianling/uikit/business/team/helper/TeamCreateHelper.java
+191
-0
ic_group_chat_end.png
m-im/src/main/res/drawable-xhdpi/ic_group_chat_end.png
+0
-0
team_not_disturb.png
m-im/src/main/res/drawable-xhdpi/team_not_disturb.png
+0
-0
im_chat_item_view.xml
m-im/src/main/res/layout/im_chat_item_view.xml
+34
-11
im_nim_message_item_notification.xml
m-im/src/main/res_uikit/layout/im_nim_message_item_notification.xml
+24
-7
im_ydl_nim_message_fragment.xml
m-im/src/main/res_uikit/layout/im_ydl_nim_message_fragment.xml
+0
-4
AccountSettingActivity.java
m-user/src/main/java/com/yidianling/user/mine/AccountSettingActivity.java
+1
-0
DefaultFormatPrinter.java
ydl-net/src/main/java/com/ydl/ydlnet/builder/interceptor/log/DefaultFormatPrinter.java
+27
-23
No files found.
config.gradle
View file @
a64527e7
...
...
@@ -46,7 +46,7 @@ ext {
//以下 几乎不会动
"router"
:
"0.0.1"
,
"ydl-net"
:
"0.0.3.9
2
"
,
"ydl-net"
:
"0.0.3.9
3
"
,
"ydl-utils"
:
"0.0.3.2"
,
]
ydl_app
=
[
...
...
@@ -130,7 +130,7 @@ ext {
//以下 几乎不会动
"router"
:
"0.0.1"
,
"ydl-net"
:
"0.0.3.9
2
"
,
"ydl-net"
:
"0.0.3.9
3
"
,
"ydl-utils"
:
"0.0.3.1"
,
]
...
...
m-im/src/main/java/com/yidianling/im/bean/TeamAlreadyReadBean.java
0 → 100644
View file @
a64527e7
package
com
.
yidianling
.
im
.
bean
;
import
com.ydl.ydlcommon.data.http.BaseCommand
;
public
class
TeamAlreadyReadBean
extends
BaseCommand
{
public
String
tid
;
public
String
uid
;
public
TeamAlreadyReadBean
(
String
tid
,
String
uid
)
{
this
.
tid
=
tid
;
this
.
uid
=
uid
;
}
}
m-im/src/main/java/com/yidianling/im/event/ChatGroupStatusEvent.kt
0 → 100644
View file @
a64527e7
package
com.yidianling.im.event
class
ChatGroupStatusEvent
()
\ No newline at end of file
m-im/src/main/java/com/yidianling/im/http/ImApi.kt
View file @
a64527e7
...
...
@@ -70,6 +70,7 @@ interface ImApi {
@POST
(
"consult/get-expert"
)
fun
getExpert
(
@FieldMap
params
:
Map
<
String
,
String
>):
Observable
<
BaseResponse
<
IMExpertBuild
>>
//以下接口为消息改版后新加
//私聊 获取各消息未读数
@GET
(
"chat/getNotifyCountMessage"
)
...
...
m-im/src/main/java/com/yidianling/im/http/ImHttp.kt
View file @
a64527e7
...
...
@@ -50,4 +50,5 @@ interface ImHttp {
fun
getInteractMessage
(
param
:
InteractMessageParam
):
Observable
<
BaseAPIResponse
<
InteractBean
>>
fun
getUnreadMessage
(
param
:
UnreadParam
):
Observable
<
BaseAPIResponse
<
UnreadMessageBean
>>
}
\ No newline at end of file
m-im/src/main/java/com/yidianling/im/http/ImRetrofitApi.kt
View file @
a64527e7
...
...
@@ -37,6 +37,11 @@ interface ImRetrofitApi {
@POST
(
"consult/get-expert"
)
fun
getExpert
(
@FieldMap
params
:
Map
<
String
,
String
>):
Observable
<
BaseResponse
<
IMExpertBuild
>>
//群聊 群聊Ait艾特符号已读
@POST
(
"message/chatRoom/readApnsMessage"
)
@Headers
(
YDL_DOMAIN
+
YDL_DOMAIN_JAVA
)
fun
teamChatALreadyRead
(
@Body
params
:
Map
<
String
,
String
>):
Observable
<
BaseResponse
<
Any
>>
//获取用户的状态(用户、专家、助理)
@GET
(
"user/userType"
)
...
...
m-im/src/main/java/com/yidianling/im/session/SessionHelper.java
View file @
a64527e7
...
...
@@ -408,7 +408,9 @@ public class SessionHelper {
ArrayList
<
BaseAction
>
actions
=
new
ArrayList
<>();
actions
.
add
(
new
ImageAction
());
actions
.
add
(
new
VideoAction
());
actions
.
add
(
avChatAction
);
//去掉群聊的视频通话按钮
// actions.add(avChatAction);
SessionTeamCustomization
.
SessionTeamCustomListener
listener
=
new
SessionTeamCustomization
.
SessionTeamCustomListener
()
{
@Override
...
...
m-im/src/main/java/com/yidianling/im/ui/page/NewMultiMessageFragment.kt
View file @
a64527e7
...
...
@@ -18,7 +18,6 @@ import com.ydl.ydlcommon.bean.StatusBarOptions
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils.Companion.count
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.R
import
com.yidianling.im.api.event.ImLogoutEvent
...
...
@@ -41,6 +40,7 @@ import com.yidianling.im.ui.page.fragment.bean.UnreadMessageBean
import
com.yidianling.im.ui.page.popupWindow.ChatSettingPopupWindow
import
com.yidianling.im.ui.param.ClearMessageParam
import
com.yidianling.im.ui.param.UnreadParam
import
com.yidianling.uikit.api.NimUIKit
import
de.greenrobot.event.EventBus
import
io.reactivex.Observable
import
io.reactivex.android.schedulers.AndroidSchedulers
...
...
@@ -354,6 +354,7 @@ class NewMultiMessageFragment : BaseFragment() {
}
else
{
ToastUtil
.
toastShort
(
"请登录后再试"
)
}
NimUIKit
.
startYDLChatting
(
context
,
"4597318766"
,
SessionTypeEnum
.
Team
,
null
,
null
,
null
)
}
}
/**
...
...
m-im/src/main/java/com/yidianling/im/ui/page/fragment/ChatFragment.kt
View file @
a64527e7
...
...
@@ -7,12 +7,17 @@ import androidx.recyclerview.widget.LinearLayoutManager
import
com.jcodecraeer.xrecyclerview.CustomFooterViewCallBack
import
com.jcodecraeer.xrecyclerview.XRecyclerView
import
com.ydl.ydlcommon.base.BaseFragment
import
com.ydl.ydlcommon.data.http.BaseResponse
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.utils.NetworkParamsUtils
import
com.ydl.ydlcommon.utils.NetworkParamsUtils.getMaps
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.R
import
com.yidianling.im.bean.TeamAlreadyReadBean
import
com.yidianling.im.event.MessageListRefreshEvent
import
com.yidianling.im.helper.MsgReceiveHelper
import
com.yidianling.im.http.ImHttpImpl
import
com.yidianling.im.http.ImRetrofitApi
import
com.yidianling.im.router.ImIn
import
com.yidianling.im.ui.page.fragment.adapter.ChatAdapter
import
com.yidianling.im.ui.page.fragment.bean.ChatItemBean
...
...
@@ -21,6 +26,8 @@ import com.yidianling.im.ui.page.fragment.view.ChatFooterItemView
import
com.yidianling.im.ui.page.widget.ChatUnusualView
import
com.yidianling.im.ui.param.ChatParam
import
de.greenrobot.event.EventBus
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
kotlinx.android.synthetic.main.im_chat_fragment_layout.*
/**
...
...
@@ -87,7 +94,7 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
if
(
ImIn
.
getUserInfo
()
?.
uid
!=
"0"
)
{
var
dis
=
ImHttpImpl
.
getInstance
()
.
getAllChatMessage
(
ChatParam
(
"${ImIn.getUserInfo()?.uid}"
,
"${selectType}"
))
.
getAllChatMessage
(
ChatParam
(
"${ImIn.getUserInfo()?.uid}"
,
"${selectType}"
,
"1"
))
.
compose
(
RxUtils
.
applySchedulers
(
this
))
.
compose
<
ChatModelBean
>(
RxUtils
.
resultJavaData
())
.
subscribe
({
it
->
...
...
@@ -224,6 +231,12 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
getChatMessageData
()
}
})
chatAdapter
?.
setChatAitReadlistener
(
object
:
ChatAdapter
.
ChatAitAlreadyRead
{
override
fun
alreadyReadAit
(
tid
:
String
)
{
//群聊已读消息
TeamAlreadyRead
(
tid
)
}
})
chat_recyclerview
.
layoutManager
=
LinearLayoutManager
(
context
)
chat_recyclerview
.
adapter
=
chatAdapter
chat_recyclerview
.
setLoadingListener
(
this
)
...
...
@@ -241,6 +254,20 @@ class ChatFragment : BaseFragment(), XRecyclerView.LoadingListener {
})
}
private
fun
TeamAlreadyRead
(
tid
:
String
)
{
val
cmd
=
TeamAlreadyReadBean
(
tid
,
ImIn
.
getUserInfo
()
?.
uid
.
toString
())
val
disposable
=
ImRetrofitApi
.
getImJavaApi
().
teamChatALreadyRead
(
getMaps
(
cmd
))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
({
resp
:
BaseResponse
<
Any
>
->
}
)
{
throwable
:
Throwable
->
}
}
override
fun
onResume
()
{
super
.
onResume
()
resetPageShow
()
...
...
m-im/src/main/java/com/yidianling/im/ui/page/fragment/adapter/ChatAdapter.kt
View file @
a64527e7
...
...
@@ -15,6 +15,7 @@ import com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.ydl.ydlcommon.view.ListNoCancelDialog
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.api.param.RmHistoryParam
import
com.yidianling.im.api.param.RmTalkParam
import
com.yidianling.im.api.param.TopMessageParam
...
...
@@ -23,11 +24,15 @@ import com.yidianling.im.event.UpdateTabUnreadNumEvent
import
com.yidianling.im.helper.IMChatUtil
import
com.yidianling.im.helper.MsgReceiveHelper
import
com.yidianling.im.http.ImHttpImpl
import
com.yidianling.im.router.ImIn
import
com.yidianling.im.session.SessionHelper
import
com.yidianling.im.ui.page.fragment.bean.ChatItemBean
import
com.yidianling.im.ui.page.fragment.bean.ChatModelBean
import
com.yidianling.im.ui.page.fragment.view.ChatItemView
import
com.yidianling.im.ui.page.fragment.view.ChatTimeItemView
import
com.yidianling.im.ui.param.ChatParam
import
de.greenrobot.event.EventBus
import
kotlinx.android.synthetic.main.im_chat_fragment_layout.*
/**
* 互动列表适配器
...
...
@@ -63,7 +68,13 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
P2PCustomActionHandlerImpl
(
"4108805"
,
"课程小助手-壹壹"
,
"4108805"
))
}
else
{
// IMUtil.startChat(context as AppCompatActivity, mList[position].toUid.toString(), 0, 0, null, 0, true)
IMChatUtil
.
startChat
(
context
as
AppCompatActivity
,
mList
[
position
])
if
(
mList
[
position
].
chat_type
==
2
){
//群聊
mChatListener
?.
alreadyReadAit
(
mList
[
position
].
toUid
.
toString
())
SessionHelper
.
startTeamSession
(
context
,
mList
[
position
].
toUid
.
toString
())
}
else
{
//单聊
IMChatUtil
.
startChat
(
context
as
AppCompatActivity
,
mList
[
position
])
}
}
}
...
...
@@ -214,6 +225,16 @@ class ChatAdapter(var context: Context, private var mList: ArrayList<ChatItemBea
fun
onRefresh
()
//刷新聊天列表
}
private
var
mChatListener
:
ChatAitAlreadyRead
?
=
null
fun
setChatAitReadlistener
(
mChatListener
:
ChatAitAlreadyRead
)
{
this
.
mChatListener
=
mChatListener
}
interface
ChatAitAlreadyRead
{
fun
alreadyReadAit
(
tid
:
String
)
//群聊艾特符号
}
/**
* 互动列表正常item的holder
*/
...
...
m-im/src/main/java/com/yidianling/im/ui/page/fragment/bean/ChatItemBean.kt
View file @
a64527e7
...
...
@@ -20,7 +20,7 @@ class ChatItemBean(
var
timestamp
:
Long
=
0
.
toLong
(),
var
title
:
String
=
""
,
var
toName
:
String
=
""
,
var
toUid
:
Int
=
0
,
var
toUid
:
Long
=
0
,
var
type
:
Int
=
0
,
//私聊群聊type=3
var
utype
:
Int
=
0
,
var
timeStr
:
String
=
""
,
...
...
@@ -28,5 +28,6 @@ class ChatItemBean(
var
doctorTitle
:
String
=
""
,
var
isThreeItem
:
Boolean
=
false
,
//是否是三周前时间展示item
var
listenOrderStatus
:
Int
=
0
,
// 倾诉状态
var
orderStatus
:
Int
=
0
//咨询状态
var
orderStatus
:
Int
=
0
,
//咨询状态
var
noReadAtContent
:
String
?=
""
)
\ No newline at end of file
m-im/src/main/java/com/yidianling/im/ui/page/fragment/view/ChatItemView.kt
View file @
a64527e7
...
...
@@ -3,12 +3,11 @@ package com.yidianling.im.ui.page.fragment.view
import
android.content.Context
import
android.text.Html
import
android.view.View
import
android.view.ViewGroup
import
android.widget.LinearLayout
import
android.widget.RelativeLayout
import
com.netease.nimlib.sdk.NIMClient
import
com.netease.nimlib.sdk.team.TeamService
import
com.ydl.ydl_image.module.GlideApp
import
com.yidianling.im.R
import
com.yidianling.im.helper.MsgReceiveHelper
import
com.yidianling.im.preference.ImTempData
import
com.yidianling.im.ui.page.fragment.bean.ChatItemBean
import
kotlinx.android.synthetic.main.im_chat_item_view.view.*
...
...
@@ -73,25 +72,57 @@ class ChatItemView(mContext: Context) : LinearLayout(mContext) {
bean
.
toUid
.
toString
()
)
chat_message_content
.
setText
(
Html
.
fromHtml
(
th
))
}
else
if
(!
bean
.
noReadAtContent
.
isNullOrEmpty
()){
var
th
=
"<font color='#FF7766' charset='utf-8'>[有人@我]</font> "
+
bean
.
content
;
chat_message_content
.
setText
(
Html
.
fromHtml
(
th
));
}
else
{
chat_message_content
.
text
=
bean
.
content
}
if
(
bean
.
unReadNum
>
99
)
{
chat_message_unread_num
.
visibility
=
View
.
VISIBLE
chat_message_unread_num
.
text
=
"99+"
}
else
if
(
bean
.
unReadNum
>
0
)
{
chat_message_unread_num
.
visibility
=
View
.
VISIBLE
chat_message_unread_num
.
text
=
"${bean.unReadNum}"
}
else
{
chat_message_unread_num
.
visibility
=
View
.
GONE
}
if
(
bean
.
is_top
==
1
)
{
chat_global_ll
.
setBackgroundResource
(
R
.
drawable
.
im_chat_is_top_bg
)
}
else
{
chat_global_ll
.
setBackgroundResource
(
0
)
}
//如果是群聊 根据免打扰状态判断逻辑
if
(
bean
.
chat_type
==
2
){
val
notifyType
=
NIMClient
.
getService
(
TeamService
::
class
.
java
)
.
queryTeamBlock
(
bean
.
toUid
.
toString
()).
messageNotifyType
.
value
// 群消息提醒
if
(
notifyType
==
0
){
//有消息提醒
not_disturb
.
visibility
=
View
.
GONE
if
(
bean
.
unReadNum
>
99
)
{
chat_message_unread_num
.
visibility
=
View
.
VISIBLE
chat_message_unread_num
.
text
=
"99+"
}
else
if
(
bean
.
unReadNum
>
0
)
{
chat_message_unread_num
.
visibility
=
View
.
VISIBLE
chat_message_unread_num
.
text
=
"${bean.unReadNum}"
}
else
{
chat_message_unread_num
.
visibility
=
View
.
GONE
}
}
else
{
not_disturb
.
visibility
=
View
.
VISIBLE
if
(
bean
.
unReadNum
>
0
){
chat_message_unread_num
.
visibility
=
View
.
VISIBLE
chat_message_unread_num
.
text
=
""
}
else
{
chat_message_unread_num
.
visibility
=
View
.
GONE
}
}
}
else
{
if
(
bean
.
unReadNum
>
99
)
{
chat_message_unread_num
.
visibility
=
View
.
VISIBLE
chat_message_unread_num
.
text
=
"99+"
}
else
if
(
bean
.
unReadNum
>
0
)
{
chat_message_unread_num
.
visibility
=
View
.
VISIBLE
chat_message_unread_num
.
text
=
"${bean.unReadNum}"
}
else
{
chat_message_unread_num
.
visibility
=
View
.
GONE
}
not_disturb
.
visibility
=
View
.
GONE
}
}
}
...
...
m-im/src/main/java/com/yidianling/im/ui/param/ChatParam.kt
View file @
a64527e7
...
...
@@ -4,4 +4,4 @@ package com.yidianling.im.ui.param
* 消息列表请求参数 selectTab:0(全部),1(服务中),2(服务过)
* Created by xj on 2019/10/21.
*/
data class
ChatParam
(
var
uid
:
String
,
var
selectType
:
String
)
\ No newline at end of file
data class
ChatParam
(
var
uid
:
String
,
var
selectType
:
String
,
var
includeGroupChat
:
String
=
"1"
)
\ No newline at end of file
m-im/src/main/java/com/yidianling/uikit/business/ait/AitManager.java
View file @
a64527e7
...
...
@@ -176,7 +176,8 @@ public class AitManager implements TextWatcher {
if
(
s
.
toString
().
equals
(
"@"
))
{
// 启动@联系人界面
if
(!
TextUtils
.
isEmpty
(
tid
)
)
{
AitContactSelectorActivity
.
start
(
context
,
tid
);
//暂时注释艾特相关群成员功能
// AitContactSelectorActivity.start(context, tid);
}
}
aitContactsModel
.
onInsertText
(
start
,
s
.
toString
());
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLP2PMessageActivity.java
View file @
a64527e7
...
...
@@ -167,8 +167,10 @@ public class YDLP2PMessageActivity extends YDLBaseMessageActivity {
//读取未发送的临时消息
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
if
(
messageFragment
.
getInputPanel
().
getInputContent
()
==
null
||
messageFragment
.
getInputPanel
().
getInputContent
().
equals
(
""
))
{
messageFragment
.
getInputPanel
().
setInputContent
(
ActionHandlerStorage
.
getL
(
sessionId
).
getImTempData
(
sessionId
));
if
(
messageFragment
.
getInputPanel
()==
null
||
messageFragment
.
getInputPanel
().
getInputContent
()
==
null
||
messageFragment
.
getInputPanel
().
getInputContent
().
equals
(
""
))
{
if
(
messageFragment
.
getInputPanel
()!=
null
){
messageFragment
.
getInputPanel
().
setInputContent
(
ActionHandlerStorage
.
getL
(
sessionId
).
getImTempData
(
sessionId
));
}
}
if
(
ActionHandlerStorage
.
needLoadNewMsg
)
{
((
BaseFetchLoadAdapter
.
RequestFetchMoreListener
)
messageFragment
.
getMessageListPanelEx
().
getMessageLoder
(
null
)).
onFetchMoreRequested
();
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLTeamMessageActivity.java
View file @
a64527e7
...
...
@@ -216,7 +216,9 @@ public class YDLTeamMessageActivity extends YDLBaseMessageActivity {
team
=
d
;
fragment
.
setTeam
(
team
);
setTitle
(
team
==
null
?
sessionId
:
team
.
getName
()
+
"("
+
team
.
getMemberCount
()
+
"人)"
);
//暂时去掉群聊人数标题
// setTitle(team == null ? sessionId : team.getName() + "(" + team.getMemberCount() + "人)");
setTitle
(
team
==
null
?
sessionId
:
team
.
getName
()
);
invalidTeamTipText
.
setText
(
team
.
getType
()
==
TeamTypeEnum
.
Normal
?
R
.
string
.
im_normal_team_invalid_tip
:
R
.
string
.
im_team_invalid_tip
);
invalidTeamTipView
.
setVisibility
(
team
.
isMyTeam
()
?
View
.
GONE
:
View
.
VISIBLE
);
...
...
@@ -300,7 +302,7 @@ public class YDLTeamMessageActivity extends YDLBaseMessageActivity {
};
@Override
protected
YDLMessageFragment
fragment
()
{
protected
YDL
Team
MessageFragment
fragment
()
{
// 添加fragment
Bundle
arguments
=
getIntent
().
getExtras
();
arguments
.
putSerializable
(
Extras
.
EXTRA_TYPE
,
SessionTypeEnum
.
Team
);
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
View file @
a64527e7
...
...
@@ -4,9 +4,13 @@ import android.animation.Animator;
import
android.animation.ObjectAnimator
;
import
android.animation.ValueAnimator
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.content.DialogInterface
;
import
android.content.Intent
;
import
android.graphics.Color
;
import
android.media.AudioManager
;
import
android.net.Uri
;
import
android.os.Bundle
;
import
android.os.Handler
;
import
android.os.Message
;
...
...
@@ -22,12 +26,10 @@ import android.widget.LinearLayout;
import
android.widget.RelativeLayout
;
import
android.widget.TextView
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.AppCompatActivity
;
import
androidx.constraintlayout.widget.ConstraintLayout
;
import
androidx.recyclerview.widget.RecyclerView
;
import
com.alibaba.fastjson.JSON
;
import
com.google.gson.Gson
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.Observer
;
...
...
@@ -36,7 +38,6 @@ import com.netease.nimlib.sdk.ResponseCode;
import
com.netease.nimlib.sdk.msg.MessageBuilder
;
import
com.netease.nimlib.sdk.msg.MsgService
;
import
com.netease.nimlib.sdk.msg.MsgServiceObserve
;
import
com.netease.nimlib.sdk.msg.attachment.MsgAttachment
;
import
com.netease.nimlib.sdk.msg.constant.MsgStatusEnum
;
import
com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
;
import
com.netease.nimlib.sdk.msg.model.CustomMessageConfig
;
...
...
@@ -47,20 +48,28 @@ import com.netease.nimlib.sdk.uinfo.model.NimUserInfo;
import
com.ydl.webview.H5Params
;
import
com.ydl.webview.NewH5Activity
;
import
com.ydl.ydl_image.module.GlideApp
;
import
com.ydl.ydlcommon.base.config.HttpConfig
;
import
com.ydl.ydlcommon.data.PlatformDataManager
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.modular.ModularServiceManager
;
import
com.ydl.ydlcommon.ui.LoadingDialogFragment
;
import
com.ydl.ydlcommon.utils.AnimUtils
;
import
com.ydl.ydlcommon.utils.LogUtil
;
import
com.ydl.ydlcommon.utils.NetworkParamsUtils
;
import
com.ydl.ydlcommon.utils.SharedPreferencesEditor
;
import
com.ydl.ydlcommon.utils.YdlBuryPointUtil
;
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
;
import
com.ydl.ydlcommon.utils.log.AliYunLogConfig
;
import
com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
;
import
com.ydl.ydlcommon.utils.log.LogHelper
;
import
com.ydl.ydlcommon.utils.remind.HttpErrorUtils
;
import
com.ydl.ydlcommon.view.CircleImageView
;
import
com.ydl.ydlcommon.view.dialog.CommonDialog
;
import
com.ydl.ydlcommon.view.dialog.ListDialog
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.im.bean.RemoveHistory
;
import
com.yidianling.im.config.constants.ImConstants
;
import
com.yidianling.im.event.MultipleAnswerBean
;
import
com.yidianling.im.event.MultipleSelectedEvent
;
import
com.yidianling.im.helper.IMChatUtil
;
...
...
@@ -86,6 +95,7 @@ import com.yidianling.uikit.api.NimUIKitImpl;
import
com.yidianling.uikit.business.ait.AitManager
;
import
com.yidianling.uikit.business.session.activity.YDLBaseMessageActivity
;
import
com.yidianling.uikit.business.session.helper.ChatStatusCacheHelper
;
import
com.yidianling.uikit.business.session.helper.MessageListPanelHelper
;
import
com.yidianling.uikit.business.session.module.input.InputPanel
;
import
com.yidianling.uikit.business.session.module.list.MessageListPanelEx
;
import
com.yidianling.uikit.business.session.view.ChatPrivateTips
;
...
...
@@ -152,7 +162,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private
int
rvPaddingTop
;
private
RelativeLayout
rl_contain
;
private
boolean
initHeightFinish
;
public
TitleBarBottom
titleBar
;
public
InputPanel
getInputPanel
()
{
return
inputPanel
;
}
...
...
@@ -197,8 +207,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private
RelativeLayout
constraint_ll
;
private
LinearLayout
ll_info_detail
;
private
RelativeLayout
rela_zixun
;
protected
RelativeLayout
rela_zixun
;
private
ValueAnimator
anim_out
;
private
ObjectAnimator
sourceLayoutAnim
;
private
ValueAnimator
anim_in
;
...
...
@@ -245,9 +254,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
public
void
onActivityCreated
(
Bundle
savedInstanceState
)
{
super
.
onActivityCreated
(
savedInstanceState
);
parseIntent
();
TitleBarBottom
titleBar
=
((
YDLBaseMessageActivity
)
getActivity
()).
getTitleBarBottom
();
titleBar
=
((
YDLBaseMessageActivity
)
getActivity
()).
getTitleBarBottom
();
titleBar
.
setTitleLeftDraw
(
getResources
().
getDrawable
(
R
.
drawable
.
loading_01
));
titleBar
.
setTitle
(
"正在连接中..."
);
if
(
sessionType
==
SessionTypeEnum
.
Team
){
titleBar
.
setRightIcon
(
getContext
().
getDrawable
(
R
.
drawable
.
platform_common_more
));
}
fl_container
=
rootView
.
findViewById
(
R
.
id
.
message_activity_list_view_container
);
v_chattips
=
rootView
.
findViewById
(
R
.
id
.
v_chattips
);
lin_actions
=
rootView
.
findViewById
(
R
.
id
.
lin_actions
);
...
...
@@ -280,13 +293,13 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
question_multiple
=
rootView
.
findViewById
(
R
.
id
.
question_multiple
);
//做灵犀2.0 去掉常用语逻辑
//rl_common_question_enter.setVisibility(ActionHandlerStorage.getL(sessionId) != null && ActionHandlerStorage.getL(sessionId).getUserType() == 3 ? View.VISIBLE : View.GONE);
if
(
ActionHandlerStorage
.
getL
(
sessionId
).
getUserType
()
!=
2
)
{
if
(
null
!=
ActionHandlerStorage
.
getL
(
sessionId
)&&
ActionHandlerStorage
.
getL
(
sessionId
).
getUserType
()
!=
2
)
{
if
(
null
!=
getActivity
()
&&
null
!=
rela_zixun
)
{
rela_zixun
.
setVisibility
(
View
.
GONE
);
}
}
if
(
ActionHandlerStorage
.
getL
(
sessionId
).
isNotPrepare
())
{
if
(
null
!=
ActionHandlerStorage
.
getL
(
sessionId
)&&
ActionHandlerStorage
.
getL
(
sessionId
).
isNotPrepare
())
{
IMChatUtil
.
INSTANCE
.
prepareChatData
((
AppCompatActivity
)
getActivity
(),
sessionId
,
(
expertInfo
)
->
{
String
toUid
=
expertInfo
.
shareData
.
toUid
;
IP2PCustomActionHandler
handler
=
ActionHandlerStorage
.
getL
(
sessionId
);
...
...
@@ -303,6 +316,11 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
else
{
initView
();
}
//如果是群聊
if
(
SessionTypeEnum
.
Team
==
sessionType
){
rela_zixun
.
setVisibility
(
View
.
GONE
);
titleBar
.
setTitleRightDraw
(
null
);
}
}
@SuppressLint
(
"CheckResult"
)
...
...
@@ -348,7 +366,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
else
{
titleBar
.
setTitleRightDraw
(
getResources
().
getDrawable
(
R
.
drawable
.
im_erduoxiaolv
));
}
titleBar
.
setTitle
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
name
);
if
(
ActionHandlerStorage
.
getL
(
sessionId
)!=
null
){
titleBar
.
setTitle
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
name
);
}
// 初始化顶部专家信息栏
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
&&
ActionHandlerStorage
.
getL
(
sessionId
).
getUserType
()
==
2
)
{
top_expert_info_cl
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -398,7 +418,7 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
//初始化私聊页面配置
initDefaultConfig
();
if
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorId
!=
null
){
if
(
null
!=
ActionHandlerStorage
.
getL
(
sessionId
)&&
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorId
!=
null
){
// 获取专家是否在繁忙状态
ServiceImpl
.
Companion
.
getInstance
().
queryDoctorIsBusy
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorId
)
.
subscribeOn
(
Schedulers
.
io
())
...
...
@@ -410,7 +430,17 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
}
}
/**
* 是否隐藏输入框相关控件
*/
public
void
setGoneInput
(
boolean
isGone
){
if
(
isGone
){
inputPanel
.
messageInputBar
.
setVisibility
(
View
.
GONE
);
inputPanel
.
hideInputMethod
();
}
else
{
inputPanel
.
messageInputBar
.
setVisibility
(
View
.
VISIBLE
);
}
}
@SuppressLint
(
"CheckResult"
)
private
void
initDefaultConfig
()
{
ServiceImpl
.
Companion
.
getInstance
().
getChatViewConfig
()
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLTeamMessageFragment.java
View file @
a64527e7
package
com
.
yidianling
.
uikit
.
business
.
session
.
fragment
;
import
android.app.Activity
;
import
android.app.Dialog
;
import
android.os.Bundle
;
import
android.util.Log
;
import
android.view.View
;
import
androidx.annotation.Nullable
;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.RequestCallback
;
import
com.netease.nimlib.sdk.msg.MsgService
;
import
com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
;
import
com.netease.nimlib.sdk.msg.model.IMMessage
;
import
com.netease.nimlib.sdk.team.TeamService
;
import
com.netease.nimlib.sdk.team.constant.TeamMemberType
;
import
com.netease.nimlib.sdk.team.constant.TeamMessageNotifyTypeEnum
;
import
com.netease.nimlib.sdk.team.model.Team
;
import
com.netease.nimlib.sdk.team.model.TeamMember
;
import
com.ydl.ydlcommon.data.http.RxUtils
;
import
com.ydl.ydlcommon.ui.LoadingDialogFragment
;
import
com.ydl.ydlcommon.utils.NetworkParamsUtils
;
import
com.ydl.ydlcommon.utils.log.LogHelper
;
import
com.ydl.ydlcommon.utils.remind.HttpErrorUtils
;
import
com.ydl.ydlcommon.view.dialog.CommonDialog
;
import
com.ydl.ydlcommon.view.dialog.ListDialog
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.im.bean.RemoveHistory
;
import
com.yidianling.im.event.ChatGroupStatusEvent
;
import
com.yidianling.im.http.ImRetrofitApi
;
import
com.yidianling.im.router.ImIn
;
import
com.yidianling.nimbase.impl.cache.TeamDataCache
;
import
com.yidianling.uikit.api.NimUIKit
;
import
com.yidianling.uikit.business.session.helper.MessageListPanelHelper
;
import
com.yidianling.uikit.custom.widget.TitleBarBottom
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
import
de.greenrobot.event.EventBus
;
import
io.reactivex.android.schedulers.AndroidSchedulers
;
import
io.reactivex.disposables.Disposable
;
import
io.reactivex.schedulers.Schedulers
;
/**
* Created by zhoujianghua on 2015/9/10.
*/
...
...
@@ -21,6 +54,7 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
private
Team
team
;
@Override
public
boolean
isAllowSendMessage
(
IMMessage
message
)
{
TeamMember
teamMember
=
TeamDataCache
.
getInstance
().
getTeamMember
(
team
.
getId
(),
NimUIKit
.
getAccount
());
...
...
@@ -35,6 +69,12 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
}
@Override
public
void
onResume
()
{
super
.
onResume
();
getChatGroupMute
();
}
@Override
public
boolean
sendMessage
(
IMMessage
message
)
{
if
(!
isAllowSendMessage
(
message
))
{
return
false
;
...
...
@@ -49,9 +89,146 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
return
super
.
sendMessage
(
message
);
}
@Override
public
void
onActivityCreated
(
Bundle
savedInstanceState
)
{
super
.
onActivityCreated
(
savedInstanceState
);
titleBar
.
setOnRightTextClick
(
new
TitleBarBottom
.
OnTitleBarTextClick
()
{
@Override
public
void
onClick
(
View
view
,
boolean
isActive
)
{
List
<
String
>
list
=
new
ArrayList
<>();
int
notifyType
=
NIMClient
.
getService
(
TeamService
.
class
).
queryTeamBlock
(
sessionId
).
getMessageNotifyType
().
getValue
();
// 群消息提醒
// if (ImConstants.KEFUXIAOYI.equals(toChatUsername) || "4108805".equals(toChatUsername)) {
// list.add("历史聊天记录");
// list.add("客服热线");
// } else {
if
(
notifyType
==
0
){
list
.
add
(
"关闭群消息提醒"
);
}
else
{
list
.
add
(
"开启群消息提醒"
);
}
list
.
add
(
"投诉反馈"
);
//
// list.add("历史聊天记录");
// list.add("删除聊天记录");
// }
list
.
add
(
"删除聊天记录"
);
ListDialog
.
Builder
dialog
=
new
ListDialog
.
Builder
(
getContext
(),
list
,
0
);
list
.
add
(
"取消"
);
dialog
.
create
().
show
();
dialog
.
SetOnItemClickLister
(
new
ListDialog
.
Builder
.
OnItemClickLister
()
{
@Override
public
void
onItemClick
(
Dialog
dialog
,
View
view
,
int
position
)
{
LogHelper
.
Companion
.
getInstance
().
writeLogSync
(
String
.
format
(
"聊天界面:%s"
,
list
.
get
(
position
)));
switch
(
list
.
get
(
position
))
{
case
"开启群消息提醒"
:
case
"关闭群消息提醒"
:
OpenCloseTeamMute
(
notifyType
);
break
;
case
"投诉反馈"
:
ImIn
.
INSTANCE
.
feedBackIntent
((
Activity
)
getContext
());
break
;
case
"返回首页"
:
ImIn
.
INSTANCE
.
mainIntent
(
getContext
(),
0
);
break
;
case
"客服热线"
:
// showCallDialog();
break
;
case
"历史聊天记录"
:
// historyMsg();
break
;
case
"删除聊天记录"
:
deleteChatHistory
();
break
;
case
"ta的主页"
:
// showUserHome();
break
;
case
"取消"
:
break
;
}
dialog
.
dismiss
();
}
@Override
public
void
onItemLongClick
(
Dialog
dialog
,
View
view
,
int
position
)
{
}
});
}
});
}
private
void
OpenCloseTeamMute
(
int
notifyType
)
{
TeamMessageNotifyTypeEnum
type
=
TeamMessageNotifyTypeEnum
.
All
;
if
(
notifyType
==
0
){
type
=
TeamMessageNotifyTypeEnum
.
Mute
;
}
NIMClient
.
getService
(
TeamService
.
class
).
muteTeam
(
team
.
getId
(),
type
).
setCallback
(
new
RequestCallback
<
Void
>()
{
@Override
public
void
onSuccess
(
Void
param
)
{
ToastUtil
.
toastShort
(
"成功"
);
// 设置成功
}
@Override
public
void
onFailed
(
int
code
)
{
ToastUtil
.
toastShort
(
code
+
""
);
// 设置失败
}
@Override
public
void
onException
(
Throwable
exception
)
{
// 错误
}
});
}
public
void
onEventMainThread
(
ChatGroupStatusEvent
event
){
getChatGroupMute
();
}
//获取群聊是否全员禁言
private
void
getChatGroupMute
(){
boolean
mute
=
NIMClient
.
getService
(
TeamService
.
class
).
queryTeamBlock
(
sessionId
).
isAllMute
();
setGoneInput
(
mute
);
}
public
void
setTeam
(
Team
team
)
{
Log
.
e
(
"hzs"
,
"-------------setTeam------------TeammessageFragment"
);
this
.
team
=
team
;
}
/**
* 删除聊天记录
*/
private
void
deleteChatHistory
()
{
CommonDialog
dialog
=
CommonDialog
.
create
(
getContext
());
dialog
.
setMessage
(
"确定删除与ta的聊天记录?"
);
dialog
.
setCancelAble
(
true
);
dialog
.
setLeftOnclick
(
"再考虑下"
,
v
->
dialog
.
dismiss
());
dialog
.
setRightClick
(
"立即删除"
,
v
->
{
LoadingDialogFragment
loadingDialog
=
LoadingDialogFragment
.
Companion
.
newInstance
(
"正在删除"
);
loadingDialog
.
show
(((
AppCompatActivity
)
getContext
()).
getSupportFragmentManager
(),
null
);
RemoveHistory
cmd
=
new
RemoveHistory
();
cmd
.
toUid
=
team
.
getId
();
cmd
.
type
=
1
;
Disposable
disposable
=
ImRetrofitApi
.
Companion
.
getImRetrofitApi
().
rmHistory
(
NetworkParamsUtils
.
getMaps
(
cmd
))
.
subscribeOn
(
Schedulers
.
io
())
.
compose
(
RxUtils
.
INSTANCE
.
resultData
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
objectBaseResponse
->
{
loadingDialog
.
hide
();
ToastUtil
.
toastShort
(
"聊天记录已删除"
);
NIMClient
.
getService
(
MsgService
.
class
).
clearChattingHistory
(
cmd
.
toUid
,
SessionTypeEnum
.
P2P
);
MessageListPanelHelper
.
getInstance
().
notifyClearMessages
(
cmd
.
toUid
);
},
throwable
->
{
loadingDialog
.
hide
();
HttpErrorUtils
.
Companion
.
handleError
(
getContext
(),
throwable
);
});
});
dialog
.
show
();
}
}
\ No newline at end of file
m-im/src/main/java/com/yidianling/uikit/business/session/helper/TeamNotificationHelper.java
View file @
a64527e7
...
...
@@ -14,12 +14,15 @@ import com.netease.nimlib.sdk.team.model.MuteMemberAttachment;
import
com.netease.nimlib.sdk.team.model.Team
;
import
com.netease.nimlib.sdk.team.model.UpdateTeamAttachment
;
import
com.yidianling.im.R
;
import
com.yidianling.im.event.ChatGroupStatusEvent
;
import
com.yidianling.uikit.api.NimUIKit
;
import
com.yidianling.uikit.business.team.helper.TeamHelper
;
import
java.util.List
;
import
java.util.Map
;
import
de.greenrobot.event.EventBus
;
/**
* 系统消息描述文本构造器。主要是将各个系统消息转换为显示的文本内容。<br>
* Created by huangjun on 2015/3/11.
...
...
@@ -199,8 +202,10 @@ public class TeamNotificationHelper {
if
(
teamAllMuteModeEnum
==
TeamAllMuteModeEnum
.
Cancel
)
{
sb
.
append
(
"取消群全员禁言"
);
}
else
{
sb
.
append
(
"群
全员禁言
"
);
sb
.
append
(
"群
聊已结束,如有问题请联系个案管理师
"
);
}
//发送通知告知群聊界面全员禁言或者取消全员禁言
EventBus
.
getDefault
().
post
(
new
ChatGroupStatusEvent
());
}
else
{
sb
.
append
(
"群"
+
field
.
getKey
()
+
"被更新为 "
+
field
.
getValue
());
}
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/module/input/InputPanel.java
View file @
a64527e7
...
...
@@ -57,7 +57,6 @@ import com.yidianling.nimbase.common.util.string.StringUtil;
import
com.yidianling.uikit.api.NimUIKit
;
import
com.yidianling.uikit.api.NimUIKitImpl
;
import
com.yidianling.uikit.business.ait.AitTextChangeListener
;
import
com.yidianling.uikit.custom.bridge.ActionHandlerStorage
;
import
com.yidianling.uikit.custom.widget.SafeHelpRemindDialog
;
import
java.io.File
;
...
...
@@ -104,7 +103,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
protected
View
sendMessageButtonInInputBar
;
/***发送消息按钮*/
protected
View
emojiButtonInInputBar
;
p
rotected
View
messageInputBar
;
p
ublic
View
messageInputBar
;
protected
View
messageEditLL
;
protected
FrameLayout
audioTextSwitchLayout
;
...
...
@@ -407,10 +406,10 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
//验证用户是否已经绑定手机,若没有绑定则弹出提示
// 账户信息是null时 判断是否是聊天室 不是聊天室提示用户退出重试
if
(
ActionHandlerStorage
.
getL
(
container
.
account
)
==
null
&&
container
.
sessionType
!=
SessionTypeEnum
.
ChatRoom
)
{
ToastUtil
.
toastShort
(
"请退出聊天界面重试"
);
return
;
}
//
if (ActionHandlerStorage.getL(container.account) == null && container.sessionType != SessionTypeEnum.ChatRoom) {
//
ToastUtil.toastShort("请退出聊天界面重试");
//
return;
//
}
if
(
v
==
switchToTextButtonInInputBar
)
{
switchToTextLayout
(
true
);
// 显示文本发送的布局
...
...
@@ -657,7 +656,7 @@ public class InputPanel implements IEmoticonSelectedListener, IAudioRecordCallba
/**
* 隐藏键盘布局
*/
p
rivate
void
hideInputMethod
()
{
p
ublic
void
hideInputMethod
()
{
isKeyboardShowed
=
false
;
uiHandler
.
removeCallbacks
(
showTextRunnable
);
InputMethodManager
imm
=
(
InputMethodManager
)
container
.
activity
.
getSystemService
(
Context
.
INPUT_METHOD_SERVICE
);
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/viewholder/MsgViewHolderNotification.java
View file @
a64527e7
...
...
@@ -2,6 +2,8 @@ package com.yidianling.uikit.business.session.viewholder;
import
android.text.method.LinkMovementMethod
;
import
android.text.style.ImageSpan
;
import
android.view.View
;
import
android.widget.ImageView
;
import
android.widget.TextView
;
import
com.yidianling.im.R
;
...
...
@@ -16,6 +18,7 @@ public class MsgViewHolderNotification extends MsgViewHolderBase {
}
protected
TextView
notificationTextView
;
protected
ImageView
ivLabel
;
@Override
protected
int
getContentResId
()
{
...
...
@@ -25,6 +28,8 @@ public class MsgViewHolderNotification extends MsgViewHolderBase {
@Override
protected
void
inflateContentView
()
{
notificationTextView
=
(
TextView
)
view
.
findViewById
(
R
.
id
.
message_item_notification_label
);
ivLabel
=
view
.
findViewById
(
R
.
id
.
iv_label
);
}
@Override
...
...
@@ -39,6 +44,12 @@ public class MsgViewHolderNotification extends MsgViewHolderBase {
private
void
handleTextNotification
(
String
text
)
{
MoonUtil
.
identifyFaceExpressionAndATags
(
context
,
notificationTextView
,
text
,
ImageSpan
.
ALIGN_BOTTOM
);
notificationTextView
.
setMovementMethod
(
LinkMovementMethod
.
getInstance
());
if
(
getDisplayText
().
contains
(
"群聊已结束"
)){
ivLabel
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
ivLabel
.
setVisibility
(
View
.
GONE
);
}
}
@Override
...
...
m-im/src/main/java/com/yidianling/uikit/business/team/helper/TeamCreateHelper.java
0 → 100644
View file @
a64527e7
package
com
.
yidianling
.
uikit
.
business
.
team
.
helper
;
import
android.content.Context
;
import
android.os.Handler
;
import
android.util.Log
;
import
com.netease.nimlib.sdk.NIMClient
;
import
com.netease.nimlib.sdk.RequestCallback
;
import
com.netease.nimlib.sdk.ResponseCode
;
import
com.netease.nimlib.sdk.msg.MessageBuilder
;
import
com.netease.nimlib.sdk.msg.MsgService
;
import
com.netease.nimlib.sdk.msg.constant.MsgStatusEnum
;
import
com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
;
import
com.netease.nimlib.sdk.msg.model.CustomMessageConfig
;
import
com.netease.nimlib.sdk.msg.model.IMMessage
;
import
com.netease.nimlib.sdk.team.TeamService
;
import
com.netease.nimlib.sdk.team.constant.TeamBeInviteModeEnum
;
import
com.netease.nimlib.sdk.team.constant.TeamFieldEnum
;
import
com.netease.nimlib.sdk.team.constant.TeamTypeEnum
;
import
com.netease.nimlib.sdk.team.model.CreateTeamResult
;
import
com.netease.nimlib.sdk.team.model.Team
;
import
com.yidianling.common.tools.LogUtil
;
import
com.yidianling.common.tools.ToastUtil
;
import
com.yidianling.im.R
;
import
com.yidianling.im.session.SessionHelper
;
import
com.yidianling.nimbase.common.ToastHelper
;
import
com.yidianling.nimbase.common.ui.dialog.DialogMaker
;
import
java.io.Serializable
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.List
;
import
java.util.Map
;
/**
* Created by hzxuwen on 2015/9/25.
*/
public
class
TeamCreateHelper
{
private
static
final
String
TAG
=
TeamCreateHelper
.
class
.
getSimpleName
();
private
static
final
int
DEFAULT_TEAM_CAPACITY
=
200
;
/**
* 创建讨论组
*/
public
static
void
createNormalTeam
(
final
Context
context
,
List
<
String
>
memberAccounts
,
final
boolean
isNeedBack
,
final
RequestCallback
<
CreateTeamResult
>
callback
)
{
String
teamName
=
"讨论组"
;
DialogMaker
.
showProgressDialog
(
context
,
context
.
getString
(
R
.
string
.
empty
),
true
);
// 创建群
HashMap
<
TeamFieldEnum
,
Serializable
>
fields
=
new
HashMap
<
TeamFieldEnum
,
Serializable
>();
fields
.
put
(
TeamFieldEnum
.
Name
,
teamName
);
NIMClient
.
getService
(
TeamService
.
class
).
createTeam
(
fields
,
TeamTypeEnum
.
Normal
,
""
,
memberAccounts
).
setCallback
(
new
RequestCallback
<
CreateTeamResult
>()
{
@Override
public
void
onSuccess
(
CreateTeamResult
result
)
{
DialogMaker
.
dismissProgressDialog
();
ArrayList
<
String
>
failedAccounts
=
result
.
getFailedInviteAccounts
();
if
(
failedAccounts
!=
null
&&
!
failedAccounts
.
isEmpty
())
{
TeamHelper
.
onMemberTeamNumOverrun
(
failedAccounts
,
context
);
}
else
{
ToastUtil
.
toastShort
(
"创建群聊成功"
);
}
if
(
isNeedBack
)
{
// SessionHelper.startTeamSession(context, result.getTeam().getId(), MainActivity.class, null); // 进入创建的群
LogUtil
.
e
(
"进入创建的群:"
+
result
.
getTeam
().
getId
());
}
else
{
SessionHelper
.
startTeamSession
(
context
,
result
.
getTeam
().
getId
());
}
if
(
callback
!=
null
)
{
callback
.
onSuccess
(
result
);
}
}
@Override
public
void
onFailed
(
int
code
)
{
DialogMaker
.
dismissProgressDialog
();
if
(
code
==
ResponseCode
.
RES_TEAM_ECOUNT_LIMIT
)
{
ToastUtil
.
toastShort
(
"已达到人数限制"
);
}
else
{
ToastUtil
.
toastShort
(
"创建群聊失败:code="
+
code
);
}
Log
.
e
(
TAG
,
"create team error: "
+
code
);
}
@Override
public
void
onException
(
Throwable
exception
)
{
DialogMaker
.
dismissProgressDialog
();
}
}
);
}
/**
* 创建高级群
*/
public
static
void
createAdvancedTeam
(
final
Context
context
,
List
<
String
>
memberAccounts
)
{
String
teamName
=
"高级群"
;
ToastUtil
.
toastShort
(
"创建中。。。。"
);
// 创建群
TeamTypeEnum
type
=
TeamTypeEnum
.
Advanced
;
HashMap
<
TeamFieldEnum
,
Serializable
>
fields
=
new
HashMap
<>();
fields
.
put
(
TeamFieldEnum
.
Name
,
teamName
);
fields
.
put
(
TeamFieldEnum
.
BeInviteMode
,
TeamBeInviteModeEnum
.
NoAuth
);
NIMClient
.
getService
(
TeamService
.
class
).
createTeam
(
fields
,
type
,
""
,
memberAccounts
).
setCallback
(
new
RequestCallback
<
CreateTeamResult
>()
{
@Override
public
void
onSuccess
(
CreateTeamResult
result
)
{
Log
.
i
(
TAG
,
"create team success, team id ="
+
result
.
getTeam
().
getId
()
+
", now begin to update property..."
);
onCreateSuccess
(
context
,
result
);
}
@Override
public
void
onFailed
(
int
code
)
{
DialogMaker
.
dismissProgressDialog
();
String
tip
;
if
(
code
==
ResponseCode
.
RES_TEAM_ECOUNT_LIMIT
)
{
tip
=
"邀请失败成员人数上限为200人"
;
}
else
if
(
code
==
ResponseCode
.
RES_TEAM_LIMIT
)
{
tip
=
"创建失败,创建群数量达到限制"
;
}
else
{
tip
=
"创建失败code:"
+
code
;
}
ToastHelper
.
showToast
(
context
,
tip
);
Log
.
e
(
TAG
,
"create team error: "
+
code
);
}
@Override
public
void
onException
(
Throwable
exception
)
{
DialogMaker
.
dismissProgressDialog
();
}
}
);
}
/**
* 群创建成功回调
*/
private
static
void
onCreateSuccess
(
final
Context
context
,
CreateTeamResult
result
)
{
if
(
result
==
null
)
{
Log
.
e
(
TAG
,
"onCreateSuccess exception: team is null"
);
return
;
}
final
Team
team
=
result
.
getTeam
();
if
(
team
==
null
)
{
Log
.
e
(
TAG
,
"onCreateSuccess exception: team is null"
);
return
;
}
Log
.
i
(
TAG
,
"create and update team success"
);
DialogMaker
.
dismissProgressDialog
();
// 检查有没有邀请失败的成员
ArrayList
<
String
>
failedAccounts
=
result
.
getFailedInviteAccounts
();
if
(
failedAccounts
!=
null
&&
!
failedAccounts
.
isEmpty
())
{
TeamHelper
.
onMemberTeamNumOverrun
(
failedAccounts
,
context
);
}
else
{
ToastUtil
.
toastShort
(
"创建高级群成功"
);
}
// 演示:向群里插入一条Tip消息,使得该群能立即出现在最近联系人列表(会话列表)中,满足部分开发者需求
Map
<
String
,
Object
>
content
=
new
HashMap
<>(
1
);
content
.
put
(
"content"
,
"成功创建高级群"
);
IMMessage
msg
=
MessageBuilder
.
createTipMessage
(
team
.
getId
(),
SessionTypeEnum
.
Team
);
msg
.
setRemoteExtension
(
content
);
CustomMessageConfig
config
=
new
CustomMessageConfig
();
config
.
enableUnreadCount
=
false
;
msg
.
setConfig
(
config
);
msg
.
setStatus
(
MsgStatusEnum
.
success
);
NIMClient
.
getService
(
MsgService
.
class
).
saveMessageToLocal
(
msg
,
true
);
// 发送后,稍作延时后跳转
new
Handler
(
context
.
getMainLooper
()).
postDelayed
(
new
Runnable
()
{
@Override
public
void
run
()
{
SessionHelper
.
startTeamSession
(
context
,
team
.
getId
());
// 进入创建的群
}
},
50
);
}
}
m-im/src/main/res/drawable-xhdpi/ic_group_chat_end.png
0 → 100644
View file @
a64527e7
1.04 KB
m-im/src/main/res/drawable-xhdpi/team_not_disturb.png
0 → 100644
View file @
a64527e7
1.15 KB
m-im/src/main/res/layout/im_chat_item_view.xml
View file @
a64527e7
...
...
@@ -112,19 +112,42 @@
android:textColor=
"#999999"
android:textSize=
"11dp"
/>
</LinearLayout>
<TextView
android:id=
"@+id/chat_message_content"
android:layout_width=
"wrap_content"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:
layout_marginBottom=
"18dp
"
android:
layout_marginRight=
"35dp
"
android:
orientation=
"horizontal
"
android:
gravity=
"center
"
android:layout_marginTop=
"5dp"
android:ellipsize=
"end"
android:maxLines=
"1"
android:text=
"你好,请问你遇到了什么烦恼?我可你好,请问你遇到了什么烦恼?我可以帮…"
android:textColor=
"#999999"
android:textSize=
"14dp"
/>
>
<TextView
android:id=
"@+id/chat_message_content"
android:layout_width=
"0dp"
android:layout_height=
"wrap_content"
app:layout_constraintTop_toTopOf=
"parent"
app:layout_constraintStart_toStartOf=
"parent"
app:layout_constraintBottom_toBottomOf=
"parent"
app:layout_constraintEnd_toStartOf=
"@id/not_disturb"
android:layout_marginEnd=
"@dimen/platform_dp_10"
android:layout_marginBottom=
"18dp"
android:ellipsize=
"end"
android:includeFontPadding=
"false"
android:layout_toLeftOf=
"@id/not_disturb"
android:maxLines=
"1"
android:text=
"你好,请问你遇到了什么烦恼?我可你好,请问你遇到了什么烦恼?我可以帮…"
android:textColor=
"#999999"
android:textSize=
"14dp"
/>
<ImageView
android:layout_width=
"@dimen/platform_dp_15"
android:layout_height=
"@dimen/platform_dp_15"
android:src=
"@drawable/team_not_disturb"
app:layout_constraintEnd_toEndOf=
"parent"
app:layout_constraintTop_toTopOf=
"@id/chat_message_content"
app:layout_constraintBottom_toBottomOf=
"@id/chat_message_content"
android:id=
"@+id/not_disturb"
android:visibility=
"gone"
>
</ImageView>
</androidx.constraintlayout.widget.ConstraintLayout>
<View
android:layout_width=
"match_parent"
...
...
m-im/src/main/res_uikit/layout/im_nim_message_item_notification.xml
View file @
a64527e7
<?xml version="1.0" encoding="utf-8"?>
<merge
xmlns:android=
"http://schemas.android.com/apk/res/android"
>
<TextView
android:id=
"@+id/message_item_notification_label"
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"7dip"
android:layout_marginRight=
"7dip"
android:orientation=
"horizontal"
android:background=
"@drawable/im_nim_bg_message_tip"
android:gravity=
"center"
android:paddingLeft=
"7dip"
android:paddingRight=
"7dip"
android:textColor=
"#ffffff"
android:textSize=
"12sp"
/>
>
</merge>
<ImageView
android:id=
"@+id/iv_label"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:visibility=
"gone"
android:src=
"@drawable/ic_group_chat_end"
/>
<TextView
android:id=
"@+id/message_item_notification_label"
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:layout_marginLeft=
"7dp"
android:layout_marginRight=
"7dp"
android:includeFontPadding=
"false"
android:textColor=
"#ffffff"
android:textSize=
"12sp"
/>
</LinearLayout>
</merge>
\ No newline at end of file
m-im/src/main/res_uikit/layout/im_ydl_nim_message_fragment.xml
View file @
a64527e7
...
...
@@ -607,7 +607,6 @@
android:layout_marginEnd=
"@dimen/platform_dp_12"
android:layout_marginBottom=
"@dimen/platform_dp_8"
>
</TextView>
<FrameLayout
android:id=
"@+id/fl_question_content"
...
...
@@ -615,9 +614,6 @@
android:layout_height=
"wrap_content"
android:background=
"@color/white"
android:visibility=
"gone"
/>
<include
layout=
"@layout/im_nim_message_activity_bottom_layout"
/>
</LinearLayout>
m-user/src/main/java/com/yidianling/user/mine/AccountSettingActivity.java
View file @
a64527e7
...
...
@@ -325,6 +325,7 @@ public class AccountSettingActivity extends BaseActivity implements View.OnClick
return
;
}
userHttp
.
bindQQ
(
new
BindQQ
(
map
.
get
(
"openid"
),
map
.
get
(
"unionid"
)))
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
o
->
{
dismissProgressDialog
();
...
...
ydl-net/src/main/java/com/ydl/ydlnet/builder/interceptor/log/DefaultFormatPrinter.java
View file @
a64527e7
...
...
@@ -52,14 +52,14 @@ public class DefaultFormatPrinter {
public
void
printJsonRequest
(
@NonNull
Request
request
,
@NonNull
String
bodyString
)
{
final
String
requestBody
=
LINE_SEPARATOR
+
BODY_TAG
+
LINE_SEPARATOR
+
bodyString
;
final
String
tag
=
getTag
(
true
);
NetLogUtils
.
debugInfo
(
tag
,
REQUEST_UP_LINE
);
logLines
(
tag
,
new
String
[]{
URL_TAG
+
request
.
url
()},
false
);
logLines
(
tag
,
getRequest
(
request
),
true
);
logLines
(
tag
,
requestBody
.
split
(
LINE_SEPARATOR
),
true
);
if
(!
request
.
url
().
toString
().
contains
(
"writemaidiandata"
)){
if
(!
request
.
url
().
toString
().
contains
(
"writeMaiDianData"
)){
NetLogUtils
.
debugInfo
(
tag
,
REQUEST_UP_LINE
);
logLines
(
tag
,
new
String
[]{
URL_TAG
+
request
.
url
()},
false
);
logLines
(
tag
,
getRequest
(
request
),
true
);
logLines
(
tag
,
requestBody
.
split
(
LINE_SEPARATOR
),
true
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
}
}
/**
...
...
@@ -70,12 +70,14 @@ public class DefaultFormatPrinter {
public
void
printFileRequest
(
@NonNull
Request
request
)
{
final
String
tag
=
getTag
(
true
);
if
(!
request
.
url
().
toString
().
contains
(
"writeMaiDianData"
)){
NetLogUtils
.
debugInfo
(
tag
,
REQUEST_UP_LINE
);
logLines
(
tag
,
new
String
[]{
URL_TAG
+
request
.
url
()},
false
);
logLines
(
tag
,
getRequest
(
request
),
true
);
logLines
(
tag
,
OMITTED_REQUEST
,
true
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
}
NetLogUtils
.
debugInfo
(
tag
,
REQUEST_UP_LINE
);
logLines
(
tag
,
new
String
[]{
URL_TAG
+
request
.
url
()},
false
);
logLines
(
tag
,
getRequest
(
request
),
true
);
logLines
(
tag
,
OMITTED_REQUEST
,
true
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
}
/**
...
...
@@ -100,12 +102,13 @@ public class DefaultFormatPrinter {
final
String
responseBody
=
LINE_SEPARATOR
+
BODY_TAG
+
LINE_SEPARATOR
+
bodyString
;
final
String
tag
=
getTag
(
false
);
final
String
[]
urlLine
=
{
URL_TAG
+
responseUrl
,
N
};
NetLogUtils
.
debugInfo
(
tag
,
RESPONSE_UP_LINE
);
logLines
(
tag
,
urlLine
,
true
);
logLines
(
tag
,
getResponse
(
headers
,
chainMs
,
code
,
isSuccessful
,
segments
,
message
),
true
);
logLines
(
tag
,
responseBody
.
split
(
LINE_SEPARATOR
),
true
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
if
(!
responseUrl
.
contains
(
"writeMaiDianData"
)){
NetLogUtils
.
debugInfo
(
tag
,
RESPONSE_UP_LINE
);
logLines
(
tag
,
urlLine
,
true
);
logLines
(
tag
,
getResponse
(
headers
,
chainMs
,
code
,
isSuccessful
,
segments
,
message
),
true
);
logLines
(
tag
,
responseBody
.
split
(
LINE_SEPARATOR
),
true
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
}
}
/**
...
...
@@ -124,12 +127,13 @@ public class DefaultFormatPrinter {
@NonNull
List
<
String
>
segments
,
@NonNull
String
message
,
@NonNull
final
String
responseUrl
)
{
final
String
tag
=
getTag
(
false
);
final
String
[]
urlLine
=
{
URL_TAG
+
responseUrl
,
N
};
NetLogUtils
.
debugInfo
(
tag
,
RESPONSE_UP_LINE
);
logLines
(
tag
,
urlLine
,
true
);
logLines
(
tag
,
getResponse
(
headers
,
chainMs
,
code
,
isSuccessful
,
segments
,
message
),
true
);
logLines
(
tag
,
OMITTED_RESPONSE
,
true
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
if
(!
responseUrl
.
contains
(
"writeMaiDianData"
)){
NetLogUtils
.
debugInfo
(
tag
,
RESPONSE_UP_LINE
);
logLines
(
tag
,
urlLine
,
true
);
logLines
(
tag
,
getResponse
(
headers
,
chainMs
,
code
,
isSuccessful
,
segments
,
message
),
true
);
logLines
(
tag
,
OMITTED_RESPONSE
,
true
);
NetLogUtils
.
debugInfo
(
tag
,
END_LINE
);
}
}
/**
...
...
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