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
d3c043fe
Commit
d3c043fe
authored
Jun 08, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Plain Diff
Merge branch 'd/v_full_text' into 'd/v4.3.95'
富文本合并发布版本 See merge request app_android_lib/YDL-Component!141
parents
c7f17394
035144ff
Hide whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
265 additions
and
16 deletions
+265
-16
WVClickAbstractListener.java
app/src/main/java/com/ydl/component/service/web/WVClickAbstractListener.java
+8
-0
WebJavascriptHandler.kt
app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
+5
-0
WebViewClientClickListener.java
app/src/main/java/com/ydl/component/service/web/WebViewClientClickListener.java
+3
-0
build.gradle
m-im/build.gradle
+1
-0
CloseBottomWebviewEvent.kt
m-im/src/main/java/com/yidianling/im/event/CloseBottomWebviewEvent.kt
+4
-0
YDLMessageFragment.java
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
+7
-1
ServiceItemBean.java
m-im/src/main/java/com/yidianling/uikit/custom/http/response/ServiceItemBean.java
+8
-0
ExpertConsultServiceListDialog.kt
m-im/src/main/java/com/yidianling/uikit/custom/widget/expertConsultService/view/ExpertConsultServiceListDialog.kt
+20
-15
ExpertConsultServiceView.kt
m-im/src/main/java/com/yidianling/uikit/custom/widget/expertConsultService/view/ExpertConsultServiceView.kt
+1
-0
ExpertConsultWebview.kt
m-im/src/main/java/com/yidianling/uikit/custom/widget/expertConsultService/view/ExpertConsultWebview.kt
+194
-0
im_expert_consult_webview_view.xml
m-im/src/main/res/layout/im_expert_consult_webview_view.xml
+14
-0
No files found.
app/src/main/java/com/ydl/component/service/web/WVClickAbstractListener.java
View file @
d3c043fe
...
...
@@ -19,6 +19,9 @@ 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.event.CloseBottomWebviewEvent
;
import
de.greenrobot.event.EventBus
;
/**
* webview 点击事件监听 抽象类
...
...
@@ -494,6 +497,11 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
businessType
,
buried
,
mediaUrl
,
mediaCoverUrl
,
title
,
desc
,
status
);
}
}
@Override
public
void
chatCloseBottomWebView
()
{
EventBus
.
getDefault
().
post
(
new
CloseBottomWebviewEvent
(
true
));
}
@Override
public
void
reloadUrl
(
String
url
)
{
...
...
app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
View file @
d3c043fe
...
...
@@ -391,6 +391,11 @@ class WebJavascriptHandler : IJavascriptHandler{
wvEnventPro
?.
setSelfPageType
(
it
.
selfPageType
)
}
}
"chat_close_bottom_webview"
->
{
jsData
.
cmd
!!
.
params
?.
let
{
wvEnventPro
?.
chatCloseBottomWebView
()
}
}
"meditation_play"
->
{
...
...
app/src/main/java/com/ydl/component/service/web/WebViewClientClickListener.java
View file @
d3c043fe
...
...
@@ -182,6 +182,9 @@ public interface WebViewClientClickListener {
//设置当前页面类型
void
setSelfPageType
(
int
selfType
);
//关闭私聊窗口立即咨询webview
void
chatCloseBottomWebView
();
default
void
playMeditation
(
int
mediaId
,
long
meditationId
,
int
meditationType
,
String
mediaCoverUrl
){}
...
...
m-im/build.gradle
View file @
d3c043fe
...
...
@@ -90,6 +90,7 @@ dependencies {
implementation
'com.netease.nimlib:nrtc:9.1.1'
api
rootProject
.
ext
.
dependencies
[
"ydl-user-router"
]
implementation
rootProject
.
ext
.
dependencies
[
"BaseRecyclerViewAdapterHelper"
]
api
'com.tencent.tbs.tbssdk:sdk:43903'
if
(
rootProject
.
ext
.
dev_mode
){
//开发时使用
...
...
m-im/src/main/java/com/yidianling/im/event/CloseBottomWebviewEvent.kt
0 → 100644
View file @
d3c043fe
package
com.yidianling.im.event
data class
CloseBottomWebviewEvent
(
var
close
:
Boolean
)
\ No newline at end of file
m-im/src/main/java/com/yidianling/uikit/business/session/fragment/YDLMessageFragment.java
View file @
d3c043fe
...
...
@@ -71,6 +71,7 @@ import com.yidianling.common.tools.ToastUtil;
import
com.yidianling.im.R
;
import
com.yidianling.im.bean.RemoveHistory
;
import
com.yidianling.im.config.constants.ImConstants
;
import
com.yidianling.im.event.CloseBottomWebviewEvent
;
import
com.yidianling.im.event.MultipleAnswerBean
;
import
com.yidianling.im.event.MultipleSelectedEvent
;
import
com.yidianling.im.helper.IMChatUtil
;
...
...
@@ -916,7 +917,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
.
subscribe
(
res
->
{
if
(
res
.
data
!=
null
&&
res
.
data
.
size
()
>
0
)
{
if
(
getActivity
()
!=
null
&&
expertConsultServiceListDialog
==
null
)
{
expertConsultServiceListDialog
=
new
ExpertConsultServiceListDialog
(
getActivity
(),
res
.
data
,
isBusy
,
sessionId
);
expertConsultServiceListDialog
=
new
ExpertConsultServiceListDialog
(
getActivity
(),
res
.
data
,
isBusy
,
sessionId
,
ActionHandlerStorage
.
getL
(
sessionId
).
getInfo
().
doctorId
);
expertConsultServiceListDialog
.
show
();
}
}
else
{
...
...
@@ -1151,6 +1154,9 @@ public class YDLMessageFragment extends TFragment implements ModuleProxy {
answerMultipleQuestion
(
multipleAnswerBean
);
}
}
public
void
onEvent
(
CloseBottomWebviewEvent
event
){
expertConsultServiceListDialog
.
changeItem
();
}
private
void
updateLocalMsg
(
Integer
position
,
ArrayList
<
String
>
selectedPosition
)
{
IMMessage
message
=
ImIn
.
INSTANCE
.
getImMessage
();
//更新本地消息
...
...
m-im/src/main/java/com/yidianling/uikit/custom/http/response/ServiceItemBean.java
View file @
d3c043fe
...
...
@@ -47,10 +47,17 @@ public class ServiceItemBean {
*/
private
ProductDtoBean
productDto
;
private
int
catenewId
;
private
ProductCategoryDtoBean
productCategoryDto
;
private
int
isPushToBg
;
private
List
<
ProductSpecDtosBean
>
productSpecDtos
;
public
int
getcatenewId
()
{
return
catenewId
;
}
public
void
setcatenewId
(
int
cateId
)
{
this
.
catenewId
=
cateId
;
}
public
ProductDtoBean
getProductDto
()
{
return
productDto
;
}
...
...
@@ -83,6 +90,7 @@ public class ServiceItemBean {
this
.
productSpecDtos
=
productSpecDtos
;
}
public
static
class
ProductDtoBean
{
/**
* id : 91170418024616
...
...
m-im/src/main/java/com/yidianling/uikit/custom/widget/expertConsultService/view/ExpertConsultServiceListDialog.kt
View file @
d3c043fe
package
com.yidianling.uikit.custom.widget.expertConsultService.view
import
`in`.srain.cube.views.GridViewWithHeaderAndFooter
import
android.app.Dialog
import
android.content.Context
import
android.os.Bundle
...
...
@@ -17,7 +16,6 @@ import com.netease.nimlib.sdk.msg.constant.SessionTypeEnum
import
com.ydl.ydlcommon.utils.actionutil.ActionCountUtils
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.R
import
com.yidianling.im.session.extension.CustomAttachSubScriptTime
import
com.yidianling.uikit.business.session.helper.MessageListPanelHelper
...
...
@@ -32,13 +30,16 @@ import kotlinx.android.synthetic.main.im_expert_consult_service_list_dialog_layo
*
* @param mIsBusy 咨询师是否是繁忙状态
*/
class
ExpertConsultServiceListDialog
(
val
mContext
:
Context
,
val
mList
:
List
<
ServiceItemBean
>,
val
mIsBusy
:
Boolean
,
val
toUid
:
String
):
Dialog
(
mContext
,
R
.
style
.
dialog_default_style
)
{
class
ExpertConsultServiceListDialog
(
val
mContext
:
Context
,
val
mList
:
List
<
ServiceItemBean
>,
val
mIsBusy
:
Boolean
,
val
toUid
:
String
,
val
doctorID
:
String
):
Dialog
(
mContext
,
R
.
style
.
dialog_default_style
)
{
private
var
mConsultServiceListView
:
ExpertConsultServiceView
?
=
null
private
var
m
ConsultServiceDetailView
:
ExpertConsultServiceDetailV
iew
?
=
null
private
var
m
WebviewView
:
ExpertConsultWebv
iew
?
=
null
private
var
mViewList
:
ArrayList
<
View
>
=
ArrayList
()
private
var
mSelectType
:
String
=
"全部"
fun
changeItem
(){
dialog_bottom_scroll_view
.
currentItem
=
0
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
...
...
@@ -65,11 +66,13 @@ class ExpertConsultServiceListDialog(val mContext: Context, val mList: List<Serv
}
override
fun
onItemClick
(
serviceBean
:
ServiceItemBean
.
ProductsBean
)
{
if
(
mConsultServiceDetailView
!=
null
)
{
mConsultServiceDetailView
?.
updateData
(
serviceBean
)
dialog_bottom_scroll_view
.
currentItem
=
1
}
//
if (mConsultServiceDetailView != null) {
//
mConsultServiceDetailView?.updateData(serviceBean)
//
dialog_bottom_scroll_view.currentItem = 1
//
}
mWebviewView
?.
setData
(
serviceBean
)
dialog_bottom_scroll_view
.
currentItem
=
1
}
override
fun
addTime
()
{
// 提醒添加时间回调
...
...
@@ -99,13 +102,15 @@ class ExpertConsultServiceListDialog(val mContext: Context, val mList: List<Serv
mViewList
.
add
(
mConsultServiceListView
as
View
)
mConsultServiceDetailView
=
ExpertConsultServiceDetailView
(
mContext
,
object
:
ConsultServiceViewCallback
{
override
fun
onBackClick
()
{
dialog_bottom_scroll_view
.
currentItem
=
0
}
},
mIsBusy
,
toUid
)
//
mConsultServiceDetailView = ExpertConsultServiceDetailView(mContext, object : ConsultServiceViewCallback {
//
override fun onBackClick() {
//
dialog_bottom_scroll_view.currentItem = 0
//
}
//
},mIsBusy,toUid)
mViewList
.
add
(
mConsultServiceDetailView
as
View
)
// mViewList.add(mConsultServiceDetailView as View)
mWebviewView
=
ExpertConsultWebview
(
mContext
,
doctorID
=
doctorID
)
mViewList
.
add
(
mWebviewView
as
View
)
dialog_bottom_scroll_view
.
adapter
=
ConsultServicePagerAdapter
()
dialog_bottom_scroll_view
.
currentItem
=
0
...
...
m-im/src/main/java/com/yidianling/uikit/custom/widget/expertConsultService/view/ExpertConsultServiceView.kt
View file @
d3c043fe
...
...
@@ -121,6 +121,7 @@ class ExpertConsultServiceView : LinearLayout {
if
(
itemBean
.
cateName
==
mTypeList
[
typeSelectedIndex
]
||
typeSelectedIndex
==
0
)
{
itemBean
.
products
.
forEach
{
lastList
.
add
(
it
)
it
.
setcatenewId
(
itemBean
.
cateId
)
}
}
}
...
...
m-im/src/main/java/com/yidianling/uikit/custom/widget/expertConsultService/view/ExpertConsultWebview.kt
0 → 100644
View file @
d3c043fe
package
com.yidianling.uikit.custom.widget.expertConsultService.view
import
android.app.Activity
import
android.content.Context
import
android.content.Intent
import
android.net.Uri
import
android.os.Build
import
android.view.View
import
android.widget.RelativeLayout
import
com.tencent.smtt.export.external.interfaces.JsResult
import
com.tencent.smtt.sdk.*
import
com.ydl.utils.WebUrlParamsUtils
import
com.ydl.webview.ProgressWebView
import
com.ydl.webview.TellData
import
com.ydl.webview.WebModularServiceUtils
import
com.ydl.ydlcommon.base.config.HttpConfig
import
com.yidianling.common.tools.RxDeviceTool
import
com.yidianling.common.tools.ToastUtil
import
com.yidianling.im.R
import
com.yidianling.uikit.custom.http.response.ServiceItemBean
import
com.yidianling.uikit.custom.widget.expertConsultService.callback.ConsultServiceViewCallback
class
ExpertConsultWebview
:
RelativeLayout
{
private
var
doctorID
:
String
private
lateinit
var
productBean
:
ServiceItemBean
.
ProductsBean
private
var
cateID
:
Int
=
0
private
var
jumpUrl
=
""
private
lateinit
var
wv_content
:
ProgressWebView
constructor
(
context
:
Context
,
doctorID
:
String
)
:
super
(
context
)
{
mContext
=
context
this
.
doctorID
=
doctorID
initView
()
}
private
var
mContext
:
Context
?
=
null
private
fun
initView
()
{
val
mWidth
:
Int
=
RxDeviceTool
.
getScreenWidth
(
mContext
)
val
mHeight
:
Int
=
LayoutParams
.
MATCH_PARENT
val
params
=
LayoutParams
(
mWidth
,
mHeight
)
params
.
height
=
mHeight
layoutParams
=
params
var
view
=
View
.
inflate
(
mContext
,
R
.
layout
.
im_expert_consult_webview_view
,
this
)
wv_content
=
view
.
findViewById
<
ProgressWebView
>(
R
.
id
.
wv_content
)
webViewInit
(
wv_content
,
doctorID
)
}
fun
setData
(
productBean
:
ServiceItemBean
.
ProductsBean
)
{
this
.
productBean
=
productBean
// this.cateID=cateid
jumpUrl
=
HttpConfig
.
MH5_URL
+
"wb/product/chat/template?doctorId=${doctorID}&cateId=${productBean.getcatenewId()}&productId=${productBean.productDto.id}"
val
jtoJHandle
=
WebModularServiceUtils
.
getWebService
()
.
getJavascripHandler
(
mContext
as
Activity
,
tellData
=
TellData
())
val
url
=
WebUrlParamsUtils
.
getSuffix
(
jumpUrl
,
jtoJHandle
.
getUriAppendSuffix
())
wv_content
.
loadUrl
(
url
)
}
private
fun
shouldOverridePayUrl
(
view
:
WebView
,
url
:
String
):
Boolean
{
if
(
url
.
startsWith
(
"weixin://"
))
{
return
try
{
mContext
?.
startActivity
(
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
)))
true
}
catch
(
e
:
java
.
lang
.
Exception
)
{
// 防止手机没有安装处理某个 scheme 开头的 url 的 APP 导致 crash
ToastUtil
.
toastShort
(
"该手机没有安装微信"
)
true
}
}
else
if
(
url
.
startsWith
(
"alipays://"
)
||
url
.
startsWith
(
"alipay"
))
{
return
try
{
mContext
?.
startActivity
(
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
)))
true
}
catch
(
e
:
java
.
lang
.
Exception
)
{
// 防止手机没有安装处理某个 scheme 开头的 url 的 APP 导致 crash
// 启动支付宝 App 失败,会自行跳转支付宝网页支付
true
}
}
// 处理普通 http 请求跳转
// if (!(url.startsWith("http") || url.startsWith("https"))) {
// return true;
// }
// 处理微信 H5 支付跳转时验证请求头 referer 失效
// 验证不通过会出现“商家参数格式有误,请联系商家解决”
if
(
url
.
contains
(
"wx.tenpay.com"
))
{
// 申请微信 H5 支付时填写的域名
// 比如经常用来测试网络连通性的 http://www.baidu.com
val
parse
=
Uri
.
parse
(
url
)
//从url 中获取 域名信息
val
redirectUrlStr
=
parse
.
getQueryParameter
(
"redirect_url"
)
val
redirectUrl
=
Uri
.
parse
(
redirectUrlStr
)
// 申请微信 H5 支付时填写的域名
val
referer
=
redirectUrl
.
scheme
+
"://"
+
redirectUrl
.
host
// 兼容 Android 4.4.3 和 4.4.4 两个系统版本设置 referer 无效的问题
return
if
(
"4.4.3"
==
Build
.
VERSION
.
RELEASE
||
"4.4.4"
==
Build
.
VERSION
.
RELEASE
)
{
// 返回 false 由系统 WebView 自己处理该 url
false
}
else
{
// HashMap 指定容量初始化,避免不必要的内存消耗
val
map
=
HashMap
<
String
,
String
>(
1
)
map
[
"Referer"
]
=
referer
view
.
loadUrl
(
url
,
map
)
true
}
}
else
if
(
url
.
contains
(
"alipay"
))
{
return
false
}
return
false
}
fun
webViewInit
(
wv_content
:
ProgressWebView
,
doctorID
:
String
)
{
val
setting
:
WebSettings
=
wv_content
?.
settings
!!
//支持js
//支持js
setting
.
setJavaScriptEnabled
(
true
)
//设置字符编码
//设置字符编码
setting
.
setDefaultTextEncodingName
(
"GBK"
)
setting
.
setDomStorageEnabled
(
true
)
val
appCachePath
:
String
=
mContext
?.
getCacheDir
()
?.
getAbsolutePath
().
toString
()
setting
.
setAppCachePath
(
appCachePath
)
setting
.
setAllowFileAccessFromFileURLs
(
true
)
setting
.
setAppCacheEnabled
(
true
)
setting
.
setAllowFileAccess
(
true
)
setting
.
setBlockNetworkImage
(
false
)
wv_content
!!
.
scrollBarStyle
=
View
.
SCROLLBARS_INSIDE_OVERLAY
//滚动条风格,为0指滚动条不占用空间,直接覆盖在网页上
val
jtoJHandle
=
WebModularServiceUtils
.
getWebService
()
.
getJavascripHandler
(
mContext
as
Activity
,
tellData
=
TellData
())
wv_content
!!
.
addJavascriptInterface
(
jtoJHandle
,
"javascriptHandler"
)
val
url
=
WebUrlParamsUtils
.
getSuffix
(
jumpUrl
,
jtoJHandle
.
getUriAppendSuffix
())
wv_content
.
loadUrl
(
url
)
wv_content
.
webViewClient
=
object
:
WebViewClient
()
{
override
fun
shouldOverrideUrlLoading
(
webview
:
WebView
,
url
:
String
?):
Boolean
{
if
(
url
.
isNullOrBlank
())
return
false
return
shouldOverridePayUrl
(
webview
,
url
)
}
}
wv_content
.
webChromeClient
=
object
:
WebChromeClient
()
{
override
fun
onJsAlert
(
webView
:
WebView
,
s
:
String
,
s1
:
String
,
jsResult
:
JsResult
):
Boolean
{
return
super
.
onJsAlert
(
webView
,
s
,
s1
,
jsResult
)
}
override
fun
onProgressChanged
(
view
:
WebView
,
newProgress
:
Int
)
{
super
.
onProgressChanged
(
view
,
newProgress
)
}
override
fun
onReceivedTitle
(
view
:
WebView
,
title
:
String
)
{
super
.
onReceivedTitle
(
view
,
title
)
}
// For Android < 3.0
fun
openFileChooser
(
valueCallback
:
ValueCallback
<
Uri
?>)
{
}
// For Android >= 3.0
fun
openFileChooser
(
valueCallback
:
ValueCallback
<*>,
acceptType
:
String
?)
{
}
//For Android >= 4.1
override
fun
openFileChooser
(
valueCallback
:
ValueCallback
<
Uri
>,
acceptType
:
String
,
capture
:
String
)
{
}
// For Android >= 5.0
override
fun
onShowFileChooser
(
webView
:
WebView
,
filePathCallback
:
ValueCallback
<
Array
<
Uri
>>,
fileChooserParams
:
FileChooserParams
):
Boolean
{
return
true
}
}
}
}
\ No newline at end of file
m-im/src/main/res/layout/im_expert_consult_webview_view.xml
0 → 100644
View file @
d3c043fe
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android=
"http://schemas.android.com/apk/res/android"
xmlns:tools=
"http://schemas.android.com/tools"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
tools:ignore=
"MissingDefaultResource"
>
<com.ydl.webview.ProgressWebView
android:id=
"@+id/wv_content"
android:layout_width=
"match_parent"
android:layout_height=
"match_parent"
/>
</RelativeLayout>
\ No newline at end of file
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