Commit 59a569fb by zhengnw@sobot.com

widget 1.1.6 SobotWebViewActivity 2

parent e3a0554a
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment