Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
H
hadalive
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
yichen
hadalive
Commits
98749f01
Commit
98749f01
authored
May 19, 2022
by
Dell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
1、修复直播间拉黑和增加部分字段
parent
95814381
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
83 additions
and
22 deletions
+83
-22
Constants.kt
app/src/main/java/com/hupu/tv/player/app/app/Constants.kt
+4
-0
LiveActivity.kt
...n/java/com/hupu/tv/player/app/ui/activity/LiveActivity.kt
+7
-1
ChatFragment.java
...java/com/hupu/tv/player/app/ui/fragment/ChatFragment.java
+26
-0
LiveConversationFragment.kt
...upu/tv/player/app/ui/fragment/LiveConversationFragment.kt
+3
-0
VersionControl.kt
.../main/java/com/hupu/tv/player/app/utils/VersionControl.kt
+2
-1
CustomChatPrimaryMenu.java
...u/tv/player/app/widget/danmuku/CustomChatPrimaryMenu.java
+41
-20
No files found.
app/src/main/java/com/hupu/tv/player/app/app/Constants.kt
View file @
98749f01
...
...
@@ -466,6 +466,10 @@ object Constants {
const
val
LIVE_ROOM_USER_NAME
=
"live_room_user_name"
const
val
USER_LEVEL
=
"user_level"
const
val
MESSAGE_USER_ID
=
"user_id"
const
val
MESSAGE_USER_RID
=
"user_rid"
const
val
USER_HX_ID
=
"user_hx_id"
const
val
GIFT_BEAN
=
"gift_bean"
const
val
SPORT_TYPE
=
"sport_type"
const
val
SPORT_NAME
=
"sport_name"
...
...
app/src/main/java/com/hupu/tv/player/app/ui/activity/LiveActivity.kt
View file @
98749f01
...
...
@@ -66,6 +66,7 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
private
var
LiveRoomUserName
=
""
private
var
roomCover
=
""
private
var
matchId
=
""
private
var
liveUserHxId
=
""
private
var
sportType
=
0
var
historyList
=
arrayListOf
<
HistoryMessageEntity
>()
override
fun
loadData
()
{
...
...
@@ -222,6 +223,10 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
}
private
fun
initIm
(
userName
:
String
)
{
if
(
userName
.
isEmpty
()){
initTabLayout
(
false
)
return
}
EMClient
.
getInstance
().
login
(
userName
,
"123456"
,
object
:
EMCallBack
{
override
fun
onSuccess
()
{
runOnUiThread
{
...
...
@@ -259,6 +264,7 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
roomId
,
notice
,
notice2
,
liveUserHxId
,
LiveRoomUserName
)
)
...
...
@@ -413,7 +419,7 @@ class LiveActivity : RefreshActivity<LiveActivityPresenter>(), LiveActivityConta
initPlayer
(
bean
?.
hotNum
.
toString
(),
bean
?.
roomName
?:
""
,
bean
?.
liveUrl
?:
""
)
}
LiveRoomUserName
=
bean
?.
userName
?:
""
liveUserHxId
=
bean
?.
huanXinUserId
.
orEmpty
()
if
(
VersionControl
.
isShowLive
())
{
initIm
(
bean
?.
huanXinUserId
?:
""
)
}
else
{
...
...
app/src/main/java/com/hupu/tv/player/app/ui/fragment/ChatFragment.java
View file @
98749f01
...
...
@@ -19,6 +19,8 @@ import androidx.annotation.Nullable;
import
com.hupu.tv.player.app.bean.FakeMessageEntity
;
import
com.hupu.tv.player.app.ui.activity.LiveActivity
;
import
com.hupu.tv.player.app.widget.customIm.CustomEaseChatMessageListLayout
;
import
com.hyphenate.EMConnectionListener
;
import
com.hyphenate.EMError
;
import
com.hyphenate.chat.EMClient
;
import
com.hyphenate.chat.EMMessage
;
import
com.hyphenate.easeui.interfaces.EaseChatRoomListener
;
...
...
@@ -50,11 +52,15 @@ public class ChatFragment extends CustomEaseChatFragment implements OnRecallMess
private
Dialog
dialog
;
private
CustomChatPrimaryMenu
customChatPrimaryMenu
;
private
CustomChatRoomListener
customChatRoomListener
;
private
EMConnectionListener
connectionListener
;
private
String
userHxId
=
""
;
@Override
public
void
initView
()
{
super
.
initView
();
initConnectListener
();
liveUserName
=
getArguments
().
getString
(
Constants
.
LIVE_ROOM_USER_NAME
);
userHxId
=
getArguments
().
getString
(
Constants
.
USER_HX_ID
,
""
);
chatLayout
.
getChatMessageListLayout
().
setItemShowType
(
EaseChatMessageListLayout
.
ShowType
.
LEFT
);
chatLayout
.
getChatMessageListLayout
().
setBackground
(
new
ColorDrawable
(
Color
.
parseColor
(
"#F4F4F4"
)));
customChatPrimaryMenu
=
new
CustomChatPrimaryMenu
(
getContext
());
...
...
@@ -66,6 +72,23 @@ public class ChatFragment extends CustomEaseChatFragment implements OnRecallMess
setShowChatPrimaryMenu
();
}
private
void
initConnectListener
()
{
connectionListener
=
new
EMConnectionListener
()
{
@Override
public
void
onConnected
()
{
}
@Override
public
void
onDisconnected
(
int
errorCode
)
{
if
(
errorCode
==
EMError
.
USER_KICKED_BY_OTHER_DEVICE
)
{
customChatPrimaryMenu
.
setCanSend
(
false
);
}
}
};
EMClient
.
getInstance
().
addConnectionListener
(
connectionListener
);
}
public
void
setOnMemberJoinListener
(
OnMemberJoinListener
onMemberJoinListener
)
{
this
.
onMemberJoinListener
=
onMemberJoinListener
;
}
...
...
@@ -86,6 +109,8 @@ public class ChatFragment extends CustomEaseChatFragment implements OnRecallMess
LiveUserBean
liveUserBean
=
SPUtil
.
Companion
.
getSerializableObject
(
Constants
.
LIVE_USER_BEAN
);
if
(
liveUserBean
!=
null
)
{
message
.
setAttribute
(
Constants
.
USER_NICK
,
liveUserBean
.
getUserName
());
message
.
setAttribute
(
Constants
.
MESSAGE_USER_RID
,
liveUserBean
.
getId
());
message
.
setAttribute
(
Constants
.
MESSAGE_USER_ID
,
userHxId
);
message
.
setAttribute
(
Constants
.
USER_LEVEL
,
liveUserBean
.
getLevel
());
}
}
...
...
@@ -410,6 +435,7 @@ public class ChatFragment extends CustomEaseChatFragment implements OnRecallMess
chatMessageListLayout
=
null
;
}
EMClient
.
getInstance
().
removeConnectionListener
(
connectionListener
);
if
(
chatLayout
!=
null
)
{
chatLayout
=
null
;
}
...
...
app/src/main/java/com/hupu/tv/player/app/ui/fragment/LiveConversationFragment.kt
View file @
98749f01
...
...
@@ -43,9 +43,11 @@ class LiveConversationFragment : RefreshVP2Fragment<LiveConversationFragmentPres
conversationId
:
String
,
notice
:
String
,
notice2
:
String
,
userHxId
:
String
,
userName
:
String
):
LiveConversationFragment
{
val
args
=
Bundle
()
args
.
putString
(
Constants
.
USER_HX_ID
,
userHxId
)
args
.
putString
(
EaseConstant
.
EXTRA_CONVERSATION_ID
,
conversationId
)
args
.
putInt
(
EaseConstant
.
EXTRA_CHAT_TYPE
,
EaseConstant
.
CHATTYPE_CHATROOM
)
args
.
putBoolean
(
EaseConstant
.
EXTRA_IS_ROAM
,
true
)
...
...
@@ -114,6 +116,7 @@ class LiveConversationFragment : RefreshVP2Fragment<LiveConversationFragmentPres
private
fun
initChatFragment
()
{
val
bundle
=
Bundle
()
bundle
.
putString
(
Constants
.
USER_HX_ID
,
arguments
?.
getString
(
Constants
.
USER_HX_ID
))
bundle
.
putString
(
EaseConstant
.
EXTRA_CONVERSATION_ID
,
arguments
?.
getString
(
EaseConstant
.
EXTRA_CONVERSATION_ID
))
bundle
.
putInt
(
EaseConstant
.
EXTRA_CHAT_TYPE
,
EaseConstant
.
CHATTYPE_CHATROOM
)
bundle
.
putBoolean
(
EaseConstant
.
EXTRA_IS_ROAM
,
true
)
...
...
app/src/main/java/com/hupu/tv/player/app/utils/VersionControl.kt
View file @
98749f01
...
...
@@ -18,6 +18,7 @@ object VersionControl {
private
const
val
VIVO
=
"qj_vivo_01"
private
const
val
HUAWEI
=
"qj_huawei_01"
private
const
val
OPPO
=
"qj_oppo_01"
private
const
val
XIAOMI
=
"qj_xiaomi_01"
fun
isShowLive
():
Boolean
{
...
...
@@ -26,7 +27,7 @@ object VersionControl {
fun
saveConfig
(
showConfig
:
Boolean
)
{
when
(
BuildConfig
.
FLAVOR
)
{
BAIDU
,
VIVO
,
HUAWEI
,
OPPO
->
SPUtil
.
put
(
Constants
.
SHOW_LIVE_CONFIG
,
showConfig
)
BAIDU
,
VIVO
,
HUAWEI
,
OPPO
,
XIAOMI
->
SPUtil
.
put
(
Constants
.
SHOW_LIVE_CONFIG
,
showConfig
)
else
->
SPUtil
.
put
(
Constants
.
SHOW_LIVE_CONFIG
,
true
)
}
}
...
...
app/src/main/java/com/hupu/tv/player/app/widget/danmuku/CustomChatPrimaryMenu.java
View file @
98749f01
...
...
@@ -24,6 +24,7 @@ import android.widget.RelativeLayout;
import
androidx.appcompat.app.AppCompatActivity
;
import
com.blankj.utilcode.util.LogUtils
;
import
com.example.zhouwei.library.CustomPopWindow
;
import
com.hyphenate.easeui.modules.chat.EaseInputEditText
;
import
com.hyphenate.easeui.modules.chat.EaseInputMenuStyle
;
...
...
@@ -37,6 +38,8 @@ import com.hupu.tv.player.app.utils.DialogUtils;
import
com.softgarden.baselibrary.utils.ToastUtil
;
import
java.util.ArrayList
;
import
java.util.regex.Matcher
;
import
java.util.regex.Pattern
;
public
class
CustomChatPrimaryMenu
extends
RelativeLayout
implements
IChatPrimaryMenu
,
View
.
OnClickListener
,
EaseInputEditText
.
OnEditTextChangeListener
,
TextWatcher
{
private
LinearLayout
rlBottom
;
...
...
@@ -51,7 +54,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar
private
CheckBox
buttonMore
;
private
Button
buttonSend
;
private
OnSendMessageListener
sendMessageListener
;
private
boolean
isCanSend
=
true
;
private
EaseChatPrimaryMenuListener
listener
;
private
EaseInputMenuStyle
menuType
=
EaseInputMenuStyle
.
All
;
//菜单展示形式
protected
InputMethodManager
inputManager
;
...
...
@@ -76,6 +79,9 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar
public
void
setOnSendMessageListener
(
OnSendMessageListener
onSendMessageListener
)
{
sendMessageListener
=
onSendMessageListener
;
}
public
void
setCanSend
(
boolean
canSend
){
isCanSend
=
canSend
;
}
private
void
initViews
()
{
rlBottom
=
findViewById
(
R
.
id
.
rl_bottom
);
...
...
@@ -217,6 +223,38 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar
}
}
private
void
sendMessage
(
String
message
){
if
(
message
.
isEmpty
()){
ToastUtil
.
Companion
.
s
(
"请输入内容"
);
return
;
}
if
(!
isCanSend
){
ToastUtil
.
Companion
.
s
(
"您已被禁言,如有疑问请联系客服"
);
return
;
}
// if (checkSend(message)){
// ToastUtil.Companion.s("敏感词汇不能发送,请检查后重新发送");
// return;
// }
if
(
listener
!=
null
)
{
editText
.
setText
(
""
);
listener
.
onSendBtnClicked
(
message
);
if
(
sendMessageListener
!=
null
)
{
sendMessageListener
.
send
(
message
);
}
}
}
// private boolean checkSend(String content){
// String regex = (String) SPUtil.Companion.get(Constants.CONFIG_VALUE, "");
// Pattern pattern = Pattern.compile(regex);
// Matcher matcher = pattern.matcher(content);
// boolean matches =matcher.find();
// LogUtils.i("regex = "+regex + "input content = "+content+ "matches = "+matches );
// return matches;
// }
@Override
public
void
showMoreStatus
()
{
if
(
buttonMore
.
isChecked
())
{
...
...
@@ -281,19 +319,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar
public
void
onClick
(
View
v
)
{
int
id
=
v
.
getId
();
if
(
id
==
R
.
id
.
btn_send
)
{
//发送
if
(
editText
.
getText
().
toString
().
isEmpty
()){
ToastUtil
.
Companion
.
s
(
"请输入内容"
);
return
;
}
if
(
listener
!=
null
)
{
String
s
=
editText
.
getText
().
toString
();
editText
.
setText
(
""
);
listener
.
onSendBtnClicked
(
s
);
if
(
sendMessageListener
!=
null
)
{
sendMessageListener
.
send
(
s
);
}
}
sendMessage
(
editText
.
getText
().
toString
());
}
else
if
(
id
==
R
.
id
.
btn_set_mode_voice
)
{
//切换到语音模式
// showVoiceStatus();
showCustomPopWindow
();
...
...
@@ -362,12 +388,7 @@ public class CustomChatPrimaryMenu extends RelativeLayout implements IChatPrimar
@Override
public
void
onClickKeyboardSendBtn
(
String
content
)
{
if
(
listener
!=
null
)
{
listener
.
onSendBtnClicked
(
content
);
if
(
sendMessageListener
!=
null
)
{
sendMessageListener
.
send
(
content
);
}
}
sendMessage
(
content
);
}
@Override
...
...
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