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
d916dc95
Commit
d916dc95
authored
May 24, 2022
by
霍志良
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat:再换一位JS参数修改
parent
b6b0ab62
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
120 additions
and
25 deletions
+120
-25
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
+4
-0
WebViewClientClickListener.java
app/src/main/java/com/ydl/component/service/web/WebViewClientClickListener.java
+1
-1
ConfideBottomSheetDialogFragment.kt
m-confide/src/main/java/com/ydl/confide/home/ConfideBottomSheetDialogFragment.kt
+78
-19
ConfideHomeActivity.kt
m-confide/src/main/java/com/ydl/confide/home/ConfideHomeActivity.kt
+20
-4
ChangeAnotherExpertEvent.kt
m-confide/src/main/java/com/ydl/confide/home/event/ChangeAnotherExpertEvent.kt
+7
-0
confide_webview.xml
m-confide/src/main/res/layout/confide_webview.xml
+1
-1
styles.xml
m-confide/src/main/res/values/styles.xml
+1
-0
No files found.
app/src/main/java/com/ydl/component/service/web/WVClickAbstractListener.java
View file @
d916dc95
...
...
@@ -5,6 +5,7 @@ import android.app.Activity;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.ydl.confide.api.IConfideService
;
import
com.ydl.confide.home.event.ChangeAnotherExpertEvent
;
import
com.ydl.webview.H5JsBean
;
import
com.ydl.webview.H5Params
;
import
com.ydl.webview.NewH5Activity
;
...
...
@@ -12,6 +13,8 @@ import com.ydl.ydlcommon.modular.ModularServiceManager;
import
com.yidianling.common.tools.LogUtil
;
import
com.yidianling.im.api.service.IImService
;
import
de.greenrobot.event.EventBus
;
/**
* webview 点击事件监听 抽象类
* Created by harvie on 2017/7/4 0004.
...
...
@@ -446,5 +449,10 @@ public class WVClickAbstractListener implements WebViewClientClickListener {
}
}
@Override
public
void
getNextExpertStatus
(
String
doctorID
,
String
title
)
{
EventBus
.
getDefault
().
post
(
new
ChangeAnotherExpertEvent
(
doctorID
,
title
));
}
}
app/src/main/java/com/ydl/component/service/web/WebJavascriptHandler.kt
View file @
d916dc95
...
...
@@ -381,6 +381,10 @@ class WebJavascriptHandler : IJavascriptHandler{
wvEnventPro
?.
setSelfPageType
(
it
.
selfPageType
)
}
}
//再换一位
"get_next_doctor"
->{
wvEnventPro
?.
getNextExpertStatus
(
jsData
.
cmd
?.
params
?.
doctorId
.
toString
(),
jsData
.
cmd
?.
params
?.
title
)
}
}
}
}
app/src/main/java/com/ydl/component/service/web/WebViewClientClickListener.java
View file @
d916dc95
...
...
@@ -181,5 +181,5 @@ public interface WebViewClientClickListener {
//设置当前页面类型
void
setSelfPageType
(
int
selfType
);
void
getNextExpertStatus
(
String
doctorID
,
String
title
);
}
m-confide/src/main/java/com/ydl/confide/home/ConfideBottomSheetDialogFragment.kt
View file @
d916dc95
package
com.ydl.confide.home
import
android.annotation.SuppressLint
import
android.app.Activity
import
android.app.Dialog
import
android.net.Uri
import
android.os.Bundle
import
android.text.TextUtils
import
android.view.*
import
android.widget.FrameLayout
import
android.widget.TextView
import
androidx.fragment.app.FragmentActivity
import
com.blankj.utilcode.util.LogUtils
import
com.google.android.material.bottomsheet.BottomSheetBehavior
import
com.google.android.material.bottomsheet.BottomSheetDialog
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
import
com.tencent.smtt.export.external.interfaces.JsResult
import
com.tencent.smtt.sdk.ValueCallback
import
com.tencent.smtt.sdk.WebChromeClient
import
com.tencent.smtt.sdk.WebSettings
import
com.tencent.smtt.sdk.WebView
import
com.ydl.confide.R
import
com.ydl.confide.home.http.ConfideHomeApi
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.BaseActivity
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.utils.TimeUtil
import
com.ydl.ydlcommon.utils.log.AliYunLogConfig
import
com.ydl.ydlcommon.utils.log.AliYunRichLogsHelper.Companion.getInstance
import
com.ydl.ydlnet.YDLHttpUtils
import
com.yidianling.common.tools.LogUtil
import
com.yidianling.common.tools.RxImageTool
...
...
@@ -39,7 +44,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
lateinit
var
wv_content
:
ProgressWebView
lateinit
var
text_title
:
View
lateinit
var
text_title
:
Text
View
lateinit
var
line
:
View
lateinit
var
rl_title
:
View
lateinit
var
close_webview_Icon
:
View
...
...
@@ -48,6 +53,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
lateinit
var
tvCall
:
TextView
lateinit
var
tvTime
:
TextView
lateinit
var
first_order
:
View
lateinit
var
confideProgress
:
View
lateinit
var
layout_change_text
:
View
lateinit
var
jumpUrl
:
String
...
...
@@ -86,14 +93,11 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
jumpUrl
=
arguments
?.
getString
(
KEY_JUMP_URL
)
?:
""
doctorId
=
arguments
?.
getString
(
KEY_DOCTOR_ID
)
?:
""
shouldShow
=
arguments
?.
getBoolean
(
KEY_SHOULD_SHOW
)
?:
false
onLoadDialStatus
()
if
(
jumpUrl
.
isBlank
())
{
dismiss
()
return
}
onLoadDialStatus
(
doctorId
)
// +
wv_content
=
view
.
findViewById
<
ProgressWebView
>(
com
.
ydl
.
webview
.
R
.
id
.
wv_content
)
close_webview_Icon
=
view
.
findViewById
<
View
>(
R
.
id
.
close_webview_Icon
)
text_title
=
view
.
findViewById
<
View
>(
R
.
id
.
text_title
)
text_title
=
view
.
findViewById
<
Text
View
>(
R
.
id
.
text_title
)
line
=
view
.
findViewById
<
View
>(
R
.
id
.
line
)
rl_title
=
view
.
findViewById
<
View
>(
R
.
id
.
rl_title
)
...
...
@@ -134,13 +138,13 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
LayoutInflater
.
from
(
context
).
inflate
(
R
.
layout
.
confide_bottom_two
,
null
,
false
)
layoutCall
=
itemView
.
findViewById
<
View
>(
R
.
id
.
layoutCall
)
layoutChange
=
itemView
.
findViewById
<
View
>(
R
.
id
.
layoutChange
)
confideProgress
=
itemView
.
findViewById
<
View
>(
R
.
id
.
confide_progress
)
layout_change_text
=
itemView
.
findViewById
<
View
>(
R
.
id
.
layout_change_text
)
tvCall
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tvCall
)
tvTime
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
tvTime
)
first_order
=
itemView
.
findViewById
<
TextView
>(
R
.
id
.
first_order
)
val
isLogin
=
findRouteService
(
IUserService
::
class
.
java
)
?.
isLogin
()
?:
false
first_order
.
visibility
=
if
(
isLogin
)
View
.
GONE
else
View
.
VISIBLE
val
layout_change_text
=
itemView
.
findViewById
<
View
>(
R
.
id
.
layout_change_text
)
val
confide_progress
=
itemView
.
findViewById
<
View
>(
R
.
id
.
confide_progress
)
first_order
.
visibility
=
if
(
isLogin
)
View
.
GONE
else
View
.
VISIBLE
if
(
shouldShow
==
true
)
{
layoutChange
.
visibility
=
View
.
VISIBLE
}
else
{
...
...
@@ -151,7 +155,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
layoutChange
.
setOnClickListener
{
layout_change_text
.
visibility
=
View
.
GONE
confide
_p
rogress
.
visibility
=
View
.
VISIBLE
confide
P
rogress
.
visibility
=
View
.
VISIBLE
callJsFun
(
wv_content
,
"handleNext()"
)
}
val
layoutParams
=
FrameLayout
.
LayoutParams
(
...
...
@@ -204,7 +208,12 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
}
}
fun
updateChange
(
doctorId
:
String
,
title
:
String
){
text_title
.
text
=
title
confideProgress
.
visibility
=
View
.
GONE
layout_change_text
.
visibility
=
View
.
VISIBLE
onLoadDialStatus
(
doctorId
)
}
@SuppressLint
(
"ClickableViewAccessibility"
)
private
fun
webViewInit
(
wv_content
:
ProgressWebView
)
{
val
setting
:
WebSettings
=
wv_content
?.
settings
!!
...
...
@@ -242,10 +251,62 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
}
false
;
}
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
)
{
if
(
newProgress
==
100
)
{
wv_content
.
progressbar
.
visibility
=
View
.
GONE
}
else
{
if
(
wv_content
.
progressbar
.
visibility
==
View
.
GONE
)
{
wv_content
.
progressbar
.
visibility
=
View
.
VISIBLE
}
wv_content
.
progressbar
.
progress
=
newProgress
}
super
.
onProgressChanged
(
view
,
newProgress
)
}
override
fun
onReceivedTitle
(
view
:
WebView
,
title
:
String
)
{
super
.
onReceivedTitle
(
view
,
title
)
text_title
.
text
=
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
}
}
}
@SuppressLint
(
"CheckResult"
)
private
fun
onLoadDialStatus
()
{
private
fun
onLoadDialStatus
(
doctorId
:
String
)
{
val
confideApi
=
YDLHttpUtils
.
obtainApi
(
ConfideHomeApi
::
class
.
java
)
confideApi
.
getDialStatus
(
doctorId
)
.
subscribeOn
(
Schedulers
.
io
())
...
...
@@ -254,11 +315,8 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
if
(
resp
.
code
==
"200"
)
{
layoutCall
.
visibility
=
View
.
VISIBLE
val
lineStatus
=
resp
.
data
?.
confideLine
?:
2
/*
* 1在线 2离线 3通话中 4 继续倾诉
*
*
* */
when
(
lineStatus
)
{
1
->
{
...
...
@@ -280,6 +338,7 @@ class ConfideBottomSheetDialogFragment : BottomSheetDialogFragment() {
tvCall
.
text
=
"继续倾诉"
layoutCall
.
background
=
context
?.
getDrawable
(
R
.
drawable
.
confide_line_bg_1
)
context
?.
getDrawable
(
R
.
drawable
.
confide_line_bg_1
)
val
t
=
resp
?.
data
?.
remainingTime
?.
remainingTime
if
(
t
!=
null
)
{
tvTime
.
visibility
=
View
.
VISIBLE
...
...
m-confide/src/main/java/com/ydl/confide/home/ConfideHomeActivity.kt
View file @
d916dc95
...
...
@@ -4,6 +4,7 @@ import android.annotation.SuppressLint
import
android.content.Context
import
android.graphics.Color
import
android.os.Build
import
android.os.Bundle
import
android.view.View
import
android.view.WindowManager
import
androidx.fragment.app.FragmentActivity
...
...
@@ -13,6 +14,7 @@ import com.alibaba.android.arouter.facade.annotation.Route
import
com.alibaba.android.arouter.launcher.ARouter
import
com.bumptech.glide.Glide
import
com.bumptech.glide.load.engine.DiskCacheStrategy
import
com.google.android.material.bottomsheet.BottomSheetDialogFragment
import
com.jcodecraeer.xrecyclerview.ProgressStyle
import
com.jcodecraeer.xrecyclerview.XRecyclerView
import
com.ydl.confide.R
...
...
@@ -23,6 +25,7 @@ import com.ydl.confide.home.bean.ConfideHomeDataBean
import
com.ydl.confide.home.bean.ConfideHomeFiterItemBean
import
com.ydl.confide.home.config.IConfideHomeConfig
import
com.ydl.confide.home.contract.IConfideHomeContract
import
com.ydl.confide.home.event.ChangeAnotherExpertEvent
import
com.ydl.confide.home.event.ConfideHomeEventImpl
import
com.ydl.confide.home.event.IConfideHomeEvent
import
com.ydl.confide.home.listener.ConfideHomeRecycleViewListener
...
...
@@ -31,6 +34,7 @@ import com.ydl.confide.home.presenter.ConfideHomePresenterImpl
import
com.ydl.confide.home.util.ConfideHomeUtils
import
com.ydl.confide.home.widget.FilterItemDecoration
import
com.ydl.confide.router.PhoneCallIn
import
com.ydl.consultantim.event.AudioHomeEvent
import
com.ydl.webview.H5Params
import
com.ydl.webview.NewH5Activity
import
com.ydl.ydl_image.listener.YDLImageRecyclerOnScrollListener
...
...
@@ -39,11 +43,13 @@ import com.ydl.ydlcommon.base.config.HttpConfig.Companion.YDL_H5
import
com.ydl.ydlcommon.modular.findRouteService
import
com.ydl.ydlcommon.mvp.lce.BaseLceActivity
import
com.ydl.ydlcommon.utils.BuryPointUtils
import
com.ydl.ydlcommon.utils.LogUtil
import
com.ydl.ydlcommon.utils.remind.ToastHelper
import
com.ydl.ydlcommon.view.DrawableRightTextView
import
com.ydl.ydlcommon.view.WrapContentLinearLayoutManager
import
com.yidianling.common.tools.RxImageTool
import
com.yidianling.im.api.service.IImService
import
de.greenrobot.event.EventBus
import
kotlinx.android.synthetic.main.confide_home_activity.*
import
kotlinx.android.synthetic.main.confide_title_bar.*
...
...
@@ -102,7 +108,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
//是否有下一页(用于判断为你推荐条数,如果首页返回少于10条 那么就可以认为没有下一页了) 默认有下一页
private
var
hasMore
=
true
private
var
dp48
=
0
private
lateinit
var
bottomSheetDialogFragment
:
ConfideBottomSheetDialogFragment
init
{
//初始化参数
initParam
()
...
...
@@ -149,6 +155,11 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
recommendList
(
page
+
1
)
}
override
fun
onCreate
(
savedInstanceState
:
Bundle
?)
{
super
.
onCreate
(
savedInstanceState
)
EventBus
.
getDefault
().
register
(
this
)
}
override
fun
recommendList
(
page
:
Int
)
{
//需要将当前列表已存在的老师uid数组发送到后端去重,因为排序实时变化
this
.
page
=
page
...
...
@@ -252,11 +263,15 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
*/
private
fun
initClick
()
{
quick_consult_card
.
setOnClickListener
{
ConfideBottomSheetDialogFragment
()
.
showBottomSheetDialog
(
this
as
FragmentActivity
,
""
,
""
,
true
)
bottomSheetDialogFragment
=
ConfideBottomSheetDialogFragment
()
bottomSheetDialogFragment
.
showBottomSheetDialog
(
this
as
FragmentActivity
,
""
,
""
,
true
)
}
}
fun
onEventMainThread
(
event
:
ChangeAnotherExpertEvent
)
{
bottomSheetDialogFragment
.
updateChange
(
event
.
doctorID
,
event
.
title
)
}
private
fun
initView
()
{
img_back
.
setOnClickListener
{
finish
()
...
...
@@ -523,6 +538,7 @@ class ConfideHomeActivity : BaseLceActivity<IConfideHomeContract.View,IConfideHo
override
fun
onDestroy
()
{
super
.
onDestroy
()
mConfideEvent
!!
.
destoryPlayer
()
EventBus
.
getDefault
().
unregister
(
this
)
}
override
fun
onBackPressed
()
{
...
...
m-confide/src/main/java/com/ydl/confide/home/event/ChangeAnotherExpertEvent.kt
0 → 100644
View file @
d916dc95
package
com.ydl.confide.home.event
data class
ChangeAnotherExpertEvent
(
var
doctorID
:
String
,
var
title
:
String
)
\ No newline at end of file
m-confide/src/main/res/layout/confide_webview.xml
View file @
d916dc95
...
...
@@ -27,7 +27,7 @@
<TextView
android:layout_width=
"wrap_content"
android:layout_height=
"wrap_content"
android:text=
"
我是标题
"
android:text=
""
android:layout_centerInParent=
"true"
android:id=
"@+id/text_title"
android:visibility=
"gone"
...
...
m-confide/src/main/res/values/styles.xml
View file @
d916dc95
...
...
@@ -24,6 +24,7 @@
<style
name=
"AppBottomSheet"
parent=
"Theme.Design.Light.BottomSheetDialog"
>
<item
name=
"bottomSheetStyle"
>
@style/AppBottomSheetStyle
</item>
</style>
<style
name=
"AppBottomSheetStyle"
parent=
"Widget.Design.BottomSheet.Modal"
>
<item
name=
"android:background"
>
@drawable/confide_bottom_webview
</item>
</style>
...
...
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