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
4c5df00c
Commit
4c5df00c
authored
Jul 01, 2022
by
YKai
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: mdt代码优化
parent
74a9e9ff
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
34 additions
and
26 deletions
+34
-26
MainActivity.kt
app/src/main/java/com/ydl/component/MainActivity.kt
+27
-17
TRTCCalling.java
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/calling/trtccalling/model/TRTCCalling.java
+7
-9
No files found.
app/src/main/java/com/ydl/component/MainActivity.kt
View file @
4c5df00c
...
...
@@ -55,15 +55,15 @@ import kotlinx.android.synthetic.main.activity_main.*
@Route
(
path
=
"/main/main"
)
class
MainActivity
:
BaseLceActivity
<
DemoContract
.
View
,
DemoContract
.
Presenter
>(),
DemoContract
.
View
{
// private var secretDescriptionDialog: SecretDescriptionDialog? = null
// private var secretDescriptionDialog: SecretDescriptionDialog? = null
private
var
serviceConnection
:
ServiceConnection
?
=
null
private
var
meditationServiceConnection
:
ServiceConnection
?
=
null
private
var
meditationServiceConnection
:
ServiceConnection
?
=
null
private
var
secretDialog
:
SecretDialog
?
=
null
protected
var
playService
:
PlayService
?
=
null
protected
var
meditationService
:
MeditationWindowService
?=
null
protected
var
meditationService
:
MeditationWindowService
?
=
null
override
fun
getContentViewId
():
Int
{
return
R
.
id
.
lce_content_view
...
...
@@ -95,7 +95,11 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
YdlCommonRouterManager
.
initYdlCommonRoute
(
PlatformTempCommonRouteImpl
())
// 初始化一键登录sdk
OneKeyLoginHelp
.
sdkInit
(
this
,
OneKeyLoginHelp
.
YDL_USER_APP
,
PhoneNumberAuthHelper
.
SERVICE_TYPE_LOGIN
)
OneKeyLoginHelp
.
sdkInit
(
this
,
OneKeyLoginHelp
.
YDL_USER_APP
,
PhoneNumberAuthHelper
.
SERVICE_TYPE_LOGIN
)
bindService
()
bindMeditationService
()
...
...
@@ -119,7 +123,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
// .withBoolean("bind_phone", false)
// .withBoolean("isFromGuide", true)
// .navigation()
OneKeyLoginHelp
.
startLogin
(
this
,
false
)
OneKeyLoginHelp
.
startLogin
(
this
,
false
)
}
bt_to_consultant
.
setOnClickListener
{
// ARouter.getInstance()
...
...
@@ -164,7 +168,9 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
startActivity
(
Intent
(
this
,
CollectSexAndBirthActivity
::
class
.
java
))
}
bt_to_confide
.
setOnClickListener
{
YDLavManager
.
instances
.
login
(
ModularServiceManager
.
provide
(
IUserService
::
class
.
java
).
getUserInfo
()
?.
uid
)
YDLavManager
.
instances
.
login
(
ModularServiceManager
.
provide
(
IUserService
::
class
.
java
).
getUserInfo
()
?.
uid
)
startActivity
(
Intent
(
this
,
ConfideHomeActivity
::
class
.
java
))
}
...
...
@@ -243,11 +249,14 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
val
rxPermissions
=
RxPermissions
(
this
)
rxPermissions
.
requestEach
(
Manifest
.
permission
.
WRITE_EXTERNAL_STORAGE
)
.
subscribe
{
permission
->
if
(
permission
.
granted
)
{
when
{
permission
.
granted
->
{
ToastUtil
.
toastShort
(
"Permission Success"
)
}
else
if
(
permission
.
shouldShowRequestPermissionRationale
)
{
}
permission
.
shouldShowRequestPermissionRationale
->
{
requestPermission
()
}
else
{
}
else
->
{
ToastUtil
.
toastLong
(
this
,
getString
(
R
.
string
.
platform_need_storage_permission_hint
)
...
...
@@ -259,6 +268,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
finish
()
}
}
}
}
...
...
@@ -269,11 +279,11 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
bindService
(
intent
,
serviceConnection
,
Context
.
BIND_AUTO_CREATE
)
}
private
fun
bindMeditationService
(){
private
fun
bindMeditationService
()
{
val
intent
=
Intent
()
intent
.
setClass
(
this
,
MeditationWindowService
::
class
.
java
)
intent
.
setClass
(
this
,
MeditationWindowService
::
class
.
java
)
meditationServiceConnection
=
MeditationServiceConnection
()
bindService
(
intent
,
meditationServiceConnection
,
Context
.
BIND_AUTO_CREATE
)
bindService
(
intent
,
meditationServiceConnection
,
Context
.
BIND_AUTO_CREATE
)
}
override
fun
onResume
()
{
...
...
@@ -285,7 +295,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
// (this)
val
trtcCalling
=
TRTCCalling
.
sharedInstance
(
this
)
if
(!
TextUtils
.
isEmpty
(
trtcCalling
.
mRoomId
)
&&!
TextUtils
.
isEmpty
(
trtcCalling
.
mUserId
))
{
if
(!
TextUtils
.
isEmpty
(
trtcCalling
.
mRoomId
)
&&
!
TextUtils
.
isEmpty
(
trtcCalling
.
mUserId
))
{
val
intent
=
Intent
(
mContext
,
YDLInvitionActivity
::
class
.
java
)
intent
.
putExtra
(
Constant
.
ROOM_ID
,
trtcCalling
.
mRoomId
)
intent
.
putExtra
(
Constant
.
USER_ID
,
trtcCalling
.
mUserId
)
...
...
@@ -301,7 +311,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
// ModularServiceManager.provide(IConsultantService::class.java).hideConsultAssistantDialog()
}
fun
onEvent
(
event
:
MeditationFloatEvent
)
{
fun
onEvent
(
event
:
MeditationFloatEvent
)
{
}
...
...
@@ -310,12 +320,12 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
if
(
serviceConnection
!=
null
)
{
unbindService
(
serviceConnection
)
}
if
(
meditationServiceConnection
!=
null
)
{
if
(
meditationServiceConnection
!=
null
)
{
EventBus
.
getDefault
().
post
(
MeditationFloatEvent
(
false
))
MediaPlayerManager
.
getInstance
(
this
)
?.
stop
()
unbindService
(
meditationServiceConnection
)
}
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
{
if
(
EventBus
.
getDefault
().
isRegistered
(
this
))
{
EventBus
.
getDefault
().
unregister
(
this
)
}
super
.
onDestroy
()
...
...
@@ -331,7 +341,7 @@ class MainActivity : BaseLceActivity<DemoContract.View, DemoContract.Presenter>(
}
}
private
inner
class
MeditationServiceConnection
:
ServiceConnection
{
private
inner
class
MeditationServiceConnection
:
ServiceConnection
{
override
fun
onServiceConnected
(
name
:
ComponentName
?,
service
:
IBinder
?)
{
meditationService
=
(
service
as
MeditationWindowService
.
MeditationBinder
).
service
}
...
...
ydl-tuicore/src/main/java/com/tencent/qcloud/tuicore/calling/trtccalling/model/TRTCCalling.java
View file @
4c5df00c
...
...
@@ -193,7 +193,7 @@ public class TRTCCalling {
public
MdtCallBack
mdtCallBack
;
public
interface
MdtCallBack
{
public
interface
MdtCallBack
{
void
onReceiveNewInvitation
(
String
roomId
);
void
onInviteeAccepted
(
String
roomId
);
...
...
@@ -344,12 +344,10 @@ public class TRTCCalling {
private
V2TIMSignalingListener
mTIMSignallingListener
=
new
V2TIMSignalingListener
()
{
@Override
public
void
onReceiveNewInvitation
(
String
inviteID
,
String
inviter
,
String
groupID
,
List
<
String
>
inviteeList
,
String
data
)
{
TRTCLogger
.
e
(
TAG
,
"onReceiveNewInvitation inviteID:"
+
inviteID
+
", inviter:"
+
inviter
+
", groupID:"
+
groupID
+
", inviteeList:"
+
inviteeList
+
" data:"
+
data
);
TRTCLogger
.
e
(
TAG
,
"onReceiveNewInvitation inviteID:"
+
inviteID
+
", inviter:"
+
inviter
+
", groupID:"
+
groupID
+
", inviteeList:"
+
inviteeList
+
" data:"
+
data
);
final
UserModel
userModel
=
UserModelManager
.
getInstance
().
getUserModel
();
for
(
String
s
:
inviteeList
)
{
if
(
s
.
equals
(
userModel
.
userId
)){
if
(
inviteeList
.
contains
(
userModel
.
userId
))
{
mRoomId
=
groupID
;
mUserId
=
userModel
.
userId
;
mInviteId
=
inviter
;
...
...
@@ -360,13 +358,13 @@ public class TRTCCalling {
intent
.
putExtra
(
Constant
.
INVITE_ID
,
inviter
);
intent
.
setFlags
(
Intent
.
FLAG_ACTIVITY_NEW_TASK
);
mContext
.
startActivity
(
intent
);
}
}
if
(!
mIsInRoom
){
if
(!
mIsInRoom
)
{
startRing
();
}
mdtCallBack
.
onReceiveNewInvitation
(
mRoomId
);
}
}
@Override
public
void
onInviteeAccepted
(
String
inviteID
,
String
invitee
,
String
data
)
{
...
...
@@ -2102,7 +2100,7 @@ public class TRTCCalling {
if
(
TextUtils
.
isEmpty
(
mCallingBellPath
))
{
mMediaPlayHelper
.
start
(
R
.
raw
.
phone_ringing
);
}
else
{
if
(!
mMediaPlayHelper
.
getMediaPlayer
().
isPlaying
()){
if
(!
mMediaPlayHelper
.
getMediaPlayer
().
isPlaying
())
{
mMediaPlayHelper
.
start
(
mCallingBellPath
);
}
}
...
...
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