Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @Override
- public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
- // prepare webview
- rootView = inflater.inflate(R.layout.my_view, container, false);
- webView = (WebView) rootView.findViewById(R.id.webview);
- webView.getSettings().setJavaScriptEnabled(true);
- HtmlProvider provider = new HtmlProvider();
- provider.readWebpage( this);
- webView.setBackgroundColor( userSettings.chapterPageBgColor);
- webView.setWebViewClient( new WebViewClient() {
- @Override
- public boolean shouldOverrideUrlLoading( WebView view, String url) {
- // ** never coming here **
- webView.loadUrl( htmlBase + url);
- return true;
- }
- @Override
- public void onPageFinished(WebView view, String url) {
- super.onPageFinished(view, url);
- }
- });
- return rootView;
- }
- // When the webpage is received via an asynchonous call, this method is called.
- private void formatHtmlContent(String content) {
- String htmlBegin = "<!DOCTYPE html><head><style>body { font-size: 120%; } </style><meta charset="utf-8" /> " +
- " <meta http-equiv="X-UA-Compatible" content="IE=edge"> " +
- " <meta name="viewport" content="width=device-width, initial-scale=1.0"></head><body text="#acolor">";
- String htmlEnd = "</body></html>";
- webView.loadDataWithBaseURL(null, htmlBegin + content + htmlEnd, "text/html", "UTF-8", null);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement