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
9de31709
Commit
9de31709
authored
Aug 02, 2022
by
万齐军
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'feat/yk/arch3' into 'feat/qj/arch3'
Feat/yk/arch3 See merge request app_android_lib/YDL-Component!280
parents
4dfc6b87
ba02ea5f
Hide whitespace changes
Inline
Side-by-side
Showing
12 changed files
with
87 additions
and
1464 deletions
+87
-1464
build.gradle
api/consultant/build.gradle
+3
-0
IConsultantService.kt
api/consultant/src/main/java/com/yidianling/consultant/api/IConsultantService.kt
+6
-1
WebServiceImpl.java
app/src/main/java/com/ydl/component/service/WebServiceImpl.java
+0
-34
JsMethod.kt
app/src/main/java/com/ydl/component/service/web/JsMethod.kt
+0
-128
WVClickAbstractListener.java
app/src/main/java/com/ydl/component/service/web/WVClickAbstractListener.java
+0
-588
WebJavascriptHandler.kt
app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
+0
-487
WebViewClientClickListener.java
app/src/main/java/com/ydl/component/service/web/WebViewClientClickListener.java
+0
-218
ConsultantServiceImp.kt
m-consultant/src/main/java/com/yidianling/consultant/modular/ConsultantServiceImp.kt
+33
-2
JsMethod.kt
m-js/src/main/java/com/ydl/js/JsMethod.kt
+1
-1
NewH5_JavascriptHandler.kt
m-js/src/main/java/com/ydl/js/NewH5_JavascriptHandler.kt
+17
-4
NewH5_WVClickAbstractListener.java
m-js/src/main/java/com/ydl/js/NewH5_WVClickAbstractListener.java
+20
-0
NewH5_WebViewClientClickListener.java
m-js/src/main/java/com/ydl/js/NewH5_WebViewClientClickListener.java
+7
-1
No files found.
api/consultant/build.gradle
View file @
9de31709
...
@@ -30,4 +30,6 @@ android {
...
@@ -30,4 +30,6 @@ android {
dependencies
{
dependencies
{
implementation
"com.alibaba:arouter-api:$arouter_api"
implementation
"com.alibaba:arouter-api:$arouter_api"
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
implementation
"org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
compileOnly
(
project
(
":ydl-webview"
))
}
}
\ No newline at end of file
api/consultant/src/main/java/com/yidianling/consultant/api/IConsultantService.kt
View file @
9de31709
...
@@ -4,9 +4,10 @@ import android.app.Activity
...
@@ -4,9 +4,10 @@ import android.app.Activity
import
android.content.Context
import
android.content.Context
import
androidx.fragment.app.Fragment
import
androidx.fragment.app.Fragment
import
com.alibaba.android.arouter.facade.template.IProvider
import
com.alibaba.android.arouter.facade.template.IProvider
import
com.ydl.webview.H5JsBean
import
com.yidianling.consultant.OnBottomWordListener
import
com.yidianling.consultant.bean.GuideBean
import
com.yidianling.consultant.bean.GuideBean
import
com.yidianling.consultant.bean.Keyworks
import
com.yidianling.consultant.bean.Keyworks
import
com.yidianling.consultant.OnBottomWordListener
/**
/**
* Created by xj on 2019/11/14.
* Created by xj on 2019/11/14.
...
@@ -51,4 +52,7 @@ interface IConsultantService: IProvider {
...
@@ -51,4 +52,7 @@ interface IConsultantService: IProvider {
//获取底纹词
//获取底纹词
fun
getbottomWord
(
type
:
Int
,
listener
:
OnBottomWordListener
)
fun
getbottomWord
(
type
:
Int
,
listener
:
OnBottomWordListener
)
// 预览资源
fun
resourceToPreview
(
dataList
:
List
<
H5JsBean
.
MediaInfo
>?,
params
:
H5JsBean
.
H5JsCmd
.
Params
,
activity
:
Activity
)
}
}
\ No newline at end of file
app/src/main/java/com/ydl/component/service/WebServiceImpl.java
deleted
100644 → 0
View file @
4dfc6b87
package
com
.
ydl
.
component
.
service
;
import
android.app.Activity
;
import
android.content.Context
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.tencent.smtt.sdk.WebView
;
import
com.ydl.component.service.web.WVClickAbstractListener
;
import
com.ydl.component.service.web.WebJavascriptHandler
;
import
com.ydl.webview.IJavascriptHandler
;
import
com.ydl.webview.IWebService
;
import
com.ydl.webview.TellData
;
import
org.jetbrains.annotations.NotNull
;
import
org.jetbrains.annotations.Nullable
;
/**
* Created by haorui on 2019-10-10.
* Des:
*/
@Route
(
path
=
"/web/webservice"
)
public
class
WebServiceImpl
implements
IWebService
{
@Override
public
void
init
(
Context
context
)
{
}
@NotNull
@Override
public
IJavascriptHandler
getJavascripHandler
(
@NotNull
Activity
activity
,
@Nullable
WebView
webView
,
@NotNull
TellData
tellData
)
{
return
new
WebJavascriptHandler
(
webView
,
new
WVClickAbstractListener
(
activity
));
}
}
app/src/main/java/com/ydl/component/service/web/JsMethod.kt
deleted
100644 → 0
View file @
4dfc6b87
package
com.ydl.component.service.web
import
android.Manifest
import
com.blankj.utilcode.util.PermissionUtils
import
com.google.gson.JsonObject
import
com.google.gson.JsonParser
import
com.tencent.smtt.sdk.WebView
import
com.ydl.audioim.YDLavManager
import
com.ydl.confide.api.IConfideService
import
com.ydl.confide.event.ConfideDialogEvent
import
com.ydl.webview.H5Params
import
com.ydl.webview.NewH5Activity
import
com.ydl.ydlcommon.base.BaseActivityMgr
import
com.ydl.ydlcommon.modular.findRouteService
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.common.tools.asFragmentActivity
import
com.yidianling.user.UserHelper
import
de.greenrobot.event.EventBus
class
JsMethod
(
private
val
webView
:
WebView
?)
{
fun
handle
(
param
:
String
):
Boolean
{
try
{
val
obj
=
JsonParser
().
parse
(
param
).
asJsonObject
val
cmd
=
obj
.
getAsJsonObject
(
"cmd"
)
val
actionName
=
cmd
?.
getAsJsonPrimitive
(
"action_name"
)
?.
asString
if
(
actionName
.
isNullOrBlank
())
return
false
return
innerHandle
(
actionName
,
cmd
)
}
catch
(
throwable
:
Throwable
)
{
throwable
.
printStackTrace
()
return
false
}
}
private
fun
innerHandle
(
actionName
:
String
,
obj
:
JsonObject
):
Boolean
{
val
param
=
obj
.
getAsJsonObject
(
"params"
)
when
(
actionName
)
{
"handle_confide_btn"
->
{
val
show
=
param
.
getAsJsonPrimitive
(
"show"
).
asInt
EventBus
.
getDefault
().
post
(
ConfideDialogEvent
(
show
))
return
true
}
"show_loading"
->
{
// val topActivity = BaseActivityMgr.INST.getTopActivity()
// Loading.show(topActivity)
return
true
}
"close_loading"
->
{
// Loading.close()
return
true
}
"open_app_eval_list"
->
{
val
url
=
param
.
getAsJsonPrimitive
(
"url"
).
asString
val
topActivity
=
BaseActivityMgr
.
INST
.
getTopActivity
()
NewH5Activity
.
start
(
topActivity
,
H5Params
(
url
,
""
))
return
true
}
"toast"
->
{
val
msg
=
param
.
getAsJsonPrimitive
(
"msg"
).
asString
if
(!
msg
.
isNullOrBlank
())
{
ToastUtil
.
toastShort
(
msg
)
}
return
true
}
"has_audio_permission"
->
{
val
callback
=
param
.
getAsJsonPrimitive
(
"callback"
).
asString
if
(
callback
.
isNullOrBlank
())
return
true
if
(
PermissionUtils
.
isGranted
(
Manifest
.
permission
.
RECORD_AUDIO
))
{
webView
?.
post
{
webView
.
loadUrl
(
"javascript:$callback(1)"
)
}
return
true
}
(
webView
?.
context
?.
asFragmentActivity
())
?.
let
{
findRouteService
(
IConfideService
::
class
.
java
).
requestConfidePermission
(
it
)
{
granted
->
webView
.
post
{
webView
.
loadUrl
(
"javascript:$callback(${if (granted) 1 else 0})"
)
}
}
}
return
true
}
"confide_dial"
->
{
//倾诉链接 java接口,支持axb和声网
val
id
=
param
.
getAsJsonPrimitive
(
"id"
).
asInt
val
data
=
param
.
getAsJsonObject
(
"data"
).
toString
()
val
topActivity
=
BaseActivityMgr
.
INST
.
topActivity
if
(!
YDLavManager
.
isOnlineRtm
)
{
//异常退出或者账号被顶掉,重新登录并拨打
YDLavManager
.
instances
.
login
(
UserHelper
.
getUserInfo
()
?.
uid
)
{
isSuccess
:
Boolean
,
_
->
if
(
isSuccess
)
{
findRouteService
(
IConfideService
::
class
.
java
).
confideDial
(
id
,
data
,
topActivity
)
}
else
{
ToastUtil
.
toastShort
(
"请重新拨打"
)
}
}
}
else
{
findRouteService
(
IConfideService
::
class
.
java
).
confideDial
(
id
,
data
,
topActivity
)
}
return
true
}
"check_app_support"
->
{
val
callback
=
param
.
getAsJsonPrimitive
(
"callback"
).
asString
val
type
=
param
.
getAsJsonPrimitive
(
"type"
).
asInt
if
(
callback
.
isNullOrBlank
())
return
true
webView
?.
post
{
when
(
type
)
{
1
,
2
->
{
//检查音频权限能力
webView
.
loadUrl
(
"javascript:$callback(1)"
)
}
else
->
{
webView
.
loadUrl
(
"javascript:$callback(0)"
)
}
}
}
return
true
}
else
->
{
return
false
}
}
}
}
\ No newline at end of file
app/src/main/java/com/ydl/component/service/web/WVClickAbstractListener.java
deleted
100644 → 0
View file @
4dfc6b87
package
com
.
ydl
.
component
.
service
.
web
;
import
android.annotation.SuppressLint
;
import
android.app.Activity
;
import
android.graphics.Rect
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.blankj.utilcode.util.ScreenUtils
;
import
com.ydl.confide.api.IConfideService
;
import
com.ydl.confide.event.ChangeAnotherExpertEvent
;
import
com.ydl.webview.H5JsBean
;
import
com.ydl.webview.H5Params
;
import
com.ydl.webview.NewH5Activity
;
import
com.ydl.ydlcommon.modular.ModularServiceManager
;
import
com.yidianling.common.tools.LogUtil
;
import
com.yidianling.consultant.preview.GPreviewBuilder
;
import
com.yidianling.consultant.preview.UserViewInfo
;
import
com.yidianling.im.api.service.IImService
;
import
com.yidianling.muse.activity.ChooseMusicActivity
;
//import static com.ydl.ydlcommon.router.IYDLRouterConstant.ROUTER_MUSE_PLAY;
import
de.greenrobot.event.EventBus
;
import
com.yidianling.im.api.event.CloseBottomWebviewEvent
;
import
java.util.ArrayList
;
import
java.util.List
;
/**
* webview 点击事件监听 抽象类
* Created by harvie on 2017/7/4 0004.
*/
public
class
WVClickAbstractListener
implements
WebViewClientClickListener
{
public
Activity
mContext
;
public
WVClickAbstractListener
(
Activity
activity
)
{
this
.
mContext
=
activity
;
}
@Override
public
void
openH5
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
LogUtil
.
d
(
"openH5 params: "
+
jsData
.
toString
());
H5Params
h5Params
=
new
H5Params
(
jsData
.
getUrl
(),
null
);
h5Params
.
setShareData
(
jsData
.
getShare
());
h5Params
.
setShowMenu
(
jsData
.
getDot_flag
());
NewH5Activity
.
start
(
mContext
,
h5Params
);
}
@Override
public
void
courseList
()
{
}
@Override
public
void
activeDetail
(
String
id
)
{
}
@Override
public
void
contactYi
()
{
}
@Override
public
void
contactCourseCustomerService
()
{
}
@Override
public
void
openTopicDetail
(
String
topic_id
)
{
}
@Override
public
void
openMember
(
String
id
)
{
}
@Override
public
void
sendTrend
()
{
}
@Override
public
void
sendResultTrend
(
String
cover1
,
String
title1
,
String
purl1
,
String
share_url1
)
{
}
@Override
public
void
sendInfo
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
searchList
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
openExpertsHome
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
openTest
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
chat
(
int
id
,
int
toUid
,
int
canTalk
,
String
accessToken
,
int
isFromQingShu
)
{
}
@Override
public
void
chatSendMessage
(
int
id
,
int
toUid
,
int
canTalk
,
String
accessToken
,
int
isFromQingShu
)
{
}
@Override
public
void
chatTeam
(
int
tid
,
int
doctorId
)
{
}
@Override
public
void
jumpLogin
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
openFmDetail
(
int
id
)
{
}
@Override
public
void
openArticle
()
{
}
@Override
public
void
openFmList
()
{
}
@Override
public
void
sendSubscriptionTimeMessage
(
String
to_uid
)
{
}
@Override
public
void
pay
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
payReceipt
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
payCourse
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
payTest
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
viewTestResult
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
ydlNative
(
H5JsBean
.
H5JsCmd
jsData
)
{
}
@Override
public
void
openOrderDetail
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
expertProduct
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
order
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
toOrderCt
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
showDocList
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
goodExpert
()
{
}
@Override
public
void
copyWechat
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
goWechat
()
{
}
@Override
public
void
listenOrderDetail
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
detailSub
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
openAgreement
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
modifyEval
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
visitEval
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
coursePlay
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
closeFloatView
()
{
}
@Override
public
void
courseWriteComment
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
courseComment
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
listenTel
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
voiceBroadcast
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
tel
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
onOrderByApp
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
orderSetTime
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
searchServiceDoc
(
int
cateId
)
{
}
@Override
public
void
openTestDetail
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
shareAction
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
showShareMenu
(
params
);
}
}
@Override
public
void
openTestList
()
{
}
@Override
public
void
feedBack
()
{
}
@Override
public
void
phoneCall
()
{
}
@Override
public
void
chatSchedule
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
ModularServiceManager
.
INSTANCE
.
provide
(
IImService
.
class
)
.
chatScheule
(
mContext
,
params
.
getUser_url
(),
params
.
getDoc_url
(),
params
.
getDsmId
(),
params
.
getTitle
(),
params
.
getToUid
());
}
@Override
public
void
invite
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
balance
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
switchDownRefresh
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
if
(
mContext
!=
null
&&
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
hasShowDownRefresh
(
params
.
getSwitch
());
}
}
@Override
public
void
recharge
()
{
}
@Override
public
void
bindPhone
()
{
}
@Override
public
void
refresh
()
{
}
@Override
public
void
listenAgora
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
setTitle
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
saveImage
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
sendToExpert
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
confideConnect
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
((
IConfideService
)
ARouter
.
getInstance
().
build
(
"/confide/ConfideService"
).
navigation
()).
connectionJava
(
jsData
.
getId
(),
3
,
mContext
,
null
,
jsData
.
getCallType
());
}
@Override
public
void
confidePay
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
back
()
{
mContext
.
finish
();
}
@Override
public
void
commonPay
(
H5JsBean
.
H5JsCmd
.
Params
jsData
)
{
}
@Override
public
void
hideStatusBar
()
{
}
@Override
public
void
showStatusBar
()
{
}
@Override
public
void
openRightTopMenu
()
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
openRightTopMenu
();
}
}
@Override
public
void
openShareMenu
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
openShareMenu
(
params
);
}
}
@Override
public
void
closeWebKit
()
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
finish
();
}
}
@Override
public
void
goHome
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
}
@Override
public
void
sendUnReadNum
(
String
callbackFuncName
,
String
uid
)
{
final
StringBuffer
sb
=
new
StringBuffer
();
sb
.
append
(
callbackFuncName
);
sb
.
append
(
"('"
);
sb
.
append
(
"33,125"
);
sb
.
append
(
"')"
);
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
callJSFunc
(
sb
.
toString
());
}
}
@Override
public
void
shouldShowTitleBar
(
boolean
isShowTitleBar
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
if
(
isShowTitleBar
)
{
((
NewH5Activity
)
mContext
).
showTitleBar
();
}
else
{
((
NewH5Activity
)
mContext
).
hideJavaTitleBar
();
}
}
}
@Override
public
void
setSelfPageType
(
int
selfType
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
setSelfPageType
(
selfType
);
}
}
@Override
public
void
playMeditation
(
int
mediaId
,
long
meditationId
,
int
meditationType
,
String
mediaCoverUrl
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
// YDLRouterManager.Companion.router(ROUTER_MUSE_PLAY,
// new YDLRouterParams().putExtra("MEDITATION_ID", String.valueOf(meditationId))
// .putExtra("MEDIA_ID", String.valueOf(mediaId))
// .putExtra("MEDITATION_TYPE", String.valueOf(meditationType))
// .putExtra("MEDIA_COVER_URL", mediaCoverUrl));
ARouter
.
getInstance
().
build
(
"/muse/play"
)
.
withLong
(
"MEDITATION_ID"
,
meditationId
)
.
withLong
(
"MEDIA_ID"
,
mediaId
)
.
withInt
(
"MEDITATION_TYPE"
,
meditationType
)
.
withString
(
"MEDIA_COVER_URL"
,
mediaCoverUrl
)
.
navigation
();
}
}
@Override
public
void
getNextExpertStatus
(
String
doctorID
,
String
title
,
String
uid
,
String
linkUrl
)
{
EventBus
.
getDefault
().
post
(
new
ChangeAnotherExpertEvent
(
doctorID
,
title
,
uid
,
linkUrl
));
}
@Override
public
void
switchPushStatus
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
if
(
params
.
getSwitchStatus
()
==
1
)
{
// MsgPushLifecycle.Companion.setH5Open(true);
}
else
{
// MsgPushLifecycle.Companion.setH5Open(false);
}
}
@Override
public
void
resourceToPreview
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
List
<
H5JsBean
.
MediaInfo
>
dataList
=
params
.
getDataList
();
H5JsBean
.
DoctorInfo
info
=
params
.
getInfo
();
List
<
UserViewInfo
>
mThumbViewInfoList
=
new
ArrayList
<>();
for
(
H5JsBean
.
MediaInfo
mediaInfo
:
dataList
)
{
UserViewInfo
userViewInfo
=
new
UserViewInfo
(
mediaInfo
.
getCover
(),
mediaInfo
.
getUrl
(),
mediaInfo
.
getSourcesType
());
Rect
bounds
=
new
Rect
();
bounds
.
left
=
ScreenUtils
.
getScreenWidth
()
/
2
;
bounds
.
top
=
ScreenUtils
.
getScreenHeight
()
/
2
;
bounds
.
right
=
ScreenUtils
.
getScreenWidth
()
/
2
;
bounds
.
bottom
=
ScreenUtils
.
getScreenHeight
()
/
2
;
userViewInfo
.
setBounds
(
bounds
);
mThumbViewInfoList
.
add
(
userViewInfo
);
}
GPreviewBuilder
.
form
(
mContext
)
.
setData
(
mThumbViewInfoList
)
.
setCurrentIndex
(
params
.
getPreview_index
())
.
setFullscreen
(
true
)
.
setToUid
(
info
.
getToUid
()
+
""
)
.
setDoctorId
(
info
.
getDoctorId
())
.
setType
(
GPreviewBuilder
.
IndicatorType
.
Dot
)
.
start
();
}
@Override
public
void
showDocBooking
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
ModularServiceManager
.
INSTANCE
.
provide
(
IImService
.
class
).
showConsultServiceDialog
(
mContext
,
params
.
getToUid
()
+
""
,
params
.
getDoctorId
()
+
""
);
}
@Override
public
void
switchSound
(
int
mediaId
,
long
meditationId
,
int
meditationType
,
int
businessType
,
String
buried
,
String
mediaUrl
,
String
mediaCoverUrl
,
String
title
,
String
desc
,
int
status
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
switchSound
(
mediaId
,
meditationId
,
meditationType
,
businessType
,
buried
,
mediaUrl
,
mediaCoverUrl
,
title
,
desc
,
status
);
}
else
if
(
mContext
instanceof
ChooseMusicActivity
)
{
((
ChooseMusicActivity
)
mContext
).
switchSound
(
mediaId
,
meditationId
,
meditationType
,
businessType
,
buried
,
mediaUrl
,
mediaCoverUrl
,
title
,
desc
,
status
);
}
}
@Override
public
void
chatCloseBottomWebView
()
{
EventBus
.
getDefault
().
post
(
new
CloseBottomWebviewEvent
(
true
));
ModularServiceManager
.
INSTANCE
.
provide
(
IImService
.
class
).
dismissConsultServiceDialog
();
}
@Override
public
void
reloadUrl
(
String
url
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
loadUrl
(
url
);
}
}
@Override
public
void
setWebViewBG
(
String
rgb
,
String
alpha
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
setBG
(
rgb
,
alpha
);
}
}
/**
* 打开时间选择器
*/
@SuppressLint
(
"CheckResult"
)
@Override
public
void
openTimePicker
(
String
jsCallBackName
,
String
day
,
String
doctorId
,
String
orderId
)
{
}
@Override
public
void
showCommentArticleDialog
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
if
(
mContext
instanceof
NewH5Activity
){
((
NewH5Activity
)
mContext
).
showCommentArticleDialog
(
params
.
getTitle
());
}
}
}
app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
deleted
100644 → 0
View file @
4dfc6b87
package
com.ydl.component.service.web
import
android.webkit.JavascriptInterface
import
androidx.fragment.app.FragmentActivity
import
com.google.gson.Gson
import
com.tencent.smtt.sdk.WebView
import
com.ydl.confide.api.ConfideRoute
import
com.ydl.confide.api.IConfideService
import
com.ydl.js_module.manager.WebViewRouterManager
import
com.ydl.webview.H5JsBean
import
com.ydl.webview.IJavascriptHandler
import
com.ydl.ydl_router.manager.YDLRouterManager
import
com.ydl.ydlcommon.base.BaseActivityMgr
import
com.ydl.ydlcommon.base.config.HttpConfig
import
com.ydl.ydlcommon.modular.ModularServiceManager
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.utils.log.LogHelper
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.user.UserHelper
/**
* update by harvie on 2017/7/04
*/
class
WebJavascriptHandler
(
private
val
webView
:
WebView
?,
private
val
wvEnventPro
:
WebViewClientClickListener
?)
:
IJavascriptHandler
()
{
private
val
js
=
JsMethod
(
webView
)
override
fun
getUriAppendSuffix
():
String
{
return
"platform_main_theme=00C9E2&platform_main_theme_light=00D4DF&platform_main_theme_bright=EAFAFC"
}
@JavascriptInterface
fun
sendDataToOC
(
params
:
String
)
{
LogUtil
.
i
(
"js"
,
params
)
LogUtil
.
d
(
"sendDataToOC"
)
//js交互路由 后期会去除掉这个路由 统一使用下面的路由
//该路由只有测试记录h5页面在使用 - 测试题支付/测试题详情/测试题结果
val
webViewRouter
=
WebViewRouterManager
()
if
(
webViewRouter
.
toNative
(
params
))
{
//
return
}
//壹点灵路由
if
(
YDLRouterManager
.
router
(
params
))
{
return
}
if
(
js
.
handle
(
params
))
return
val
jsData
=
Gson
().
fromJson
(
params
,
H5JsBean
::
class
.
java
)
//是否登录
if
(
jsData
.
cmd
?.
action_name
!=
null
&&
jsData
.
cmd
!!
.
action_name
.
equals
(
"login"
))
{
//跳转登陆页面
wvEnventPro
?.
jumpLogin
(
jsData
.
cmd
?.
params
)
return
}
if
(
jsData
.
url
.
equals
(
"http"
))
{
if
(
jsData
.
cmd
?.
params
?.
toUid
!=
0
)
{
wvEnventPro
?.
chat
(
UserHelper
.
getUserInfo
()
?.
uid
?.
toInt
()
?:
0
,
jsData
.
cmd
?.
params
?.
toUid
?:
0
,
0
,
UserHelper
.
getUserInfo
()
?.
accessToken
,
jsData
.
cmd
?.
params
?.
isFromQingShu
?:
0
)
}
else
{
wvEnventPro
?.
openH5
(
jsData
.
cmd
?.
params
)
}
}
else
if
(
jsData
.
url
.
equals
(
"ydl_app"
))
{
wvEnventPro
?.
ydlNative
(
jsData
.
cmd
)
jumpAction
(
jsData
)
}
}
fun
jumpAction
(
jsData
:
H5JsBean
)
{
LogUtil
.
d
(
"jumpAction"
)
when
(
jsData
.
cmd
!!
.
action_name
)
{
"fm"
->
if
(
jsData
.
cmd
!!
.
params
!!
.
id
>
0
)
{
//跳转fm详情页面
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openFmDetail
(
jsData
.
cmd
!!
.
params
!!
.
id
)
}
}
else
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openFmList
()
}
"search_service_doc"
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
searchServiceDoc
(
jsData
.
cmd
!!
.
params
!!
.
cate_id
)
}
"article_list"
->
//文章列表
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openArticle
()
}
"fm_detail"
->
//fm详情
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openFmDetail
(
jsData
.
cmd
!!
.
params
!!
.
id
)
}
"pay"
->
if
(
wvEnventPro
!=
null
)
{
//预约咨询
wvEnventPro
!!
.
pay
(
jsData
.
cmd
?.
params
)
}
"pay_receipt"
->
if
(
wvEnventPro
!=
null
)
{
//专家收款
wvEnventPro
!!
.
payReceipt
(
jsData
.
cmd
?.
params
)
}
"pay_course"
->
//购买课程
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
payCourse
(
jsData
.
cmd
?.
params
)
}
"pay_test"
->
//付费测试
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
payTest
(
jsData
.
cmd
?.
params
)
}
"view_test_result"
->
//查看测试结果
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
viewTestResult
(
jsData
.
cmd
?.
params
)
}
"chat"
->
//私聊
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
chat
(
ModularServiceManager
.
getPlatformUserService
()
?.
getUser
()
?.
userId
?.
toInt
()
?:
0
,
jsData
.
cmd
!!
.
params
!!
.
toUid
,
0
,
ModularServiceManager
.
getPlatformUserService
()
?.
getUser
()
?.
token
,
jsData
.
cmd
!!
.
params
!!
.
isFromQingShu
)
}
"chat_send_message"
->
//跳转私聊:并发送消息
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
chatSendMessage
(
ModularServiceManager
.
getPlatformUserService
()
?.
getUser
()
?.
userId
?.
toInt
()
?:
0
,
jsData
.
cmd
!!
.
params
!!
.
toUid
,
0
,
ModularServiceManager
.
getPlatformUserService
()
?.
getUser
()
?.
token
,
jsData
.
cmd
!!
.
params
!!
.
isFromQingShu
)
}
"chat_team"
->
//群聊
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
chatTeam
(
jsData
.
cmd
!!
.
params
!!
.
tid
,
jsData
.
cmd
!!
.
params
!!
.
doctor_id
)
}
"sendResult"
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
sendInfo
(
jsData
.
cmd
!!
.
params
)
}
"active_send_share"
->
{
val
cover1
=
jsData
.
cmd
!!
.
params
!!
.
share
!!
.
cover
val
title1
=
jsData
.
cmd
!!
.
params
!!
.
share
!!
.
title
val
purl1
=
jsData
.
cmd
!!
.
params
!!
.
share
!!
.
url
val
share_url1
=
jsData
.
cmd
!!
.
params
!!
.
share
!!
.
share_url
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
sendResultTrend
(
cover1
,
title1
,
purl1
,
share_url1
)
}
}
"active_send"
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
sendTrend
()
}
"topic_detail"
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openTopicDetail
(
jsData
.
cmd
?.
params
?.
id
.
toString
()
+
""
)
}
"set_time_warn"
->
//提醒专家设置时间
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
sendSubscriptionTimeMessage
(
""
+
jsData
.
cmd
?.
params
?.
toUid
)
}
"user_home"
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openMember
(
""
+
jsData
.
cmd
?.
params
?.
uid
)
}
"sq_topic"
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openTopicDetail
(
jsData
.
cmd
?.
params
?.
id
.
toString
()
+
""
)
}
"good_expert"
//推荐专家
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
goodExpert
()
}
"copywechat"
//复制到微信
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
copyWechat
(
jsData
.
cmd
?.
params
)
}
"gowechat"
//打开微信
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
goWechat
()
}
//课程播放--不区分音视频或者试听
"course_play"
->
{
wvEnventPro
!!
.
coursePlay
(
jsData
.
cmd
?.
params
)
}
//h5播放时,需要关闭app中悬浮的播放窗
"course_close_float_view"
->
{
wvEnventPro
!!
.
closeFloatView
()
}
//课程评论
"course_write_comment"
->
{
wvEnventPro
!!
.
courseWriteComment
(
jsData
.
cmd
?.
params
)
}
"contact_yi"
//联系小壹
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
contactYi
()
}
"contact_course_customer_service"
//联系课程专属客服
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
contactCourseCustomerService
()
}
"course_comments"
//课程评论
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
courseComment
(
jsData
.
cmd
?.
params
)
}
"test_item"
->
//开始测试
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openTest
(
jsData
.
cmd
?.
params
)
}
"doctor_home"
//专家主页
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openExpertsHome
(
jsData
.
cmd
?.
params
)
}
"search_list"
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
searchList
(
jsData
.
cmd
?.
params
)
}
"order_detail"
//我的订单详情
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openOrderDetail
(
jsData
.
cmd
?.
params
)
}
"expert_product"
//专家商品详情
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
expertProduct
(
jsData
.
cmd
?.
params
)
}
"order"
//订单预约页面
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
order
(
jsData
.
cmd
?.
params
)
}
"to_order_ct"
//免费体验下单页面
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
toOrderCt
(
jsData
.
cmd
?.
params
)
}
"show_doc"
//搜索专家的列表
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
showDocList
(
jsData
.
cmd
?.
params
)
}
"listen-order-detail"
//倾诉订单详情
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
listenOrderDetail
(
jsData
.
cmd
?.
params
)
}
"detail-sub"
//预约订单子订单
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
detailSub
(
jsData
.
cmd
?.
params
)
}
"agreement"
//用户协议
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
openAgreement
(
jsData
.
cmd
?.
params
)
}
"modify-eval"
->
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
!!
.
modifyEval
(
jsData
.
cmd
?.
params
)
}
"view-eval"
//查看评价
->
{
wvEnventPro
?.
visitEval
(
jsData
.
cmd
?.
params
)
}
"article"
->
{
wvEnventPro
?.
openH5
(
jsData
.
cmd
?.
params
)
}
"test"
->
{
wvEnventPro
?.
openH5
(
jsData
.
cmd
?.
params
)
}
"test_detail"
->
{
//测试详情页
wvEnventPro
?.
openTestDetail
(
jsData
.
cmd
?.
params
)
}
"test_list"
->
{
wvEnventPro
?.
openTestList
()
}
"course_list"
->
//课程列表
wvEnventPro
?.
courseList
()
"active_detail"
->
{
//动态详情
wvEnventPro
?.
activeDetail
(
jsData
.
cmd
?.
params
?.
id
.
toString
()
+
""
)
}
"listen_tel"
->
{
//倾诉,立即连接
wvEnventPro
?.
listenTel
(
jsData
.
cmd
?.
params
)
}
"listen_agora"
->
{
//声网
wvEnventPro
?.
listenAgora
(
jsData
.
cmd
?.
params
)
}
"confide_connect"
->
{
//倾诉链接 java接口,支持axb和声网
wvEnventPro
?.
confideConnect
(
jsData
.
cmd
?.
params
)
}
"voice_broadcast"
->
{
//语音直播
LogHelper
.
getInstance
().
writeLogSync
(
"课程详情页进入课程 "
+
"replay_url = "
+
jsData
.
cmd
?.
params
?.
replay_url
+
", roomid = "
+
jsData
.
cmd
?.
params
?.
roomid
+
", roomname = "
+
jsData
.
cmd
?.
params
?.
roomname
+
", starttime = "
+
jsData
.
cmd
?.
params
?.
start_time
)
wvEnventPro
?.
voiceBroadcast
(
jsData
.
cmd
?.
params
)
}
"tel"
->
{
wvEnventPro
?.
tel
(
jsData
.
cmd
?.
params
)
}
"onorder_by_app"
->
{
//预约下单
wvEnventPro
?.
onOrderByApp
(
jsData
.
cmd
?.
params
)
}
"feedback"
->
{
wvEnventPro
?.
feedBack
()
}
"order_set_time"
->
{
//预约下单--选择时间回调
wvEnventPro
?.
orderSetTime
(
jsData
.
cmd
?.
params
)
}
"listen_list"
->
{
wvEnventPro
?.
phoneCall
()
}
"action_share"
->
{
LogUtil
.
d
(
"action_share"
)
wvEnventPro
?.
shareAction
(
jsData
.
cmd
?.
params
)
}
"chat_schedule"
->
{
// 专家修改时间和用户确认时间跳转到私聊
wvEnventPro
?.
chatSchedule
(
jsData
.
cmd
?.
params
)
}
"action_invite"
->
{
wvEnventPro
?.
invite
(
jsData
.
cmd
?.
params
)
}
"action_fund"
->
{
wvEnventPro
?.
balance
(
jsData
.
cmd
?.
params
)
}
"down_refresh"
->
{
// 禁止下拉刷新
wvEnventPro
?.
switchDownRefresh
(
jsData
.
cmd
?.
params
)
}
//跳转充值界面
"recharge"
->
{
wvEnventPro
?.
recharge
()
}
//跳转绑定手机号
"bind_phone"
->
{
wvEnventPro
?.
bindPhone
()
}
"refresh"
->
{
wvEnventPro
?.
refresh
()
}
"set_title"
->
{
wvEnventPro
?.
setTitle
(
jsData
.
cmd
?.
params
)
}
"save_image"
->
{
wvEnventPro
?.
saveImage
(
jsData
.
cmd
?.
params
)
}
"send_to_expert"
->
{
wvEnventPro
?.
sendToExpert
(
jsData
.
cmd
?.
params
)
}
"confide_pay"
->
{
wvEnventPro
?.
confidePay
(
jsData
.
cmd
?.
params
)
}
"back"
->
{
//用于h5页面返回上一级
wvEnventPro
?.
back
()
}
//购买系列课程
"common_pay"
->
{
wvEnventPro
?.
commonPay
(
jsData
.
cmd
?.
params
)
}
"hideStatusBar"
->
{
wvEnventPro
?.
hideStatusBar
()
}
"showStatusBar"
->
{
wvEnventPro
?.
showStatusBar
()
}
"openRightTopMenu"
->
{
wvEnventPro
?.
openRightTopMenu
()
}
"openShareMenu"
->
{
wvEnventPro
?.
openShareMenu
(
jsData
.
cmd
?.
params
)
}
"close"
->
{
wvEnventPro
?.
closeWebKit
()
}
//关闭所有页面,返回首页
"goHome"
->
{
wvEnventPro
?.
goHome
(
jsData
.
cmd
?.
params
)
}
"chatUnread"
->
{
wvEnventPro
?.
sendUnReadNum
(
jsData
.
cmd
!!
.
params
?.
callBack
,
jsData
.
cmd
!!
.
params
?.
uid
.
toString
())
}
"showTitleBar"
->
{
jsData
.
cmd
!!
.
params
?.
let
{
wvEnventPro
?.
shouldShowTitleBar
(
it
.
isShowTitleBar
!!
)
}
}
"setSelfPageType"
->
{
jsData
.
cmd
!!
.
params
?.
let
{
wvEnventPro
?.
setSelfPageType
(
it
.
selfPageType
)
}
}
"chat_close_bottom_webview"
->
{
jsData
.
cmd
!!
.
params
?.
let
{
wvEnventPro
?.
chatCloseBottomWebView
()
}
}
"meditation_play"
->
{
jsData
.
cmd
!!
.
params
?.
let
{
val
mediaId
=
it
.
mediaId
val
meditationId
=
it
.
meditationId
val
meditationType
=
it
.
meditionType
val
mediaCoverUrl
=
it
.
coverImageUrl
if
(
mediaId
!=
null
&&
meditationId
!=
null
&&
meditationType
!=
null
)
{
wvEnventPro
?.
playMeditation
(
mediaId
,
meditationId
.
toLong
(),
meditationType
,
mediaCoverUrl
)
}
}
}
"switch_sound"
->
{
jsData
.
cmd
!!
.
params
?.
let
{
val
mediaId
=
it
.
mediaId
val
meditationId
=
it
.
meditationId
val
meditationType
=
it
.
meditionType
val
businessType
=
it
.
businessType
val
buried
=
it
.
buried
val
mediaUrl
=
it
.
mediaUrl
val
mediaCoverUrl
=
it
.
coverImageUrl
val
title
=
it
.
title
val
desc
=
it
.
desc
val
status
=
it
.
status
if
(
mediaId
!=
null
&&
meditationId
!=
null
&&
meditationType
!=
null
)
{
wvEnventPro
?.
switchSound
(
mediaId
,
meditationType
.
toLong
(),
businessType
!!
,
meditationId
,
buried
,
mediaUrl
,
mediaCoverUrl
,
title
,
desc
,
status
)
}
}
}
"loadUrl"
->
{
jsData
.
cmd
?.
params
?.
let
{
wvEnventPro
?.
reloadUrl
(
jsData
.
cmd
?.
params
?.
url
)
}
}
"webViewBackgroundColor"
->
{
jsData
.
cmd
?.
params
?.
let
{
val
rgb
=
it
.
color
val
alpha
=
it
.
alpha
wvEnventPro
?.
setWebViewBG
(
rgb
,
alpha
)
}
}
//再换一位
"get_next_doctor"
->{
wvEnventPro
?.
getNextExpertStatus
(
jsData
.
cmd
?.
params
?.
doctorId
.
toString
(),
jsData
.
cmd
?.
params
?.
title
,
jsData
.
cmd
?.
params
?.
uid
.
toString
(),
jsData
.
cmd
?.
params
?.
linkUrl
)
}
"show_popup_window"
->
{
val
doctorId
=
jsData
.
cmd
?.
params
?.
doctorId
?.
toString
()
val
confideId
=
jsData
.
cmd
?.
params
?.
confidedId
val
uid
=
jsData
.
cmd
?.
params
?.
uid
?.
toString
()
val
topActivity
=
BaseActivityMgr
.
INST
.
getTopActivity
()
if
(
topActivity
is
FragmentActivity
&&
doctorId
!=
null
&&
confideId
!=
null
)
{
val
url
=
HttpConfig
.
MH5_URL
+
ConfideRoute
.
h5ConfideIntro
(
confideId
)
findRouteService
(
IConfideService
::
class
.
java
).
showExpertDetailDialog
(
topActivity
,
url
,
doctorId
,
uid
?:
""
)
}
}
"switch_push_status"
->
{
wvEnventPro
?.
switchPushStatus
(
jsData
.
cmd
?.
params
)
}
// 打开时间选择器
"requestSelectTime"
->{
if
(
Utils
.
isFastClick
()){
return
}
wvEnventPro
?.
openTimePicker
(
jsData
.
cmd
?.
params
?.
callBack
,
jsData
.
cmd
?.
params
?.
day
,
jsData
.
cmd
?.
params
?.
doctorId
.
toString
(),
jsData
.
cmd
?.
params
?.
orderId
)
}
"open_article_comment_dialog"
->
{
wvEnventPro
?.
showCommentArticleDialog
(
jsData
.
cmd
?.
params
)
}
"resources_to_preview"
->
{
wvEnventPro
?.
resourceToPreview
(
jsData
.
cmd
?.
params
)
}
"doctor_booking"
->
{
wvEnventPro
?.
showDocBooking
(
jsData
.
cmd
?.
params
)
}
}
}
}
app/src/main/java/com/ydl/component/service/web/WebViewClientClickListener.java
deleted
100644 → 0
View file @
4dfc6b87
package
com
.
ydl
.
component
.
service
.
web
;
import
com.ydl.webview.H5JsBean
;
/**
* webview 点击事件监听
* Created by harvie on 2017/7/4 0004.
*/
public
interface
WebViewClientClickListener
{
void
openH5
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
courseList
();
void
activeDetail
(
String
id
);
void
contactYi
();
void
contactCourseCustomerService
();
void
openTopicDetail
(
String
topic_id
);
void
openMember
(
String
id
);
void
sendTrend
();
void
sendResultTrend
(
final
String
cover1
,
final
String
title1
,
final
String
purl1
,
String
share_url1
);
void
sendInfo
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
searchList
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
openExpertsHome
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
openTest
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
chat
(
int
id
,
int
toUid
,
int
canTalk
,
String
accessToken
,
int
isFromQingShu
);
void
chatSendMessage
(
int
id
,
int
toUid
,
int
canTalk
,
String
accessToken
,
int
isFromQingShu
);
void
chatTeam
(
int
tid
,
int
doctorId
);
void
jumpLogin
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
openFmDetail
(
int
id
);
void
openArticle
();
void
openFmList
();
void
sendSubscriptionTimeMessage
(
String
to_uid
);
void
pay
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
payReceipt
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
payCourse
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
payTest
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
viewTestResult
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
ydlNative
(
H5JsBean
.
H5JsCmd
jsData
);
//用于神策统计
void
openOrderDetail
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
expertProduct
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
order
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
toOrderCt
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
showDocList
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
goodExpert
();
void
copyWechat
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
goWechat
();
void
listenOrderDetail
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
detailSub
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
openAgreement
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
modifyEval
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
visitEval
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
coursePlay
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
closeFloatView
();
void
courseWriteComment
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
courseComment
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
listenTel
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
voiceBroadcast
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
tel
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
onOrderByApp
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
orderSetTime
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
searchServiceDoc
(
int
cateId
);
void
openTestDetail
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
shareAction
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
openTestList
();
void
feedBack
();
void
phoneCall
();
void
chatSchedule
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
invite
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
balance
(
H5JsBean
.
H5JsCmd
.
Params
params
);
//是否显示下拉刷新控件
void
switchDownRefresh
(
H5JsBean
.
H5JsCmd
.
Params
params
);
//跳转充值界面
void
recharge
();
void
bindPhone
();
//界面刷新
void
refresh
();
//声网拨号逻辑
void
listenAgora
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
setTitle
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
saveImage
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
sendToExpert
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
confideConnect
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
confidePay
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
void
back
();
//调用公共支付的
void
commonPay
(
H5JsBean
.
H5JsCmd
.
Params
jsData
);
//隐藏statusbar,全屏展示
void
hideStatusBar
();
void
showStatusBar
();
//打开与关闭右上角菜单
void
openRightTopMenu
();
//打开与关闭底部分享弹框
void
openShareMenu
(
H5JsBean
.
H5JsCmd
.
Params
params
);
//关闭页面
void
closeWebKit
();
void
goHome
(
H5JsBean
.
H5JsCmd
.
Params
params
);
//保存图片
// void storePic();
void
sendUnReadNum
(
String
callbackFuncName
,
String
uid
);
//是否展示标题栏
void
shouldShowTitleBar
(
boolean
isShowTitleBar
);
//设置当前页面类型
void
setSelfPageType
(
int
selfType
);
//关闭私聊窗口立即咨询webview
void
chatCloseBottomWebView
();
default
void
playMeditation
(
int
mediaId
,
long
meditationId
,
int
meditationType
,
String
mediaCoverUrl
){}
default
void
switchSound
(
int
mediaId
,
long
meditationId
,
int
meditationType
,
int
businessType
,
String
buried
,
String
mediaUrl
,
String
mediaCoverUrl
,
String
title
,
String
desc
,
int
status
){
}
//页面内跳转url
void
reloadUrl
(
String
url
);
default
void
setWebViewBG
(
String
rgb
,
String
alpha
){}
void
getNextExpertStatus
(
String
doctorID
,
String
title
,
String
uid
,
String
linkUrl
);
//h5页面是否需要打开推送
void
switchPushStatus
(
H5JsBean
.
H5JsCmd
.
Params
params
);
//显示评论弹窗
void
showCommentArticleDialog
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
resourceToPreview
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
showDocBooking
(
H5JsBean
.
H5JsCmd
.
Params
params
);
// 打开时间选择器
void
openTimePicker
(
String
jsCallBackName
,
String
day
,
String
doctorId
,
String
orderId
);
}
m-consultant/src/main/java/com/yidianling/consultant/modular/ConsultantServiceImp.kt
View file @
9de31709
...
@@ -4,25 +4,30 @@ import android.annotation.SuppressLint
...
@@ -4,25 +4,30 @@ import android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Activity
import
android.content.Context
import
android.content.Context
import
android.content.Intent
import
android.content.Intent
import
android
x.fragment.app.Fragmen
t
import
android
.graphics.Rec
t
import
android.text.TextUtils
import
android.text.TextUtils
import
androidx.fragment.app.Fragment
import
com.alibaba.android.arouter.facade.annotation.Route
import
com.alibaba.android.arouter.facade.annotation.Route
import
com.blankj.utilcode.util.ScreenUtils
import
com.google.gson.Gson
import
com.google.gson.Gson
import
com.google.gson.reflect.TypeToken
import
com.google.gson.reflect.TypeToken
import
com.ydl.webview.H5JsBean
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.base.BaseApp
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.data.http.RxUtils
import
com.ydl.ydlcommon.utils.SharedPreferencesEditor
import
com.ydl.ydlcommon.utils.SharedPreferencesEditor
import
com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import
com.ydl.ydlcommon.utils.remind.HttpErrorUtils
import
com.yidianling.consultant.ExpertSearchActivity
import
com.yidianling.consultant.ExpertSearchActivity
import
com.yidianling.consultant.ExpertSearchFragment
import
com.yidianling.consultant.ExpertSearchFragment
import
com.yidianling.consultant.OnBottomWordListener
import
com.yidianling.consultant.api.IConsultantService
import
com.yidianling.consultant.api.IConsultantService
import
com.yidianling.consultant.bean.GuideBean
import
com.yidianling.consultant.bean.GuideBean
import
com.yidianling.consultant.bean.Keyworks
import
com.yidianling.consultant.bean.Keyworks
import
com.yidianling.consultant.data.ConsultantDataManager
import
com.yidianling.consultant.data.ConsultantDataManager
import
com.yidianling.consultant.OnBottomWordListener
import
com.yidianling.consultant.model.SearchApi
import
com.yidianling.consultant.model.SearchApi
import
com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import
com.yidianling.consultant.modular.singlton.ConsultAssistantDialogUtils
import
com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils
import
com.yidianling.consultant.modular.utils.ConsultAssistantEntryUtils
import
com.yidianling.consultant.preview.GPreviewBuilder
import
com.yidianling.consultant.preview.UserViewInfo
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.android.schedulers.AndroidSchedulers
import
io.reactivex.schedulers.Schedulers
import
io.reactivex.schedulers.Schedulers
...
@@ -149,6 +154,32 @@ class ConsultantServiceImp : IConsultantService {
...
@@ -149,6 +154,32 @@ class ConsultantServiceImp : IConsultantService {
})
})
}
}
override
fun
resourceToPreview
(
dataList
:
List
<
H5JsBean
.
MediaInfo
>?,
params
:
H5JsBean
.
H5JsCmd
.
Params
,
activity
:
Activity
)
{
val
mThumbViewInfoList
:
MutableList
<
UserViewInfo
>
=
ArrayList
()
dataList
?.
let
{
for
(
mediaInfo
in
it
)
{
val
userViewInfo
=
UserViewInfo
(
mediaInfo
.
cover
,
mediaInfo
.
url
,
mediaInfo
.
sourcesType
)
val
bounds
=
Rect
()
bounds
.
left
=
ScreenUtils
.
getScreenWidth
()
/
2
bounds
.
top
=
ScreenUtils
.
getScreenHeight
()
/
2
bounds
.
right
=
ScreenUtils
.
getScreenWidth
()
/
2
bounds
.
bottom
=
ScreenUtils
.
getScreenHeight
()
/
2
userViewInfo
.
bounds
=
bounds
mThumbViewInfoList
.
add
(
userViewInfo
)
}
GPreviewBuilder
.
form
(
activity
)
.
setData
(
mThumbViewInfoList
)
.
setCurrentIndex
(
params
.
preview_index
)
.
setFullscreen
(
true
)
.
setToUid
(
params
.
info
?.
toUid
.
toString
()
+
""
)
.
setDoctorId
(
params
.
info
?.
doctorId
)
.
setType
(
GPreviewBuilder
.
IndicatorType
.
Dot
)
.
start
()
}
}
override
fun
resetConsultAssistantDialogStatus
()
{
override
fun
resetConsultAssistantDialogStatus
()
{
ConsultAssistantDialogUtils
.
INSTANCE
.
resetStatus
()
ConsultAssistantDialogUtils
.
INSTANCE
.
resetStatus
()
}
}
...
...
m-js/src/main/java/com/ydl/js/JsMethod.kt
View file @
9de31709
...
@@ -113,7 +113,7 @@ class JsMethod(private val webView: WebView?) {
...
@@ -113,7 +113,7 @@ class JsMethod(private val webView: WebView?) {
if
(
callback
.
isNullOrBlank
())
return
true
if
(
callback
.
isNullOrBlank
())
return
true
webView
?.
post
{
webView
?.
post
{
when
(
type
)
{
when
(
type
)
{
1
->
{
//检查音频权限能力
1
,
2
->
{
//检查音频权限能力
webView
.
loadUrl
(
"javascript:$callback(1)"
)
webView
.
loadUrl
(
"javascript:$callback(1)"
)
}
}
else
->
{
else
->
{
...
...
m-js/src/main/java/com/ydl/js/NewH5_JavascriptHandler.kt
View file @
9de31709
...
@@ -10,10 +10,10 @@ import com.ydl.js_module.manager.WebViewRouterManager
...
@@ -10,10 +10,10 @@ import com.ydl.js_module.manager.WebViewRouterManager
import
com.ydl.webview.H5JsBean
import
com.ydl.webview.H5JsBean
import
com.ydl.webview.IJavascriptHandler
import
com.ydl.webview.IJavascriptHandler
import
com.ydl.ydl_router.manager.YDLRouterManager
import
com.ydl.ydl_router.manager.YDLRouterManager
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.base.BaseActivityMgr
import
com.ydl.ydlcommon.base.BaseActivityMgr
import
com.ydl.ydlcommon.base.config.HttpConfig
import
com.ydl.ydlcommon.base.config.HttpConfig
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.utils.Utils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.ydl.ydlcommon.utils.log.AliYunLogConfig
import
com.ydl.ydlcommon.utils.log.AliYunLogConfig
import
com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
import
com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper
...
@@ -35,8 +35,7 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
...
@@ -35,8 +35,7 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
@JavascriptInterface
@JavascriptInterface
fun
sendDataToOC
(
params
:
String
)
{
fun
sendDataToOC
(
params
:
String
)
{
LogUtil
.
i
(
"js"
,
params
)
LogUtil
.
e
(
"js"
,
params
)
LogUtil
.
d
(
"sendDataToOC"
)
AliYunRichLogsHelper
.
getInstance
().
sendRichLog
(
AliYunLogConfig
.
WEB
,
"params:$params"
)
AliYunRichLogsHelper
.
getInstance
().
sendRichLog
(
AliYunLogConfig
.
WEB
,
"params:$params"
)
//js交互路由 后期会去除掉这个路由 统一使用下面的路由
//js交互路由 后期会去除掉这个路由 统一使用下面的路由
//该路由只有测试记录h5页面在使用 - 测试题支付/测试题详情/测试题结果
//该路由只有测试记录h5页面在使用 - 测试题支付/测试题详情/测试题结果
...
@@ -122,7 +121,7 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
...
@@ -122,7 +121,7 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
"view_test_result"
->
"view_test_result"
->
//查看测试结果
//查看测试结果
if
(
wvEnventPro
!=
null
)
{
if
(
wvEnventPro
!=
null
)
{
wvEnventPro
?
.
viewTestResult
(
jsData
.
cmd
?.
params
)
wvEnventPro
!!
.
viewTestResult
(
jsData
.
cmd
?.
params
)
}
}
"chat"
->
"chat"
->
//私聊
//私聊
...
@@ -492,6 +491,20 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
...
@@ -492,6 +491,20 @@ class NewH5_JavascriptHandler(private val webView: WebView?, private val wvEnven
wvEnventPro
?.
chatCloseBottomWebView
()
wvEnventPro
?.
chatCloseBottomWebView
()
}
}
}
}
"open_article_comment_dialog"
->
{
wvEnventPro
?.
showCommentArticleDialog
(
jsData
.
cmd
?.
params
)
}
"resources_to_preview"
->
{
wvEnventPro
?.
resourceToPreview
(
jsData
.
cmd
?.
params
)
}
"doctor_booking"
->
{
wvEnventPro
?.
showDocBooking
(
jsData
.
cmd
?.
params
)
}
}
}
}
}
}
}
m-js/src/main/java/com/ydl/js/NewH5_WVClickAbstractListener.java
View file @
9de31709
...
@@ -29,6 +29,7 @@ import com.ydl.webview.NewH5Activity;
...
@@ -29,6 +29,7 @@ import com.ydl.webview.NewH5Activity;
import
com.ydl.ydl_router.manager.YDLRouterManager
;
import
com.ydl.ydl_router.manager.YDLRouterManager
;
import
com.ydl.ydlcommon.base.config.HttpConfig
;
import
com.ydl.ydlcommon.base.config.HttpConfig
;
import
com.ydl.ydlcommon.modular.ModularServiceManager
;
import
com.ydl.ydlcommon.modular.ModularServiceManager
;
import
com.ydl.ydlcommon.modular.ModularServiceManagerKt
;
import
com.ydl.ydlcommon.router.IYDLRouterConstant
;
import
com.ydl.ydlcommon.router.IYDLRouterConstant
;
import
com.ydl.ydlcommon.router.YdlCommonOut
;
import
com.ydl.ydlcommon.router.YdlCommonOut
;
import
com.ydl.ydlcommon.utils.ActivityManager
;
import
com.ydl.ydlcommon.utils.ActivityManager
;
...
@@ -1146,6 +1147,18 @@ public class NewH5_WVClickAbstractListener implements NewH5_WebViewClientClickLi
...
@@ -1146,6 +1147,18 @@ public class NewH5_WVClickAbstractListener implements NewH5_WebViewClientClickLi
@Override
@Override
public
void
chatCloseBottomWebView
()
{
public
void
chatCloseBottomWebView
()
{
EventBus
.
getDefault
().
post
(
new
CloseBottomWebviewEvent
(
true
));
EventBus
.
getDefault
().
post
(
new
CloseBottomWebviewEvent
(
true
));
ModularServiceManager
.
INSTANCE
.
provide
(
IImService
.
class
).
dismissConsultServiceDialog
();
}
@Override
public
void
resourceToPreview
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
List
<
H5JsBean
.
MediaInfo
>
dataList
=
params
.
getDataList
();
ModularServiceManagerKt
.
findRouteService
(
IConsultantService
.
class
).
resourceToPreview
(
dataList
,
params
,
mActivity
);
}
@Override
public
void
showDocBooking
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
ModularServiceManager
.
INSTANCE
.
provide
(
IImService
.
class
).
showConsultServiceDialog
(
mActivity
,
params
.
getToUid
()
+
""
,
params
.
getDoctorId
()
+
""
);
}
}
@Override
@Override
...
@@ -1223,4 +1236,11 @@ public class NewH5_WVClickAbstractListener implements NewH5_WebViewClientClickLi
...
@@ -1223,4 +1236,11 @@ public class NewH5_WVClickAbstractListener implements NewH5_WebViewClientClickLi
((
NewH5Activity
)
mActivity
).
setBG
(
rgb
,
alpha
);
((
NewH5Activity
)
mActivity
).
setBG
(
rgb
,
alpha
);
}
}
}
}
@Override
public
void
showCommentArticleDialog
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
if
(
mActivity
instanceof
NewH5Activity
){
((
NewH5Activity
)
mActivity
).
showCommentArticleDialog
(
params
.
getTitle
());
}
}
}
}
m-js/src/main/java/com/ydl/js/NewH5_WebViewClientClickListener.java
View file @
9de31709
...
@@ -37,7 +37,7 @@ public interface NewH5_WebViewClientClickListener {
...
@@ -37,7 +37,7 @@ public interface NewH5_WebViewClientClickListener {
void
openTest
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
openTest
(
H5JsBean
.
H5JsCmd
.
Params
params
);
//注册引导页--跳转私聊界面
//注册引导页--跳转私聊界面
void
chat
(
int
id
,
int
toUid
,
int
canTalk
,
String
accessToken
,
int
isFromQingShu
,
boolean
closeReplaceChat
);
void
chat
(
int
id
,
int
toUid
,
int
canTalk
,
String
accessToken
,
int
isFromQingShu
,
boolean
closeReplaceChat
);
void
chatSendMessage
(
int
id
,
int
toUid
,
int
canTalk
,
String
accessToken
,
int
isFromQingShu
);
void
chatSendMessage
(
int
id
,
int
toUid
,
int
canTalk
,
String
accessToken
,
int
isFromQingShu
);
...
@@ -224,4 +224,10 @@ public interface NewH5_WebViewClientClickListener {
...
@@ -224,4 +224,10 @@ public interface NewH5_WebViewClientClickListener {
* 关闭私聊窗口立即咨询webview
* 关闭私聊窗口立即咨询webview
*/
*/
void
chatCloseBottomWebView
();
void
chatCloseBottomWebView
();
void
showCommentArticleDialog
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
resourceToPreview
(
H5JsBean
.
H5JsCmd
.
Params
params
);
void
showDocBooking
(
H5JsBean
.
H5JsCmd
.
Params
params
);
}
}
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