Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
S
Sobot_module_Dev
Project
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
sobot_android
Sobot_module_Dev
Commits
59a569fb
Commit
59a569fb
authored
Jan 31, 2024
by
zhengnw@sobot.com
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
widget 1.1.6 SobotWebViewActivity 2
parent
e3a0554a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
27 deletions
+27
-27
SobotWebViewActivity.java
...ava/com/sobot/widget/ui/webview/SobotWebViewActivity.java
+27
-27
No files found.
sobot_widget/src/main/java/com/sobot/widget/ui/webview/SobotWebViewActivity.java
View file @
59a569fb
...
...
@@ -113,7 +113,6 @@ public class SobotWebViewActivity extends SobotBaseActivity implements View.OnCl
sobot_webview_goback
.
setEnabled
(
false
);
sobot_webview_forward
.
setEnabled
(
false
);
displayInNotch
(
mWebView
);
resetViewDisplay
();
boolean
isHideTitleBar
=
getIntent
().
getBooleanExtra
(
"isHideTitleBar"
,
false
);
boolean
isHideToolBar
=
getIntent
().
getBooleanExtra
(
"isHideToolBar"
,
false
);
if
(
isHideTitleBar
&&
getToolBar
()
!=
null
)
{
...
...
@@ -123,32 +122,7 @@ public class SobotWebViewActivity extends SobotBaseActivity implements View.OnCl
sobot_webview_toolsbar
.
setVisibility
(
View
.
GONE
);
}
initWebView
();
if
(
isUrlOrText
)
{
//加载url
mWebView
.
loadUrl
(
mUrl
);
sobot_webview_copy
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
//修改图片高度为自适应宽度
mUrl
=
"<!DOCTYPE html>\n"
+
"<html>\n"
+
" <head>\n"
+
" <meta charset=\"utf-8\">\n"
+
" <title></title>\n"
+
" <style>\n"
+
" img{\n"
+
" width: auto;\n"
+
" height:auto;\n"
+
" max-height: 100%;\n"
+
" max-width: 100%;\n"
+
" }\n"
+
" </style>\n"
+
" </head>\n"
+
" <body>"
+
mUrl
+
" </body>\n"
+
"</html>"
;
//显示文本内容
mWebView
.
loadDataWithBaseURL
(
"about:blank"
,
mUrl
.
replace
(
"</p>"
,
"<br/>"
).
replace
(
"<P>"
,
""
).
replace
(
"</P>"
,
"<br/>"
),
"text/html"
,
"utf-8"
,
null
);
}
SobotLogUtils
.
i
(
"webViewActivity---"
+
mUrl
);
resetViewDisplay
();
}
@Override
...
...
@@ -206,6 +180,32 @@ public class SobotWebViewActivity extends SobotBaseActivity implements View.OnCl
mWebView
.
setVisibility
(
View
.
VISIBLE
);
sobot_webview_toolsbar
.
setVisibility
(
View
.
VISIBLE
);
sobot_rl_net_error
.
setVisibility
(
View
.
GONE
);
if
(
isUrlOrText
)
{
//加载url
mWebView
.
loadUrl
(
mUrl
);
sobot_webview_copy
.
setVisibility
(
View
.
VISIBLE
);
}
else
{
//修改图片高度为自适应宽度
mUrl
=
"<!DOCTYPE html>\n"
+
"<html>\n"
+
" <head>\n"
+
" <meta charset=\"utf-8\">\n"
+
" <title></title>\n"
+
" <style>\n"
+
" img{\n"
+
" width: auto;\n"
+
" height:auto;\n"
+
" max-height: 100%;\n"
+
" max-width: 100%;\n"
+
" }\n"
+
" </style>\n"
+
" </head>\n"
+
" <body>"
+
mUrl
+
" </body>\n"
+
"</html>"
;
//显示文本内容
mWebView
.
loadDataWithBaseURL
(
"about:blank"
,
mUrl
.
replace
(
"</p>"
,
"<br/>"
).
replace
(
"<P>"
,
""
).
replace
(
"</P>"
,
"<br/>"
),
"text/html"
,
"utf-8"
,
null
);
}
SobotLogUtils
.
i
(
"webViewActivity---"
+
mUrl
);
}
else
{
mWebView
.
setVisibility
(
View
.
GONE
);
sobot_webview_toolsbar
.
setVisibility
(
View
.
GONE
);
...
...
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