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
c87dabe8
Commit
c87dabe8
authored
Dec 18, 2019
by
徐健
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
修复多出空指针异常
parent
606a5550
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
83 additions
and
64 deletions
+83
-64
CourseSendPlugin.kt
m-course/src/main/java/com/yidianling/course/flutterPlugin/CourseSendPlugin.kt
+4
-3
YDLBaseMessageActivity.java
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLBaseMessageActivity.java
+44
-34
YDLMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
+35
-27
No files found.
m-course/src/main/java/com/yidianling/course/flutterPlugin/CourseSendPlugin.kt
View file @
c87dabe8
...
...
@@ -35,16 +35,16 @@ object CourseSendPlugin {
fun
sendMsg
(
isPlaying
:
Boolean
)
{
eventSink
!!
.
success
(
isPlaying
)
eventSink
?
.
success
(
isPlaying
)
}
fun
sendRequestData
()
{
eventSink
!!
.
success
(
"requestData"
)
eventSink
?
.
success
(
"requestData"
)
}
fun
sendLoginSuccess
()
{
eventSink
!!
.
success
(
"loginSuccess"
)
eventSink
?
.
success
(
"loginSuccess"
)
}
}
\ No newline at end of file
m-im/src/main/java/com/yidianling/uikit/business/session/activity/YDLBaseMessageActivity.java
View file @
c87dabe8
package
com
.
yidianling
.
uikit
.
business
.
session
.
activity
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.content.Intent
;
import
android.os.Bundle
;
...
...
@@ -115,6 +116,7 @@ public abstract class YDLBaseMessageActivity extends UI {
//==================== ChatUI Override ====================
@SuppressLint
(
"CheckResult"
)
public
void
setToolBar
(
int
toolBarId
)
{
tb
=
(
TitleBarBottom
)
findViewById
(
toolBarId
);
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
&&
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
()
!=
null
)
{
...
...
@@ -144,31 +146,34 @@ public abstract class YDLBaseMessageActivity extends UI {
Disposable
dis
=
ServiceImpl
.
Companion
.
getInstance
().
getDoctorChatStatus
(
Long
.
parseLong
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
toUid
))
.
subscribe
(
chatStatusBean
->
{
int
status
=
chatStatusBean
.
data
.
getStatus
();
ActionHandlerStorage
.
getL
(
sessionId
).
setDoctorStatus
(
status
);
ActionHandlerStorage
.
getL
(
sessionId
).
setDoctorBusyNum
(
chatStatusBean
.
data
.
getBusyTotal
());
//1.在线,2.离线,3.忙碌 4咨询中, 5倾述中 6咨询前准备
if
(
status
==
2
)
{
//离线
tb
.
setMinTitleText
(
"离线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_off_line
));
}
else
if
(
status
==
4
||
status
==
5
)
{
//服务中
tb
.
setMinTitleText
(
"服务中"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_online_server
));
}
else
{
//在线 1,3,6..
tb
.
setMinTitleText
(
"在线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_online
));
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
int
status
=
chatStatusBean
.
data
.
getStatus
();
ActionHandlerStorage
.
getL
(
sessionId
).
setDoctorStatus
(
status
);
ActionHandlerStorage
.
getL
(
sessionId
).
setDoctorBusyNum
(
chatStatusBean
.
data
.
getBusyTotal
());
//1.在线,2.离线,3.忙碌 4咨询中, 5倾述中 6咨询前准备
if
(
status
==
2
)
{
//离线
tb
.
setMinTitleText
(
"离线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_off_line
));
}
else
if
(
status
==
4
||
status
==
5
)
{
//服务中
tb
.
setMinTitleText
(
"服务中"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_online_server
));
}
else
{
//在线 1,3,6..
tb
.
setMinTitleText
(
"在线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_online
));
}
initSystemMessage
(
chatStatusBean
.
data
.
getPromptRule
(),
status
);
}
initSystemMessage
(
chatStatusBean
.
data
.
getPromptRule
(),
status
);
},
throwable
->
{
});
}
else
if
(
ActionHandlerStorage
.
getL
(
sessionId
).
getUserType
()
==
3
)
{
...
...
@@ -178,16 +183,18 @@ public abstract class YDLBaseMessageActivity extends UI {
.
subscribeOn
(
Schedulers
.
io
())
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
res
->
{
if
(
res
.
data
==
1
)
{
//在线
tb
.
setMinTitleText
(
"在线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_online
));
}
else
{
//离线
tb
.
setMinTitleText
(
"离线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_off_line
));
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
if
(
res
.
data
==
1
)
{
//在线
tb
.
setMinTitleText
(
"在线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_online
));
}
else
{
//离线
tb
.
setMinTitleText
(
"离线"
);
tb
.
setMinTitleColor
(
getResources
().
getColor
(
R
.
color
.
platform_color_666666
));
tb
.
setMinTitleDrawable
(
getResources
().
getDrawable
(
R
.
drawable
.
im_background_chat_top_status_off_line
));
}
}
},
throwable
->
{
});
...
...
@@ -221,6 +228,7 @@ public abstract class YDLBaseMessageActivity extends UI {
/**
* 发送推荐专家列表
*/
@SuppressLint
(
"CheckResult"
)
public
void
sendRecommendExpertListMessage
(
int
type
,
boolean
showExpertList
)
{
// 调取接口获取推荐专家列表
...
...
@@ -232,7 +240,9 @@ public abstract class YDLBaseMessageActivity extends UI {
.
observeOn
(
AndroidSchedulers
.
mainThread
())
.
subscribe
(
res
->
{
//发送推荐专家列表消息
ActionHandlerStorage
.
getL
(
sessionId
).
sendRecommendExpertListMessage
(
sessionId
,
res
.
data
,
type
,
showExpertList
);
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
ActionHandlerStorage
.
getL
(
sessionId
).
sendRecommendExpertListMessage
(
sessionId
,
res
.
data
,
type
,
showExpertList
);
}
},
throwable
->
{
ToastUtil
.
toastShort
(
throwable
.
toString
());
});
...
...
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
View file @
c87dabe8
...
...
@@ -214,30 +214,32 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
* 初始化顶部专家信息栏
*/
private
void
initTopCustomBar
()
{
// 头像
String
headUrl
=
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorBriefInfoSmallImage
;
if
(!
TextUtils
.
isEmpty
(
headUrl
))
{
GlideApp
.
with
(
getActivity
()).
load
(
headUrl
).
into
(
small_head_img
);
}
// 帮助人数
String
help_num
=
String
.
valueOf
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorBriefInfoOrderNum
);
if
(
TextUtils
.
isEmpty
(
help_num
))
help_num
=
"0"
;
help_num_tv
.
setText
(
help_num
);
// 服务时长
String
server_num
=
String
.
valueOf
((
int
)
Math
.
ceil
((
double
)
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorBriefInfoHelpLong
/
60.0
));
if
(
TextUtils
.
isEmpty
(
server_num
))
server_num
=
"0"
;
server_num_tv
.
setText
(
server_num
);
// 好评率
String
good_num
=
String
.
format
(
"%.2f"
,
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorBriefInfoFeedbackRate
*
20
);
if
(
TextUtils
.
isEmpty
(
good_num
))
good_num
=
"0.00"
;
good_num_tv
.
setText
(
good_num
+
"%"
);
if
(!
TextUtils
.
isEmpty
(
headUrl
))
{
IP2PCustomActionHandler
.
DocInfo
info
=
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
();
if
(
null
!=
info
)
{
NimUserInfo
user
=
NimUserInfoCache
.
getInstance
().
getUserInfo
(
info
.
toUid
);
if
(
null
!=
user
&&
null
!=
user
.
getAvatar
()
&&
headUrl
.
equals
(
user
.
getAvatar
()))
{
NimUserInfoCache
.
getInstance
().
getUserInfoFromRemote
(
info
.
toUid
,
null
);
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
// 头像
String
headUrl
=
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorBriefInfoSmallImage
;
if
(!
TextUtils
.
isEmpty
(
headUrl
))
{
GlideApp
.
with
(
getActivity
()).
load
(
headUrl
).
into
(
small_head_img
);
}
// 帮助人数
String
help_num
=
String
.
valueOf
(
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorBriefInfoOrderNum
);
if
(
TextUtils
.
isEmpty
(
help_num
))
help_num
=
"0"
;
help_num_tv
.
setText
(
help_num
);
// 服务时长
String
server_num
=
String
.
valueOf
((
int
)
Math
.
ceil
((
double
)
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorBriefInfoHelpLong
/
60.0
));
if
(
TextUtils
.
isEmpty
(
server_num
))
server_num
=
"0"
;
server_num_tv
.
setText
(
server_num
);
// 好评率
String
good_num
=
String
.
format
(
"%.2f"
,
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorBriefInfoFeedbackRate
*
20
);
if
(
TextUtils
.
isEmpty
(
good_num
))
good_num
=
"0.00"
;
good_num_tv
.
setText
(
good_num
+
"%"
);
if
(!
TextUtils
.
isEmpty
(
headUrl
))
{
IP2PCustomActionHandler
.
DocInfo
info
=
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
();
if
(
null
!=
info
)
{
NimUserInfo
user
=
NimUserInfoCache
.
getInstance
().
getUserInfo
(
info
.
toUid
);
if
(
null
!=
user
&&
null
!=
user
.
getAvatar
()
&&
headUrl
.
equals
(
user
.
getAvatar
()))
{
NimUserInfoCache
.
getInstance
().
getUserInfoFromRemote
(
info
.
toUid
,
null
);
}
}
}
}
...
...
@@ -347,14 +349,18 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
@Override
public
void
onClick
(
View
v
)
{
LogHelper
.
Companion
.
getInstance
().
writeLogSync
(
"聊天界面点击常见问题"
);
ActionHandlerStorage
.
getL
(
sessionId
).
startHelp
(
getActivity
());
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
ActionHandlerStorage
.
getL
(
sessionId
).
startHelp
(
getActivity
());
}
}
});
rootView
.
findViewById
(
R
.
id
.
action_feedback
).
setOnClickListener
(
new
View
.
OnClickListener
()
{
@Override
public
void
onClick
(
View
v
)
{
LogHelper
.
Companion
.
getInstance
().
writeLogSync
(
"聊天界面点击投诉与反馈"
);
ActionHandlerStorage
.
getL
(
sessionId
).
startFeedback
(
getActivity
());
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
ActionHandlerStorage
.
getL
(
sessionId
).
startFeedback
(
getActivity
());
}
}
});
;
...
...
@@ -362,7 +368,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
@Override
public
void
onClick
(
View
v
)
{
LogHelper
.
Companion
.
getInstance
().
writeLogSync
(
"聊天界面点击免费热线"
);
ActionHandlerStorage
.
getL
(
sessionId
).
popCallDialog
(
getActivity
());
if
(
ActionHandlerStorage
.
getL
(
sessionId
)
!=
null
)
{
ActionHandlerStorage
.
getL
(
sessionId
).
popCallDialog
(
getActivity
());
}
}
});
}
...
...
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