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
e73d3985
Commit
e73d3985
authored
Sep 08, 2022
by
刘鹏
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat: 分享图片UI调整,webview代码整理
parent
d8f6c0ea
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
76 additions
and
138 deletions
+76
-138
build.gradle
build.gradle
+1
-1
platform_dialog_share.xml
ydl-platform/src/main/res/layout/platform_dialog_share.xml
+2
-3
ShareMeditationDialog.kt
ydl-webview/src/main/java/com/ydl/view/ShareMeditationDialog.kt
+1
-1
NewH5Activity.java
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
+72
-133
No files found.
build.gradle
View file @
e73d3985
...
...
@@ -14,7 +14,7 @@ buildscript {
ydlrouter_version
=
'1.2.3'
constrait_support_version
=
'1.0.2'
componentVersion
=
"0.3.0.49.
2
-SNAPSHOT"
componentVersion
=
"0.3.0.49.
3
-SNAPSHOT"
}
repositories
{
mavenCentral
()
...
...
ydl-platform/src/main/res/layout/platform_dialog_share.xml
View file @
e73d3985
...
...
@@ -13,9 +13,8 @@
android:layout_width=
"match_parent"
android:layout_height=
"wrap_content"
android:layout_above=
"@+id/ll_share"
android:layout_marginStart=
"68dp"
android:layout_marginEnd=
"68dp"
android:layout_marginBottom=
"-25dp"
android:layout_marginStart=
"42dp"
android:layout_marginEnd=
"42dp"
android:clickable=
"true"
android:visibility=
"gone"
app:cardCornerRadius=
"10dp"
...
...
ydl-webview/src/main/java/com/ydl/view/ShareMeditationDialog.kt
View file @
e73d3985
...
...
@@ -204,7 +204,7 @@ class ShareMeditationDialog : DialogFragment() {
fun
newInstance
(
isDarkMode
:
Boolean
,
shareUrl
:
String
,
shareTitle
:
String
,
shareContent
:
String
,
shareCover
:
String
,
miniId
:
String
,
miniPath
:
String
shareContent
:
String
,
shareCover
:
String
,
miniId
:
String
?,
miniPath
:
String
?
):
ShareMeditationDialog
{
val
args
=
Bundle
()
args
.
putBoolean
(
KEY_SHARE_DARK_MODE
,
isDarkMode
)
...
...
ydl-webview/src/main/java/com/ydl/webview/NewH5Activity.java
View file @
e73d3985
...
...
@@ -26,6 +26,8 @@ import android.widget.ImageView;
import
android.widget.LinearLayout
;
import
android.widget.PopupWindow
;
import
androidx.core.content.ContextCompat
;
import
com.alibaba.android.arouter.facade.annotation.Route
;
import
com.alibaba.android.arouter.launcher.ARouter
;
import
com.tencent.smtt.export.external.interfaces.JsResult
;
...
...
@@ -50,7 +52,7 @@ import com.ydl.ydlcommon.base.BaseApp;
import
com.ydl.ydlcommon.bean.ShareData
;
import
com.ydl.ydlcommon.bean.StatusBarOptions
;
import
com.ydl.ydlcommon.event.MeditationEvent
;
import
com.ydl.ydlcommon.modular.ModularServiceManager
;
import
com.ydl.ydlcommon.modular.ModularServiceManager
Kt
;
import
com.ydl.ydlcommon.ui.LogoLoadingView
;
import
com.ydl.ydlcommon.utils.ActivityManager
;
import
com.ydl.ydlcommon.utils.BuryPointUtils
;
...
...
@@ -100,13 +102,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
/*** 路由传递过来的参数*/
public
static
final
String
ROUTER_PARAMS
=
"routerParam"
;
/***下单选择时间请求吗*/
public
static
final
int
ORDER_TIME_REQUEST_CODE
=
110
;
/***启动类型 0正常模式 1从下至上打开页面*/
private
int
startType
=
0
;
/***右侧按钮文字*/
private
String
rightText
=
""
;
protected
TitleBar
tb_title
;
protected
View
tb_title_cover_v
;
...
...
@@ -122,14 +119,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
protected
String
shareTitle
;
protected
String
shareDesc
;
private
String
cover
;
private
String
miniId
;
private
String
miniPath
;
// 评价2.0新增字段 区分评价列表
// 评价2.0新增字段 区分评价列表
private
H5JsBean
.
H5JsCmd
.
Params
paramsForCommentList
;
private
boolean
isShareCommentList
;
private
boolean
isDarkMode
=
false
;
private
ShareMeditationDialog
shareMeditationDialog
;
private
ArticleDialogFragment
commentArticleDialog
;
...
...
@@ -154,7 +147,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
private
long
initDuration
=
0
;
/***加载url耗时*/
private
long
loadDuration
=
0
;
private
NetWorkSpeedUtils
workSpeedUtils
;
/***部分机型中webview加载完成回调方法会调用多次,增加本地标识符*/
private
boolean
hasLoad
=
false
;
/***是否跳转到动态*/
...
...
@@ -162,24 +154,22 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
private
LogoLoadingView
v_loading
;
/***是否超时*/
private
boolean
isTimeOut
=
false
;
/***超时处理handler*/
private
Handler
mTimeOutHandler
=
null
;
/***超时限定时间*/
private
int
timeOutLong
=
15000
;
private
final
int
TIME_OUT_LONG
=
15000
;
/***超时消息*/
private
int
TIME_OUT_TYPE
=
0x1000
;
private
final
int
TIME_OUT_TYPE
=
0x1000
;
/**
* 设置微信 H5 支付调用 loadDataWithBaseURL 的标记位,避免循环调用,
* 再次进入微信 H5 支付流程时记得重置此标记位状态
*/
boolean
firstVisitWXH5PayUrl
=
true
;
private
String
WX_H5_PAY_HOST
=
"http://testnewm.ydl.com"
;
/*** 当前页面类型*/
private
int
selfPageType
=
-
1
;
/***测评题页面*/
private
int
TEST_QUESTIONS_PAGE_TYPE
=
1000001
;
private
final
int
TEST_QUESTIONS_PAGE_TYPE
=
1000001
;
private
YDLCommonDialog
testQuestionsPageReturnDialog
=
null
;
/*** 标题栏是否被覆盖隐藏*/
...
...
@@ -189,7 +179,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
/**
* 设置当前h5页面类型
*
* @param pageType
* @param pageType
h5页面类型
*/
public
void
setSelfPageType
(
int
pageType
)
{
selfPageType
=
pageType
;
...
...
@@ -304,7 +294,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
private
void
initTimeOutHandler
()
{
mTimeOutHandler
=
new
Handler
(
msg
->
{
if
(
wv_content
.
getProgress
()
<
100
)
{
isTimeOut
=
true
;
llWebView
.
setVisibility
(
View
.
GONE
);
v_loading
.
setVisibility
(
View
.
VISIBLE
);
...
...
@@ -320,7 +309,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
*/
private
void
sendNetLossMessage
()
{
if
(
null
!=
mTimeOutHandler
)
{
mTimeOutHandler
.
sendEmptyMessageDelayed
(
TIME_OUT_TYPE
,
timeOutLong
);
mTimeOutHandler
.
sendEmptyMessageDelayed
(
TIME_OUT_TYPE
,
TIME_OUT_LONG
);
}
}
...
...
@@ -341,7 +330,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
@Override
public
void
onDataResetClick
()
{
sendNetLossMessage
();
isTimeOut
=
false
;
llWebView
.
setVisibility
(
View
.
VISIBLE
);
v_loading
.
setVisibility
(
View
.
VISIBLE
);
v_loading
.
setViewType
(
LogoLoadingView
.
TYPE_LOADING
,
null
);
...
...
@@ -388,12 +376,13 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tellData
=
new
TellData
();
}
initView
();
if
(!
BaseApp
.
instance
.
getGlobalConfig
().
getAppDebug
()
&&
ProxyCheckUtils
.
INSTANCE
.
isWifiProxy
(
this
))
{
if
(!
BaseApp
.
instance
.
getGlobalConfig
().
getAppDebug
()
&&
ProxyCheckUtils
.
INSTANCE
.
isWifiProxy
(
this
))
{
ToastUtil
.
toastShort
(
"网络设置错误"
);
return
;
}
startType
=
getIntent
().
getIntExtra
(
"startType"
,
0
);
rightText
=
getIntent
().
getStringExtra
(
"rightText"
);
//右侧按钮文字
String
rightText
=
getIntent
().
getStringExtra
(
"rightText"
);
if
(
h5Params
==
null
)
{
ToastUtil
.
toastShort
(
"参数错误"
);
AliYunRichLogsHelper
.
Companion
.
getInstance
().
sendRichLog
(
AliYunLogConfig
.
WEB
,
"参数错误 Params == null"
);
...
...
@@ -410,14 +399,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tb_title
.
setImageVis
(
0
);
tb_title
.
setLeftTextVisible
(
View
.
GONE
);
tb_title
.
setmRightText
(
rightText
);
tb_title
.
setOnRightTextClick
((
view
,
isActive
)
->
{
finish
();
});
tb_title
.
setOnRightTextClick
((
view
,
isActive
)
->
finish
());
}
else
if
(!
TextUtils
.
isEmpty
(
rightText
)
&&
webRightClickListener
!=
null
)
{
tb_title
.
setmRightText
(
rightText
);
tb_title
.
setOnRightTextClick
((
view
,
isActive
)
->
{
webRightClickListener
.
onCLick
(
view
);
});
tb_title
.
setOnRightTextClick
((
view
,
isActive
)
->
webRightClickListener
.
onCLick
(
view
));
}
llWebView
=
findViewById
(
R
.
id
.
ll_web_view
);
initLoadingView
();
...
...
@@ -436,7 +421,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
//再次替换 方哥那边解决不了域名的问题 app中强行匹配修改
if
(
url
.
contains
(
"fe-app-yidianling"
))
{
int
index
=
url
.
indexOf
(
"course/Detail"
);
String
newUrl
=
url
.
substring
(
index
,
url
.
length
()
);
String
newUrl
=
url
.
substring
(
index
);
if
(
url
.
contains
(
"test"
))
{
newUrl
=
"https://testnewm.ydl.com/"
+
newUrl
;
}
else
{
...
...
@@ -453,8 +438,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
/**
* 专家详情页改版 需要url后面拼接状态栏高度 并且隐藏导航栏
*
* @param url
* @return
* @param url
页面地址
* @return
拼接状态栏高度的url
*/
private
String
setUrlHeightParams
(
String
url
)
{
String
resultUrl
=
url
;
...
...
@@ -480,12 +465,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
showTitleBar
();
return
jumpUrl
;
}
String
useUrl
=
new
StringBuffer
().
append
(
jumpUrl
).
toString
(
);
String
Builder
useUrl
=
new
StringBuilder
(
jumpUrl
);
Resources
res
=
getResources
();
String
[]
doctorUrlArray
=
res
.
getStringArray
(
R
.
array
.
platform_doctorUrls
);
for
(
String
url
:
doctorUrlArray
)
{
if
(
useUrl
.
contains
(
url
))
{
String
lastUrl
=
useUrl
.
replaceAll
(
url
,
""
);
if
(
useUrl
.
toString
().
contains
(
url
))
{
String
lastUrl
=
useUrl
.
toString
().
replaceAll
(
url
,
""
);
if
(
lastUrl
.
contains
(
"?"
))
{
lastUrl
=
lastUrl
.
substring
(
0
,
lastUrl
.
indexOf
(
"?"
));
}
...
...
@@ -493,14 +478,14 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
//不报错就说明可以转成long,就说明是专家详情页地址
Long
.
parseLong
(
lastUrl
);
if
(!
lastUrl
.
contains
(
"/"
))
{
if
(
useUrl
.
endsWith
(
"?"
))
{
useUrl
=
useUrl
.
substring
(
0
,
useUrl
.
indexOf
(
"?"
));
if
(
useUrl
.
toString
().
endsWith
(
"?"
))
{
useUrl
=
new
StringBuilder
(
useUrl
.
substring
(
0
,
useUrl
.
indexOf
(
"?"
)
));
}
if
(!
useUrl
.
contains
(
"barHeight"
))
{
String
paramsStr
=
useUrl
.
contains
(
"?"
)
?
"&barHeight="
+
St
ring
.
valueOf
(
StatusBarUtils
.
Companion
.
getStatusBarHeight
(
NewH5Activity
.
this
)
)
:
"?barHeight="
+
St
ring
.
valueOf
(
StatusBarUtils
.
Companion
.
getStatusBarHeight
(
NewH5Activity
.
this
)
);
useUrl
=
new
StringBuffer
().
append
(
useUrl
).
append
(
paramsStr
).
toString
(
);
if
(!
useUrl
.
toString
().
contains
(
"barHeight"
))
{
String
paramsStr
=
useUrl
.
toString
().
contains
(
"?"
)
?
"&barHeight="
+
St
atusBarUtils
.
Companion
.
getStatusBarHeight
(
NewH5Activity
.
this
)
:
"?barHeight="
+
St
atusBarUtils
.
Companion
.
getStatusBarHeight
(
NewH5Activity
.
this
);
useUrl
.
append
(
paramsStr
);
}
hideJavaTitleBar
();
}
...
...
@@ -509,7 +494,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
}
}
return
useUrl
;
return
useUrl
.
toString
()
;
}
public
void
hasShowDownRefresh
(
boolean
isVisible
)
{
...
...
@@ -531,7 +516,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
cover
=
params
.
getShare
().
getCover
();
paramsForCommentList
=
params
;
LogUtil
.
d
(
"title: "
+
shareTitle
+
" url: "
+
shareUrl
+
" desc: "
+
shareDesc
+
" cover: "
+
cover
);
new
Handler
(
getMainLooper
()).
post
(
()
->
initShareMenu
()
);
new
Handler
(
getMainLooper
()).
post
(
this
::
initShareMenu
);
}
}
...
...
@@ -546,22 +531,22 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
public
void
openShareMenu
(
H5JsBean
.
H5JsCmd
.
Params
params
)
{
if
(
params
.
getShare
()
!=
null
)
{
if
(
"Meditation"
.
equals
(
params
.
getShare
().
getType
())){
if
(
"Meditation"
.
equals
(
params
.
getShare
().
getType
()))
{
shareUrl
=
params
.
getShare
().
getShare_url
();
shareTitle
=
params
.
getShare
().
getTitle
();
shareDesc
=
params
.
getShare
().
getDesc
();
cover
=
params
.
getShare
().
getCover
();
miniId
=
params
.
getShare
().
getMinProgramId
();
miniPath
=
params
.
getShare
().
getMinProgramPath
();
isDarkMode
=
params
.
getShare
().
isDarkMode
();
String
miniId
=
params
.
getShare
().
getMinProgramId
();
String
miniPath
=
params
.
getShare
().
getMinProgramPath
();
boolean
isDarkMode
=
params
.
getShare
().
isDarkMode
();
if
(
shareMeditationDialog
==
null
)
{
shareMeditationDialog
=
ShareMeditationDialog
.
Companion
.
newInstance
(
isDarkMode
,
shareUrl
,
shareTitle
,
shareDesc
,
cover
,
miniId
,
miniPath
);
}
if
(
shareMeditationDialog
!=
null
&&
!
shareMeditationDialog
.
isAdded
())
{
if
(!
shareMeditationDialog
.
isAdded
())
{
shareMeditationDialog
.
show
(
getSupportFragmentManager
(),
"share_meditation"
);
}
}
else
{
}
else
{
purl
=
params
.
getShare
().
getUrl
();
shareUrl
=
params
.
getShare
().
getShare_url
();
shareTitle
=
params
.
getShare
().
getTitle
();
...
...
@@ -576,13 +561,13 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
private
void
initView
()
{
tb_title
=
(
TitleBar
)
findViewById
(
R
.
id
.
tb_title
);
tb_title_cover_v
=
(
View
)
findViewById
(
R
.
id
.
tb_title_cover_v
);
tb_title
=
findViewById
(
R
.
id
.
tb_title
);
tb_title_cover_v
=
findViewById
(
R
.
id
.
tb_title_cover_v
);
tb_title
.
setPaddingLeft
(
10
);
wv_content
=
(
ProgressWebView
)
findViewById
(
R
.
id
.
wv_content
);
wv_content
=
findViewById
(
R
.
id
.
wv_content
);
backgroundView
=
findViewById
(
R
.
id
.
iv_background
);
store_house_ptr_frame
=
(
PtrFrameLayout
)
findViewById
(
R
.
id
.
store_house_ptr_frame
);
safeTipView
=
(
SafeTipView
)
findViewById
(
R
.
id
.
safe_tip_view
);
store_house_ptr_frame
=
findViewById
(
R
.
id
.
store_house_ptr_frame
);
safeTipView
=
findViewById
(
R
.
id
.
safe_tip_view
);
if
(
h5Params
!=
null
&&
h5Params
.
isControlBack
())
{
store_house_ptr_frame
.
setEnabled
(
false
);
...
...
@@ -596,9 +581,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
runOnUiThread
(()
->
{
tb_title
.
setVisibility
(
View
.
GONE
);
if
(
null
!=
getStatusView
())
{
if
(
selfPageType
==
TEST_QUESTIONS_PAGE_TYPE
)
{
//测评题隐藏标题的时候,不隐藏状态栏
}
else
{
if
(
selfPageType
!=
TEST_QUESTIONS_PAGE_TYPE
)
{
getStatusView
().
setVisibility
(
View
.
GONE
);
}
}
...
...
@@ -606,9 +590,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
public
void
setBottomViewColor
(
String
color
)
{
runOnUiThread
(()
->
{
setBottomColor
(
color
);
});
runOnUiThread
(()
->
setBottomColor
(
color
));
}
public
void
showTitleBar
()
{
...
...
@@ -623,16 +605,12 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
//js修改UI的操作需要放在UI线程中更新,覆盖标题
public
void
coverJavaTitleBar
()
{
isTitleBarCover
=
true
;
runOnUiThread
(()
->
{
tb_title_cover_v
.
setVisibility
(
VISIBLE
);
});
runOnUiThread
(()
->
tb_title_cover_v
.
setVisibility
(
VISIBLE
));
}
public
void
notCoverTitleBar
()
{
isTitleBarCover
=
false
;
runOnUiThread
(()
->
{
tb_title_cover_v
.
setVisibility
(
GONE
);
});
runOnUiThread
(()
->
tb_title_cover_v
.
setVisibility
(
GONE
));
}
public
void
closeWebKit
()
{
...
...
@@ -660,7 +638,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if
(!
TextUtils
.
isEmpty
(
h5Params
.
getTitle
())
&&
!
h5Params
.
getShowUrlTitle
())
{
tb_title
.
setTitle
(
h5Params
.
getTitle
());
}
tb_title
.
setImage
(
getResources
().
getDrawable
(
R
.
drawable
.
web_common_back
));
tb_title
.
setImage
(
ContextCompat
.
getDrawable
(
NewH5Activity
.
this
,
R
.
drawable
.
web_common_back
));
WebSettings
setting
=
wv_content
.
getSettings
();
//支持js
...
...
@@ -687,14 +665,13 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
tb_title
.
setImageListener
(
v
->
{
if
(
h5Params
.
isSplash
())
{
WebModularServiceUtils
.
Companion
.
startMain
(
NewH5Activity
.
this
);
finish
();
}
else
{
if
(
ActivityManager
.
Companion
.
getInstance
().
getActivitys
().
size
()
==
1
)
{
WebModularServiceUtils
.
Companion
.
startMain
(
NewH5Activity
.
this
);
}
finish
();
}
finish
();
});
if
(
startType
!=
1
)
{
tb_title
.
setImageVis
(
1
);
...
...
@@ -724,7 +701,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
@Override
public
void
onReceivedTitle
(
WebView
view
,
String
title
)
{
super
.
onReceivedTitle
(
view
,
title
);
if
(
TextUtils
.
isEmpty
(
h5Params
.
getTitle
())){
if
(
TextUtils
.
isEmpty
(
h5Params
.
getTitle
()))
{
tb_title
.
setTitle
(
title
);
}
wv_content
.
setTitle
(
title
);
...
...
@@ -739,26 +716,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
}
// For Android < 3.0
public
void
openFileChooser
(
ValueCallback
<
Uri
>
valueCallback
)
{
uploadMessage
=
valueCallback
;
openImageChooserActivity
();
}
// For Android >= 3.0
public
void
openFileChooser
(
ValueCallback
valueCallback
,
String
acceptType
)
{
uploadMessage
=
valueCallback
;
openImageChooserActivity
();
}
//For Android >= 4.1
@Override
public
void
openFileChooser
(
ValueCallback
<
Uri
>
valueCallback
,
String
acceptType
,
String
capture
)
{
uploadMessage
=
valueCallback
;
openImageChooserActivity
();
}
// For Android >= 5.0
@Override
public
boolean
onShowFileChooser
(
WebView
webView
,
ValueCallback
<
Uri
[]>
filePathCallback
,
WebChromeClient
.
FileChooserParams
fileChooserParams
)
{
uploadMessageAboveL
=
filePathCallback
;
...
...
@@ -781,7 +738,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if
(!
TextUtils
.
isEmpty
(
url
)
&&
url
.
endsWith
(
".apk"
))
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
));
startActivity
(
intent
);
}
else
if
(
url
.
startsWith
(
"tel://"
)){
}
else
if
(
url
.
startsWith
(
"tel://"
))
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
));
startActivity
(
intent
);
}
else
if
(!
TextUtils
.
isEmpty
(
url
)
&&
url
.
startsWith
(
"http"
))
{
...
...
@@ -806,7 +763,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
hasLoad
=
true
;
loadDuration
=
System
.
currentTimeMillis
()
-
loadStartTime
;
LogUtil
.
e
(
"initDuration:"
+
initDuration
+
",loadDuration:"
+
loadDuration
);
// UploadWebViewTimeUtils.Companion.uploadWebViewTime(h5Params.getUrl(), initDuration + "", loadDuration + "", workSpeedUtils.getNetSpeed());
}
if
(
shouldClearHistory
)
{
...
...
@@ -867,11 +823,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if
(!
TextUtils
.
isEmpty
(
url
)
&&
url
.
endsWith
(
".apk"
))
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
));
startActivity
(
intent
);
}
else
if
(
url
.
startsWith
(
"tel://"
))
{
}
else
if
(
url
.
startsWith
(
"tel://"
))
{
Intent
intent
=
new
Intent
(
Intent
.
ACTION_VIEW
,
Uri
.
parse
(
url
));
startActivity
(
intent
);
}
else
if
(!
TextUtils
.
isEmpty
(
url
)
&&
url
.
startsWith
(
"http"
))
{
}
else
if
(!
TextUtils
.
isEmpty
(
url
)
&&
url
.
startsWith
(
"http"
))
{
loadUrl
(
setUrlHeightParams
(
url
));
}
else
{
if
(!
YDLRouterManager
.
Companion
.
router
(
url
))
{
...
...
@@ -892,7 +847,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
hasLoad
=
true
;
loadDuration
=
System
.
currentTimeMillis
()
-
loadStartTime
;
LogUtil
.
e
(
"initDuration:"
+
initDuration
+
",loadDuration:"
+
loadDuration
);
//UploadWebViewTimeUtils.Companion.uploadWebViewTime(h5Params.getUrl(), initDuration + "", loadDuration + "", workSpeedUtils.getNetSpeed());
}
if
(
shouldClearHistory
)
{
...
...
@@ -909,27 +863,23 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
finish
();
}
});
if
(
startType
!=
1
)
{
tb_title
.
setImageVis
(
1
);
}
}
else
{
tb_title
.
setImage
(
getResources
().
getDrawable
(
R
.
drawable
.
web_common_back
));
tb_title
.
setImage
(
ContextCompat
.
getDrawable
(
NewH5Activity
.
this
,
R
.
drawable
.
web_common_back
));
tb_title
.
setmLeftText
(
""
);
tb_title
.
setImageListener
(
v
->
{
if
(
h5Params
.
getShowUrlTitle
())
{
WebModularServiceUtils
.
Companion
.
startMain
(
NewH5Activity
.
this
);
finish
();
}
else
{
if
(
ActivityManager
.
Companion
.
getInstance
().
getActivitys
().
size
()
==
1
)
{
WebModularServiceUtils
.
Companion
.
startMain
(
NewH5Activity
.
this
);
}
finish
();
}
finish
();
});
}
if
(
startType
!=
1
)
{
tb_title
.
setImageVis
(
1
);
}
}
if
(!
loadFailed
)
{
v_loading
.
setVisibility
(
View
.
GONE
);
...
...
@@ -975,7 +925,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
});
initDuration
=
System
.
currentTimeMillis
()
-
initStartTime
;
workSpeedUtils
=
new
NetWorkSpeedUtils
(
this
);
NetWorkSpeedUtils
workSpeedUtils
=
new
NetWorkSpeedUtils
(
this
);
workSpeedUtils
.
startNetSpeed
();
loadStartTime
=
System
.
currentTimeMillis
();
loadUrl
(
h5Params
.
getUrl
());
...
...
@@ -1005,11 +955,6 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
}
// 处理普通 http 请求跳转
// if (!(url.startsWith("http") || url.startsWith("https"))) {
// return true;
// }
// 处理微信 H5 支付跳转时验证请求头 referer 失效
// 验证不通过会出现“商家参数格式有误,请联系商家解决”
if
(
url
.
contains
(
"wx.tenpay.com"
))
{
...
...
@@ -1059,7 +1004,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
private
void
initShareMenu
()
{
tb_title
.
setRightIcon
(
getResources
().
getDrawable
(
R
.
drawable
.
web_common_share
));
tb_title
.
setRightIcon
(
ContextCompat
.
getDrawable
(
NewH5Activity
.
this
,
R
.
drawable
.
web_common_share
));
tb_title
.
setOnRightTextClick
((
view
,
isActive
)
->
{
ShareData
shareData
=
paramsForCommentList
.
getShare
();
if
(
shareData
!=
null
&&
"commentList"
.
equals
(
shareData
.
getType
()))
{
...
...
@@ -1161,7 +1106,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
private
void
initHead
()
{
// header
final
MaterialHeader
header
=
new
MaterialHeader
(
this
);
int
[]
colors
=
new
int
[]{
getResources
().
getColor
(
R
.
color
.
platform_main_theme
)};
int
[]
colors
=
new
int
[]{
ContextCompat
.
getColor
(
NewH5Activity
.
this
,
R
.
color
.
platform_main_theme
)};
header
.
setColorSchemeColors
(
colors
);
header
.
setLayoutParams
(
new
PtrFrameLayout
.
LayoutParams
(-
1
,
-
2
));
int
padding
=
(
int
)
getResources
().
getDimension
(
R
.
dimen
.
platform_default_dis_size
);
...
...
@@ -1207,11 +1152,8 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
else
{
wv_content
.
goBack
();
}
if
(
startType
!=
1
)
{
tb_title
.
setImageVis
(
1
);
}
}
else
{
tb_title
.
setImage
(
getResources
().
getDrawable
(
R
.
drawable
.
web_common_back
));
tb_title
.
setImage
(
ContextCompat
.
getDrawable
(
NewH5Activity
.
this
,
R
.
drawable
.
web_common_back
));
tb_title
.
setmLeftText
(
""
);
if
(
"top"
.
equals
(
type
))
{
setTitle
(
wv_content
.
getTitle
());
...
...
@@ -1227,7 +1169,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
}
});
}
else
{
if
(
h5Params
.
getUrl
()
!=
null
&&
h5Params
.
getUrl
().
contains
(
"user/payment/detail"
))
{
if
(
h5Params
.
getUrl
()
!=
null
&&
h5Params
.
getUrl
().
contains
(
"user/payment/detail"
))
{
//付款详情页 付款详情页_返回点击
ActionCountUtils
.
Companion
.
count
(
"consult_order_pay_details_page|return_click"
);
}
...
...
@@ -1241,10 +1183,10 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
finish
();
}
}
}
if
(
startType
!=
1
)
{
tb_title
.
setImageVis
(
1
);
}
}
}
...
...
@@ -1365,7 +1307,7 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
* 新用户侧滑按钮限制
*/
if
(
h5Params
.
getBackLimit
()
!=
null
&&
h5Params
.
getBackLimit
()
==
H5Params
.
BackLimit
.
NEW_USER_PAGE
)
{
ModularServiceManager
.
INSTANCE
.
provid
e
(
IAppService
.
class
).
mainIntent
(
this
);
ModularServiceManager
Kt
.
findRouteServic
e
(
IAppService
.
class
).
mainIntent
(
this
);
return
true
;
}
...
...
@@ -1426,9 +1368,9 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
if
(
h5Params
.
isShowMenu
())
{
try
{
if
(
WebModularServiceUtils
.
Companion
.
getImService
().
isHasUnread
())
{
tb_title
.
setImage_right
(
getResources
().
getDrawable
(
R
.
drawable
.
web_common_notice_more_en
));
tb_title
.
setImage_right
(
ContextCompat
.
getDrawable
(
NewH5Activity
.
this
,
R
.
drawable
.
web_common_notice_more_en
));
}
else
{
tb_title
.
setImage_right
(
getResources
().
getDrawable
(
R
.
drawable
.
web_common_notice_more_un
));
tb_title
.
setImage_right
(
ContextCompat
.
getDrawable
(
NewH5Activity
.
this
,
R
.
drawable
.
web_common_notice_more_un
));
}
}
catch
(
Exception
e
)
{
e
.
printStackTrace
();
...
...
@@ -1465,9 +1407,9 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
//如果未引入动态模块的话,隐藏分享至动态按钮
dialog
=
YDLShareDialog
.
Companion
.
style4
(
this
,
shareTitle
,
shareUrl
,
shareDesc
,
cover
);
}
else
{
if
(
isShareCommentList
){
if
(
isShareCommentList
)
{
dialog
=
YDLShareDialog
.
Companion
.
style7
(
this
,
shareTitle
,
shareUrl
,
shareDesc
,
cover
,
minPath
,
minId
);
}
else
{
}
else
{
dialog
=
YDLShareDialog
.
Companion
.
style1
(
this
,
shareTitle
,
shareUrl
,
shareDesc
,
cover
,
minPath
,
minId
);
}
}
...
...
@@ -1531,38 +1473,35 @@ public class NewH5Activity extends BaseActivity implements PtrHandler {
public
void
switchSound
(
int
mediaId
,
long
meditationId
,
int
meditationType
,
int
businessType
,
String
buried
,
String
mediaUrl
,
String
mediaCoverUrl
,
String
title
,
String
desc
,
int
status
)
{
String
title
,
String
desc
,
int
status
)
{
MeditationEvent
event
=
new
MeditationEvent
(
mediaId
,
meditationId
,
meditationType
,
businessType
,
status
,
buried
,
mediaUrl
,
mediaCoverUrl
,
title
,
desc
);
mediaId
,
meditationId
,
meditationType
,
businessType
,
status
,
buried
,
mediaUrl
,
mediaCoverUrl
,
title
,
desc
);
EventBus
.
getDefault
().
post
(
event
);
}
public
void
setBG
(
String
color
,
String
alpha
)
{
public
void
setBG
(
String
color
,
String
alpha
)
{
try
{
store_house_ptr_frame
.
setBackgroundColor
(
Color
.
parseColor
(
color
));
int
a
=
Integer
.
valueOf
(
alpha
);
store_house_ptr_frame
.
getBackground
().
setAlpha
(
a
);
}
catch
(
Exception
ex
)
{
}
catch
(
Exception
ex
)
{
}
}
public
void
showCommentArticleDialog
(
String
title
){
public
void
showCommentArticleDialog
(
String
title
)
{
if
(
commentArticleDialog
==
null
)
{
String
titleStr
=
title
==
null
?
wv_content
.
getTitle
():
title
;
String
titleStr
=
title
==
null
?
wv_content
.
getTitle
()
:
title
;
commentArticleDialog
=
ArticleDialogFragment
.
newInstance
(
titleStr
);
commentArticleDialog
.
setOnPublishListener
(
comment
->
{
callJSFunc
(
"sendComment('"
+
comment
+
"')"
);
callJSFunc
(
"sendComment('"
+
comment
+
"')"
);
});
}
if
(
commentArticleDialog
!=
null
&&
!
commentArticleDialog
.
isAdded
())
{
commentArticleDialog
.
show
(
getSupportFragmentManager
(),
"article_comment"
);
}
}
}
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