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
8d31a7ce
Commit
8d31a7ce
authored
Apr 18, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:消息免打扰状态
parent
a4ded454
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
104 additions
and
12 deletions
+104
-12
ChatItemView.kt
m-im/src/main/java/com/yidianling/im/ui/page/fragment/view/ChatItemView.kt
+35
-7
YDLTeamMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLTeamMessageFragment.java
+38
-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
+27
-4
DefaultFormatPrinter.java
ydl-net/src/main/java/com/ydl/ydlnet/builder/interceptor/log/DefaultFormatPrinter.java
+4
-1
No files found.
m-im/src/main/java/com/yidianling/im/ui/page/fragment/view/ChatItemView.kt
View file @
8d31a7ce
...
...
@@ -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.*
...
...
@@ -80,6 +79,20 @@ class ChatItemView(mContext: Context) : LinearLayout(mContext) {
chat_message_content
.
text
=
bean
.
content
}
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+"
...
...
@@ -89,11 +102,26 @@ class ChatItemView(mContext: Context) : LinearLayout(mContext) {
}
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
{
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_global_ll
.
setBackgroundResource
(
0
)
chat_message_unread_num
.
visibility
=
View
.
GONE
}
not_disturb
.
visibility
=
View
.
GONE
}
}
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLTeamMessageFragment.java
View file @
8d31a7ce
...
...
@@ -10,11 +10,13 @@ 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
;
...
...
@@ -95,10 +97,17 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
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("历史聊天记录");
...
...
@@ -115,6 +124,10 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
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
;
...
...
@@ -149,6 +162,31 @@ public class YDLTeamMessageFragment extends YDLMessageFragment {
});
}
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
();
}
...
...
m-im/src/main/res/drawable-xhdpi/team_not_disturb.png
0 → 100644
View file @
8d31a7ce
1.15 KB
m-im/src/main/res/layout/im_chat_item_view.xml
View file @
8d31a7ce
...
...
@@ -112,19 +112,42 @@
android:textColor=
"#999999"
android:textSize=
"11dp"
/>
</LinearLayout>
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:orientation=
"horizontal"
android:gravity=
"center"
android:layout_marginTop=
"5dp"
>
<TextView
android:id=
"@+id/chat_message_content"
android:layout_width=
"wrap_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:layout_marginRight=
"35dp"
android:layout_marginTop=
"5dp"
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"
...
...
ydl-net/src/main/java/com/ydl/ydlnet/builder/interceptor/log/DefaultFormatPrinter.java
View file @
8d31a7ce
...
...
@@ -102,12 +102,14 @@ 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
};
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
);
}
}
/**
* 打印网络响应信息, 当网络响应时 {{@link okhttp3.ResponseBody}} 为 {@code null} 或不可解析的情况
...
...
@@ -125,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
};
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