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
392cdfd7
Commit
392cdfd7
authored
Apr 15, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:删除聊天记录、群聊艾特我、群聊已读相关的
parent
578b8e94
Hide whitespace changes
Inline
Side-by-side
Showing
22 changed files
with
278 additions
and
153 deletions
+278
-153
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
ChatFragment.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/ChatFragment.kt
+27
-0
ChatAdapter.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/adapter/ChatAdapter.kt
+19
-2
ChatItemBean.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/bean/ChatItemBean.kt
+3
-1
ChatItemView.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/view/ChatItemView.kt
+3
-0
YDLP2PMessageActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLP2PMessageActivity.java
+4
-2
YDLMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
+13
-96
YDLTeamMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLTeamMessageFragment.java
+139
-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
+2
-2
MsgViewHolderNotification.java
m-im/src/main/java/com/yidianling/uikit/business/session/viewholder/MsgViewHolderNotification.java
+11
-0
ic_group_chat_end.png
m-im/src/main/res/drawable-xhdpi/ic_group_chat_end.png
+0
-0
im_background_team_over.xml
m-im/src/main/res_uikit/drawable/im_background_team_over.xml
+0
-10
im_nim_message_activity_bottom_layout.xml
m-im/src/main/res_uikit/layout/im_nim_message_activity_bottom_layout.xml
+0
-1
im_nim_message_activity_team_over_layout.xml
m-im/src/main/res_uikit/layout/im_nim_message_activity_team_over_layout.xml
+0
-25
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
No files found.
config.gradle
View file @
392cdfd7
...
...
@@ -44,7 +44,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
=
[
...
...
@@ -127,7 +127,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 @
392cdfd7
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 @
392cdfd7
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 @
392cdfd7
...
...
@@ -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 @
392cdfd7
...
...
@@ -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 @
392cdfd7
...
...
@@ -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/ui/page/fragment/ChatFragment.kt
View file @
392cdfd7
...
...
@@ -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.*
/**
...
...
@@ -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 @
392cdfd7
...
...
@@ -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,9 +68,11 @@ 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)
if
(
mList
[
position
].
chat_type
==
2
){
if
(
mList
[
position
].
chat_type
==
2
){
//群聊
mChatListener
?.
alreadyReadAit
(
mList
[
position
].
toUid
.
toString
())
SessionHelper
.
startTeamSession
(
context
,
mList
[
position
].
toUid
.
toString
())
}
else
{
}
else
{
//单聊
IMChatUtil
.
startChat
(
context
as
AppCompatActivity
,
mList
[
position
])
}
}
...
...
@@ -218,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 @
392cdfd7
...
...
@@ -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 @
392cdfd7
...
...
@@ -73,6 +73,9 @@ 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
}
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLP2PMessageActivity.java
View file @
392cdfd7
...
...
@@ -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/fragment/YDLMessageFragment.java
View file @
392cdfd7
...
...
@@ -162,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
;
}
...
...
@@ -208,8 +208,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
private
LinearLayout
ll_info_detail
;
protected
RelativeLayout
rela_zixun
;
private
LinearLayout
team_over_end
;
private
RelativeLayout
textMessageLayout
;
private
ValueAnimator
anim_out
;
private
ObjectAnimator
sourceLayoutAnim
;
private
ValueAnimator
anim_in
;
...
...
@@ -256,70 +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
));
}
titleBar
.
setOnRightTextClick
(
new
TitleBarBottom
.
OnTitleBarTextClick
()
{
@Override
public
void
onClick
(
View
view
,
boolean
isActive
)
{
List
<
String
>
list
=
new
ArrayList
<>();
// if (ImConstants.KEFUXIAOYI.equals(toChatUsername) || "4108805".equals(toChatUsername)) {
// list.add("历史聊天记录");
// list.add("客服热线");
// } else {
// 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
"投诉反馈"
:
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
)
{
}
});
}
});
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
);
...
...
@@ -345,8 +286,6 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
ll_info_detail
=
rootView
.
findViewById
(
R
.
id
.
ll_info_detail
);
tv_doctor_name
=
rootView
.
findViewById
(
R
.
id
.
tv_doctor_name
);
rl_contain
=
rootView
.
findViewById
(
R
.
id
.
rl_contain
);
team_over_end
=
rootView
.
findViewById
(
R
.
id
.
team_over_end
);
textMessageLayout
=
rootView
.
findViewById
(
R
.
id
.
textMessageLayout
);
messageListView
.
setItemAnimator
(
null
);
//和助理私聊时的常用语逻辑
// rl_common_question_enter = rootView.findViewById(R.id.rl_common_question);
...
...
@@ -381,41 +320,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
if
(
SessionTypeEnum
.
Team
==
sessionType
){
rela_zixun
.
setVisibility
(
View
.
GONE
);
titleBar
.
setTitleRightDraw
(
null
);
// textMessageLayout.setVisibility(View.GONE);
// team_over_end.setVisibility(View.VISIBLE);
}
}
/**
* 删除聊天记录
*/
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 = getInfo().toUid;
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
();
}
@SuppressLint
(
"CheckResult"
)
private
void
initView
()
{
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
&&
ActionHandlerStorage
.
getL
(
sessionId
).
getUserType
()
==
3
)
{
...
...
@@ -523,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 @
392cdfd7
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.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.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.
*/
...
...
@@ -22,6 +52,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 +66,11 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
return
true
;
}
@Override
public
void
onResume
()
{
super
.
onResume
();
getChatGroupMute
();
}
@Override
public
boolean
sendMessage
(
IMMessage
message
)
{
...
...
@@ -51,8 +87,110 @@ 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
<>();
// if (ImConstants.KEFUXIAOYI.equals(toChatUsername) || "4108805".equals(toChatUsername)) {
// list.add("历史聊天记录");
// list.add("客服热线");
// } else {
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
"投诉反馈"
:
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
)
{
}
});
}
});
}
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 @
392cdfd7
...
...
@@ -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 @
392cdfd7
...
...
@@ -103,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
;
...
...
@@ -656,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 @
392cdfd7
...
...
@@ -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/res/drawable-xhdpi/ic_group_chat_end.png
0 → 100644
View file @
392cdfd7
1.04 KB
m-im/src/main/res_uikit/drawable/im_background_team_over.xml
deleted
100644 → 0
View file @
578b8e94
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android=
"http://schemas.android.com/apk/res/android"
android:exitFadeDuration=
"@android:integer/config_shortAnimTime"
>
<corners
android:radius=
"@dimen/dp_4"
/>
<solid
android:color=
"#E7ECF0"
/>
</shape>
\ No newline at end of file
m-im/src/main/res_uikit/layout/im_nim_message_activity_bottom_layout.xml
View file @
392cdfd7
...
...
@@ -6,7 +6,6 @@
android:orientation=
"vertical"
>
<include
layout=
"@layout/im_nim_message_activity_text_layout"
/>
<include
layout=
"@layout/im_nim_message_activity_team_over_layout"
/>
<com.yidianling.nimbase.business.session.emoji.EmoticonPickerView
android:id=
"@+id/emoticon_picker_view"
...
...
m-im/src/main/res_uikit/layout/im_nim_message_activity_team_over_layout.xml
deleted
100644 → 0
View file @
578b8e94
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"@dimen/dp_72"
tools:ignore=
"MissingDefaultResource"
android:gravity=
"center"
android:background=
"@drawable/im_background_team_over"
android:visibility=
"visible"
android:id=
"@+id/team_over_end"
android:layout_marginStart=
"@dimen/platform_dp_40"
android:layout_marginEnd=
"@dimen/platform_dp_40"
android:layout_marginBottom=
"@dimen/platform_dp_12"
>
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"群聊已结束,如有问题请联系个案管理师"
android:textColor=
"#0c1d31"
android:textSize=
"@dimen/im_text_size_16"
>
</TextView>
</LinearLayout>
\ No newline at end of file
m-im/src/main/res_uikit/layout/im_nim_message_item_notification.xml
View file @
392cdfd7
<?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 @
392cdfd7
...
...
@@ -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>
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