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
11d2889f
Commit
11d2889f
authored
May 28, 2022
by
范玉宾
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'd/4.3.93_muse' into 'd/lancet/4.3.93_muse'
# Conflicts: # config.gradle
parents
c2c63634
d9768508
Show whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
93 additions
and
87 deletions
+93
-87
WVClickAbstractListener.java
app/src/main/java/com/ydl/component/service/web/WVClickAbstractListener.java
+12
-2
WebJavascriptHandler.kt
app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
+6
-0
WebViewClientClickListener.java
app/src/main/java/com/ydl/component/service/web/WebViewClientClickListener.java
+2
-1
config.gradle
config.gradle
+10
-10
ChooseMusicActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/ChooseMusicActivity.kt
+61
-18
PlayMeditationActivity.kt
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
+2
-1
JsInterface.kt
m-muse/src/main/java/com/yidianling/muse/dialog/JsInterface.kt
+0
-49
NewH5Activity.java
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
+0
-6
No files found.
app/src/main/java/com/ydl/component/service/web/WVClickAbstractListener.java
View file @
11d2889f
...
@@ -2,7 +2,6 @@ package com.ydl.component.service.web;
...
@@ -2,7 +2,6 @@ package com.ydl.component.service.web;
import
android.app.Activity
;
import
android.app.Activity
;
import
android.content.Intent
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.ydl.confide.api.IConfideService
;
import
com.ydl.confide.api.IConfideService
;
...
@@ -12,6 +11,7 @@ import com.ydl.webview.NewH5Activity;
...
@@ -12,6 +11,7 @@ import com.ydl.webview.NewH5Activity;
import
com.ydl.ydlcommon.modular.ModularServiceManager
;
import
com.ydl.ydlcommon.modular.ModularServiceManager
;
import
com.yidianling.common.tools.LogUtil
;
import
com.yidianling.common.tools.LogUtil
;
import
com.yidianling.im.api.service.IImService
;
import
com.yidianling.im.api.service.IImService
;
import
com.yidianling.muse.activity.ChooseMusicActivity
;
/**
/**
* webview 点击事件监听 抽象类
* webview 点击事件监听 抽象类
...
@@ -466,9 +466,19 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
...
@@ -466,9 +466,19 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
public
void
switchSound
(
int
mediaId
,
long
meditationId
,
int
meditationType
,
int
businessType
,
public
void
switchSound
(
int
mediaId
,
long
meditationId
,
int
meditationType
,
int
businessType
,
String
buried
,
String
mediaUrl
,
String
mediaCoverUrl
,
String
buried
,
String
mediaUrl
,
String
mediaCoverUrl
,
String
title
,
String
desc
,
int
status
)
{
String
title
,
String
desc
,
int
status
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
switchSound
(
mediaId
,
meditationId
,
meditationType
,
((
NewH5Activity
)
mContext
).
switchSound
(
mediaId
,
meditationId
,
meditationType
,
businessType
,
buried
,
mediaUrl
,
mediaCoverUrl
,
title
,
desc
,
status
);
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
reloadUrl
(
String
url
)
{
if
(
mContext
instanceof
NewH5Activity
)
{
((
NewH5Activity
)
mContext
).
loadUrl
(
url
);
}
}
}
}
}
}
app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
View file @
11d2889f
...
@@ -414,6 +414,12 @@ class WebJavascriptHandler : IJavascriptHandler{
...
@@ -414,6 +414,12 @@ class WebJavascriptHandler : IJavascriptHandler{
}
}
}
}
"loadUrl"
->
{
jsData
.
cmd
?.
params
?.
let
{
wvEnventPro
?.
reloadUrl
(
jsData
.
cmd
?.
params
?.
url
)
}
}
}
}
}
}
}
}
app/src/main/java/com/ydl/component/service/web/WebViewClientClickListener.java
View file @
11d2889f
...
@@ -189,5 +189,6 @@ public interface WebViewClientClickListener {
...
@@ -189,5 +189,6 @@ public interface WebViewClientClickListener {
String
desc
,
int
status
){
String
desc
,
int
status
){
}
}
//页面内跳转url
void
reloadUrl
(
String
url
);
}
}
config.gradle
View file @
11d2889f
...
@@ -8,13 +8,13 @@ ext {
...
@@ -8,13 +8,13 @@ ext {
"m-confide"
:
"0.0.49.74"
,
"m-confide"
:
"0.0.49.74"
,
"m-consultant"
:
"0.0.60.25"
,
"m-consultant"
:
"0.0.60.25"
,
"m-fm"
:
"0.0.30.08"
,
"m-fm"
:
"0.0.30.08"
,
"m-user"
:
"0.0.62.
20
"
,
"m-user"
:
"0.0.62.
19
"
,
"m-home"
:
"0.0.23.6
6
"
,
"m-home"
:
"0.0.23.6
7
"
,
"m-im"
:
"0.0.21.44"
,
"m-im"
:
"0.0.21.44"
,
"m-dynamic"
:
"0.0.7.73"
,
"m-dynamic"
:
"0.0.7.73"
,
"m-article"
:
"0.0.0.10"
,
"m-article"
:
"0.0.0.10"
,
"m-muse"
:
"0.0.28.4
7
"
,
"m-muse"
:
"0.0.28.4
9
"
,
"m-tests"
:
"0.0.24.18"
,
"m-tests"
:
"0.0.24.18"
,
"m-course"
:
"0.0.43.37"
,
"m-course"
:
"0.0.43.37"
,
...
@@ -38,10 +38,10 @@ ext {
...
@@ -38,10 +38,10 @@ ext {
"ydl-platform"
:
"0.0.41.15"
,
"ydl-platform"
:
"0.0.41.15"
,
//第二步 若干
//第二步 若干
"ydl-webview"
:
"0.0.38.8
2
"
,
"ydl-webview"
:
"0.0.38.8
4
"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-pay"
:
"0.0.18.19"
,
"ydl-pay"
:
"0.0.18.19"
,
"m-audioim"
:
"0.0.49.29.9
0
"
,
"m-audioim"
:
"0.0.49.29.9
4
"
,
"ydl-flutter-base"
:
"0.0.14.38"
,
"ydl-flutter-base"
:
"0.0.14.38"
,
//以下 几乎不会动
//以下 几乎不会动
...
@@ -93,13 +93,13 @@ ext {
...
@@ -93,13 +93,13 @@ ext {
"m-confide"
:
"0.0.49.74"
,
"m-confide"
:
"0.0.49.74"
,
"m-consultant"
:
"0.0.60.25"
,
"m-consultant"
:
"0.0.60.25"
,
"m-fm"
:
"0.0.30.08"
,
"m-fm"
:
"0.0.30.08"
,
"m-user"
:
"0.0.62.
20
"
,
"m-user"
:
"0.0.62.
19
"
,
"m-home"
:
"0.0.23.6
6
"
,
"m-home"
:
"0.0.23.6
7
"
,
"m-im"
:
"0.0.21.44"
,
"m-im"
:
"0.0.21.44"
,
"m-dynamic"
:
"0.0.7.73"
,
"m-dynamic"
:
"0.0.7.73"
,
"m-article"
:
"0.0.0.8"
,
"m-article"
:
"0.0.0.8"
,
"m-muse"
:
"0.0.28.4
7
"
,
"m-muse"
:
"0.0.28.4
9
"
,
"m-tests"
:
"0.0.24.18"
,
"m-tests"
:
"0.0.24.18"
,
"m-course"
:
"0.0.43.37"
,
"m-course"
:
"0.0.43.37"
,
//-------------- 业务模块 API 层 --------------
//-------------- 业务模块 API 层 --------------
...
@@ -121,10 +121,10 @@ ext {
...
@@ -121,10 +121,10 @@ ext {
"ydl-platform"
:
"0.0.41.15"
,
"ydl-platform"
:
"0.0.41.15"
,
//第二步 若干
//第二步 若干
"ydl-webview"
:
"0.0.38.8
2
"
,
"ydl-webview"
:
"0.0.38.8
4
"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-media"
:
"0.0.21.44"
,
"ydl-pay"
:
"0.0.18.19"
,
"ydl-pay"
:
"0.0.18.19"
,
"m-audioim"
:
"0.0.49.29.9
0
"
,
"m-audioim"
:
"0.0.49.29.9
4
"
,
"ydl-flutter-base"
:
"0.0.14.38"
,
"ydl-flutter-base"
:
"0.0.14.38"
,
//以下 几乎不会动
//以下 几乎不会动
...
...
m-muse/src/main/java/com/yidianling/muse/activity/ChooseMusicActivity.kt
View file @
11d2889f
...
@@ -8,32 +8,43 @@ import android.net.Uri
...
@@ -8,32 +8,43 @@ import android.net.Uri
import
android.os.Build
import
android.os.Build
import
android.os.Bundle
import
android.os.Bundle
import
android.text.TextUtils
import
android.text.TextUtils
import
android.util.Log
import
android.view.View
import
android.view.View
import
android.webkit.WebResourceRequest
import
android.webkit.WebResourceRequest
import
android.webkit.WebSettings
import
android.webkit.WebSettings
import
android.webkit.WebView
import
android.webkit.WebView
import
android.webkit.WebViewClient
import
android.webkit.WebViewClient
import
com.ydl.utils.WebUrlParamsUtils
import
com.ydl.utils.WebUrlParamsUtils
import
com.ydl.webview.H5Params
import
com.ydl.webview.IJavascriptHandler
import
com.ydl.webview.TellData
import
com.ydl.webview.WebModularServiceUtils.Companion.getWebService
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.event.MeditationEvent
import
com.ydl.ydlcommon.event.MeditationEvent
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.muse.R
import
com.yidianling.muse.R
import
com.yidianling.muse.dialog.JsInterface
import
de.greenrobot.event.EventBus
import
de.greenrobot.event.EventBus
import
kotlinx.android.synthetic.main.dialog_choose_music.*
import
kotlinx.android.synthetic.main.dialog_choose_music.*
import
org.json.JSONException
import
org.json.JSONObject
/**
/**
* Created by Ykai on 2022/5/26.
* Created by Ykai on 2022/5/26.
*/
*/
class
ChooseMusicActivity
:
BaseActivity
()
{
class
ChooseMusicActivity
:
BaseActivity
()
{
private
val
TAG
=
ChooseMusicActivity
::
class
.
java
.
simpleName
protected
var
jtoJHandle
:
IJavascriptHandler
?
=
null
private
lateinit
var
mUrl
:
String
/*** 路由传递过来的参数 */
val
ROUTER_PARAMS
=
"routerParam"
companion
object
{
companion
object
{
private
const
val
URL
=
"url"
const
val
PARAMS
=
"h5Params"
fun
launch
(
context
:
Context
,
url
:
String
)
{
/***接收参数 */
private
var
h5Params
:
H5Params
?
=
null
fun
launch
(
context
:
Context
,
h5Params
:
H5Params
)
{
Intent
(
context
,
ChooseMusicActivity
::
class
.
java
).
apply
{
Intent
(
context
,
ChooseMusicActivity
::
class
.
java
).
apply
{
putExtra
(
URL
,
url
)
putExtra
(
PARAMS
,
h5Params
)
context
.
startActivity
(
this
)
context
.
startActivity
(
this
)
}
}
}
}
...
@@ -41,7 +52,6 @@ class ChooseMusicActivity : BaseActivity() {
...
@@ -41,7 +52,6 @@ class ChooseMusicActivity : BaseActivity() {
override
fun
initDataAndEvent
()
{
override
fun
initDataAndEvent
()
{
//正常获取入参
//正常获取入参
mUrl
=
intent
.
getStringExtra
(
URL
)
}
}
override
fun
layoutResId
():
Int
{
override
fun
layoutResId
():
Int
{
...
@@ -50,16 +60,22 @@ class ChooseMusicActivity : BaseActivity() {
...
@@ -50,16 +60,22 @@ class ChooseMusicActivity : BaseActivity() {
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
super
.
onCreate
(
savedInstanceState
)
getParam
()
var
tellData
=
TellData
()
jtoJHandle
=
getWebService
().
getJavascripHandler
(
this
,
tellData
.
also
{
tellData
=
it
})
initView
()
initView
()
}
}
@SuppressLint
(
"SetJavaScriptEnabled"
)
@SuppressLint
(
"SetJavaScriptEnabled"
,
"JavascriptInterface"
)
private
fun
initView
()
{
private
fun
initView
()
{
// 移除有漏洞的系统接口
// 移除有漏洞的系统接口
wv_choose_music
.
removeJavascriptInterface
(
"searchBoxJavaBridge_"
)
wv_choose_music
.
removeJavascriptInterface
(
"searchBoxJavaBridge_"
)
wv_choose_music
.
removeJavascriptInterface
(
"accessibility"
)
wv_choose_music
.
removeJavascriptInterface
(
"accessibility"
)
wv_choose_music
.
removeJavascriptInterface
(
"accessibilityTraversal"
)
wv_choose_music
.
removeJavascriptInterface
(
"accessibilityTraversal"
)
val
mWebSettings
:
WebSettings
=
wv_choose_music
.
settings
val
mWebSettings
:
WebSettings
=
wv_choose_music
.
settings
mWebSettings
.
javaScriptEnabled
=
true
//支持js
mWebSettings
.
javaScriptEnabled
=
true
//支持js
mWebSettings
.
defaultTextEncodingName
=
"GBK"
//设置字符编码
mWebSettings
.
defaultTextEncodingName
=
"GBK"
//设置字符编码
mWebSettings
.
domStorageEnabled
=
true
mWebSettings
.
domStorageEnabled
=
true
...
@@ -70,13 +86,11 @@ class ChooseMusicActivity : BaseActivity() {
...
@@ -70,13 +86,11 @@ class ChooseMusicActivity : BaseActivity() {
mWebSettings
.
mixedContentMode
=
WebSettings
.
LOAD_NORMAL
mWebSettings
.
mixedContentMode
=
WebSettings
.
LOAD_NORMAL
}
}
wv_choose_music
.
scrollBarStyle
=
View
.
SCROLLBARS_INSIDE_OVERLAY
//滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
wv_choose_music
.
scrollBarStyle
=
View
.
SCROLLBARS_INSIDE_OVERLAY
//滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
val
jsInterface
=
JsInterface
(
this
)
wv_choose_music
.
addJavascriptInterface
(
jtoJHandle
,
"javascriptHandler"
)
wv_choose_music
.
addJavascriptInterface
(
jsInterface
,
"javascriptHandler"
)
val
url
=
setUrlHeightParams
(
mU
rl
)
val
url
=
setUrlHeightParams
(
h5Params
?.
u
rl
)
LogUtil
.
e
(
url
)
LogUtil
.
e
(
url
)
wv_choose_music
.
loadUrl
(
url
)
loadUrl
(
url
,
wv_choose_music
)
wv_choose_music
.
webViewClient
=
object
:
WebViewClient
(){
wv_choose_music
.
webViewClient
=
object
:
WebViewClient
(){
...
@@ -85,9 +99,9 @@ class ChooseMusicActivity : BaseActivity() {
...
@@ -85,9 +99,9 @@ class ChooseMusicActivity : BaseActivity() {
}
}
override
fun
shouldOverrideUrlLoading
(
view
:
WebView
,
request
:
WebResourceRequest
):
Boolean
{
override
fun
shouldOverrideUrlLoading
(
view
:
WebView
,
request
:
WebResourceRequest
):
Boolean
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
if
(
Build
.
VERSION
.
SDK_INT
>=
Build
.
VERSION_CODES
.
LOLLIPOP
)
{
view
.
loadUrl
(
request
.
url
.
toString
()
)
loadUrl
(
request
.
url
.
toString
(),
view
)
}
else
{
}
else
{
view
.
loadUrl
(
request
.
toString
()
)
loadUrl
(
request
.
toString
(),
view
)
}
}
return
true
return
true
}
}
...
@@ -97,7 +111,22 @@ class ChooseMusicActivity : BaseActivity() {
...
@@ -97,7 +111,22 @@ class ChooseMusicActivity : BaseActivity() {
finish
()
finish
()
}
}
}
}
private
fun
getParam
()
{
if
(
null
!=
intent
)
{
//正常获取入参
h5Params
=
intent
.
getSerializableExtra
(
PARAMS
)
as
H5Params
//路由传递的入参
if
(
intent
.
hasExtra
(
ROUTER_PARAMS
))
{
val
json
=
intent
.
getStringExtra
(
ROUTER_PARAMS
)
try
{
val
jsonObject
=
JSONObject
(
json
)
h5Params
=
H5Params
(
jsonObject
.
getString
(
"url"
),
""
)
}
catch
(
e
:
JSONException
)
{
e
.
printStackTrace
()
}
}
}
}
fun
switchSound
(
fun
switchSound
(
mediaId
:
Int
,
meditationId
:
Long
,
meditationType
:
Int
,
businessType
:
Int
,
mediaId
:
Int
,
meditationId
:
Long
,
meditationType
:
Int
,
businessType
:
Int
,
...
@@ -111,6 +140,18 @@ class ChooseMusicActivity : BaseActivity() {
...
@@ -111,6 +140,18 @@ class ChooseMusicActivity : BaseActivity() {
EventBus
.
getDefault
().
post
(
event
)
EventBus
.
getDefault
().
post
(
event
)
}
}
fun
loadUrl
(
url
:
String
?,
web
:
WebView
)
{
if
(
TextUtils
.
isEmpty
(
url
))
{
return
}
val
resultUrl
=
if
(
h5Params
?.
suffix
==
true
)
WebUrlParamsUtils
.
getSuffix
(
url
,
jtoJHandle
?.
getUriAppendSuffix
()
)
else
url
Log
.
e
(
TAG
,
resultUrl
)
web
.
loadUrl
(
resultUrl
)
}
/**
/**
* 专家详情页改版 需要url后面拼接状态栏高度 并且隐藏导航栏
* 专家详情页改版 需要url后面拼接状态栏高度 并且隐藏导航栏
...
@@ -118,14 +159,16 @@ class ChooseMusicActivity : BaseActivity() {
...
@@ -118,14 +159,16 @@ class ChooseMusicActivity : BaseActivity() {
* @param url
* @param url
* @return
* @return
*/
*/
private
fun
setUrlHeightParams
(
url
:
String
):
String
{
private
fun
setUrlHeightParams
(
url
:
String
?
):
String
{
var
resultUrl
:
String
?
=
url
var
resultUrl
:
String
?
=
url
try
{
try
{
val
uri
=
Uri
.
parse
(
url
)
val
uri
=
Uri
.
parse
(
url
)
val
host
=
uri
.
host
val
host
=
uri
.
host
if
(!
TextUtils
.
isEmpty
(
host
)
&&
host
.
contains
(
"nodeapi.ydl"
))
{
if
(!
TextUtils
.
isEmpty
(
host
)
&&
host
.
contains
(
"nodeapi.ydl"
))
{
//马亮的需求,在nodeapi.ydl.com 地址后面拼上公共参数,用于判断是否为app
//马亮的需求,在nodeapi.ydl.com 地址后面拼上公共参数,用于判断是否为app
val
uriAppendSuffix
:
String
=
""
//马亮的需求,在nodeapi.ydl.com 地址后面拼上公共参数,用于判断是否为app
val
uriAppendSuffix
=
jtoJHandle
?.
getUriAppendSuffix
()
resultUrl
=
WebUrlParamsUtils
.
getSuffix
(
url
,
uriAppendSuffix
)
resultUrl
=
WebUrlParamsUtils
.
getSuffix
(
url
,
uriAppendSuffix
)
}
}
}
catch
(
e
:
Exception
)
{
}
catch
(
e
:
Exception
)
{
...
...
m-muse/src/main/java/com/yidianling/muse/activity/PlayMeditationActivity.kt
View file @
11d2889f
...
@@ -12,6 +12,7 @@ import com.bumptech.glide.Glide
...
@@ -12,6 +12,7 @@ import com.bumptech.glide.Glide
import
com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import
com.bumptech.glide.load.resource.drawable.DrawableTransitionOptions
import
com.ydl.media.audio.AudioPlayer
import
com.ydl.media.audio.AudioPlayer
import
com.ydl.media.view.PlayerFloatHelper
import
com.ydl.media.view.PlayerFloatHelper
import
com.ydl.webview.H5Params
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.base.BaseActivity
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
import
com.ydl.ydlcommon.data.http.ThrowableConsumer
import
com.ydl.ydlcommon.event.MeditationEvent
import
com.ydl.ydlcommon.event.MeditationEvent
...
@@ -276,7 +277,7 @@ class PlayMeditationActivity : BaseActivity() {
...
@@ -276,7 +277,7 @@ class PlayMeditationActivity : BaseActivity() {
""
""
)
)
if
(!
mediaListLink
.
isNullOrBlank
())
{
if
(!
mediaListLink
.
isNullOrBlank
())
{
ChooseMusicActivity
.
launch
(
this
,
mediaListLink
!!
)
ChooseMusicActivity
.
launch
(
this
,
H5Params
(
mediaListLink
,
""
)
)
// val chooseMusicDialog = ChooseMusicDialog(this,H5Params(mediaListLink!!, null))
// val chooseMusicDialog = ChooseMusicDialog(this,H5Params(mediaListLink!!, null))
// chooseMusicDialog.show()
// chooseMusicDialog.show()
}
}
...
...
m-muse/src/main/java/com/yidianling/muse/dialog/JsInterface.kt
deleted
100644 → 0
View file @
c2c63634
package
com.yidianling.muse.dialog
import
android.webkit.JavascriptInterface
import
com.google.gson.GsonBuilder
import
com.ydl.webview.H5JsBean
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.muse.activity.ChooseMusicActivity
/**
* Created by Ykai on 2021/8/23.
* 个人主页js交互类
*/
class
JsInterface
(
webActivity
:
ChooseMusicActivity
)
{
private
var
mWebActivity
=
webActivity
private
val
gson
by
lazy
{
GsonBuilder
().
create
()
}
@JavascriptInterface
fun
sendDataToOC
(
params
:
String
)
{
LogUtil
.
i
(
"js"
,
params
)
val
jsData
=
gson
.
fromJson
(
params
,
H5JsBean
::
class
.
java
)
jumpAction
(
jsData
)
}
private
fun
jumpAction
(
jsData
:
H5JsBean
)
{
when
(
jsData
.
cmd
?.
action_name
)
{
"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
)
{
mWebActivity
.
switchSound
(
mediaId
,
meditationType
.
toLong
(),
businessType
!!
,
meditationId
,
buried
,
mediaUrl
,
mediaCoverUrl
,
title
,
desc
,
status
)
}
}
}
}
}
}
\ No newline at end of file
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
View file @
11d2889f
...
@@ -1065,12 +1065,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
...
@@ -1065,12 +1065,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
}
}
}
public
void
onEvent
(
ReloadUrlEvent
event
)
{
//刷新页面
loadUrl
(
event
.
getUrl
());
// shouldClearHistory = true;
}
public
void
onEvent
(
UserBindPhoneEvent
event
)
{
public
void
onEvent
(
UserBindPhoneEvent
event
)
{
//刷新页面
//刷新页面
loadUrl
(
h5Params
.
getUrl
());
loadUrl
(
h5Params
.
getUrl
());
...
...
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