List of usage examples for android.webkit WebSettings setDefaultTextEncodingName
public abstract void setDefaultTextEncodingName(String encoding);
From source file:io.github.importre.android.chromeadb.OssLicenseFragment.java
private void setContents(View rootView) { String str;/*from w w w. j ava 2 s.com*/ StringBuilder buf = new StringBuilder("<pre>"); try { InputStream is = getActivity().getAssets().open("LICENSE-2.0.txt"); BufferedReader in = new BufferedReader(new InputStreamReader(is)); while ((str = in.readLine()) != null) { buf.append(str + "<br />"); } in.close(); } catch (IOException e) { return; } WebView webView = (WebView) rootView.findViewById(R.id.webview); buf.append("</pre>"); String encoding = "utf-8"; WebSettings settings = webView.getSettings(); settings.setDefaultTextEncodingName(encoding); webView.loadDataWithBaseURL(null, buf.toString(), "text/html", encoding, null); }
From source file:com.money.manager.ex.about.AboutCreditsFragment.java
@Override public void onActivityCreated(Bundle savedInstanceState) { super.onActivityCreated(savedInstanceState); WebView webView = (WebView) getActivity().findViewById(R.id.about_thirdsparty_credits); // webView.loadData(MmxFileUtils.getRawAsString(getActivity(), R.raw.credits_thirdparty), "text/html", "UTF-8"); // Display Unicode characters. WebSettings settings = webView.getSettings(); settings.setDefaultTextEncodingName("utf-8"); webView.loadData(//from w w w . j a v a 2 s . c o m MmxFileUtils.getRawAsString(getActivity().getApplicationContext(), R.raw.credits_thirdparty), "text/html; charset=utf-8", null); }
From source file:com.yang.bruce.mumuxi.util.WebDialog.java
private void setWebView(WebView webView, Context context) { WebSettings settings = webView.getSettings(); settings.setDefaultTextEncodingName(KEY_UTF_8); settings.setJavaScriptEnabled(true); webView.addJavascriptInterface(new WebAppInterface(context), "Android"); }
From source file:prince.app.ccm.Fragment_Turnos.java
private void setUp(View view) { // Retrieve the SwipeRefreshLayout and GridView instances mSwipeRefreshLayout = (MultiSwipeRefreshLayout) view.findViewById(R.id.swiperefresh); // Set the color scheme of the SwipeRefreshLayout by providing 4 color resource ids mSwipeRefreshLayout.setColorSchemeResources(R.color.swipe_color_1, R.color.swipe_color_2, R.color.swipe_color_3, R.color.swipe_color_5); mProgress = (ProgressBar) view.findViewById(R.id.web_progress); // Initialize the WebView schedule = (WebView) view.findViewById(R.id.text_audio_main); schedule.getSettings().setSupportZoom(true); WebSettings settings = schedule.getSettings(); settings.setDefaultTextEncodingName(ENCODING); mStub = (ViewStub) view.findViewById(R.id.stub_internet); }
From source file:com.androzic.waypoint.WaypointInfo.java
@SuppressLint("NewApi") private void updateWaypointInfo(double lat, double lon) { Androzic application = Androzic.getApplication(); Activity activity = getActivity();/*from w ww .j a v a2 s. com*/ Dialog dialog = getDialog(); View view = getView(); WebView description = (WebView) view.findViewById(R.id.description); if ("".equals(waypoint.description)) { description.setVisibility(View.GONE); } else { String descriptionHtml; try { TypedValue tv = new TypedValue(); Theme theme = activity.getTheme(); Resources resources = getResources(); theme.resolveAttribute(android.R.attr.textColorSecondary, tv, true); int secondaryColor = resources.getColor(tv.resourceId); String css = String.format( "<style type=\"text/css\">html,body{margin:0;background:transparent} *{color:#%06X}</style>\n", (secondaryColor & 0x00FFFFFF)); descriptionHtml = css + waypoint.description; description.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(WebView view, String url) { view.setBackgroundColor(Color.TRANSPARENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) view.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); } }); description.setBackgroundColor(Color.TRANSPARENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) description.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); } catch (Resources.NotFoundException e) { description.setBackgroundColor(Color.LTGRAY); descriptionHtml = waypoint.description; } WebSettings settings = description.getSettings(); settings.setDefaultTextEncodingName("utf-8"); settings.setAllowFileAccess(true); Uri baseUrl = Uri.fromFile(new File(application.dataPath)); description.loadDataWithBaseURL(baseUrl.toString() + "/", descriptionHtml, "text/html", "utf-8", null); } String coords = StringFormatter.coordinates(" ", waypoint.latitude, waypoint.longitude); ((TextView) view.findViewById(R.id.coordinates)).setText(coords); if (waypoint.altitude != Integer.MIN_VALUE) { ((TextView) view.findViewById(R.id.altitude)).setText(StringFormatter.elevationH(waypoint.altitude)); } double dist = Geo.distance(lat, lon, waypoint.latitude, waypoint.longitude); double bearing = Geo.bearing(lat, lon, waypoint.latitude, waypoint.longitude); bearing = application.fixDeclination(bearing); String distance = StringFormatter.distanceH(dist) + " " + StringFormatter.angleH(bearing); ((TextView) view.findViewById(R.id.distance)).setText(distance); if (waypoint.date != null) ((TextView) view.findViewById(R.id.date)) .setText(DateFormat.getDateFormat(activity).format(waypoint.date) + " " + DateFormat.getTimeFormat(activity).format(waypoint.date)); else ((TextView) view.findViewById(R.id.date)).setVisibility(View.GONE); dialog.setTitle(waypoint.name); }
From source file:com.pursuer.reader.easyrss.WebpageItemViewCtrl.java
@SuppressLint("SetJavaScriptEnabled") public WebpageItemViewCtrl(final DataMgr dataMgr, final Context context, final String uid, final boolean isMobilized) { super(dataMgr, R.layout.webpage_item, context); this.item = dataMgr.getItemByUid(uid, ITEM_PROJECTION); this.theme = new SettingTheme(dataMgr).getData(); this.fontSize = new SettingFontSize(dataMgr).getData(); // Disable hardware acceleration on Android 3.0-4.1 devices. if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.JELLY_BEAN_MR1 && android.os.Build.VERSION.SDK_INT >= android.os.Build.VERSION_CODES.HONEYCOMB) { view.setLayerType(View.LAYER_TYPE_SOFTWARE, null); }/* w ww . j av a 2 s . c om*/ { mobilizedView = (WebView) view.findViewById(R.id.MobilizedContent); mobilizedView.setBackgroundColor(context.getResources().getColor( theme == SettingTheme.THEME_NORMAL ? R.color.NormalBackground : R.color.DarkBackground)); mobilizedView.setFocusable(false); final WebSettings settings = mobilizedView.getSettings(); settings.setDefaultTextEncodingName(HTTP.UTF_8); settings.setJavaScriptEnabled(false); settings.setDefaultFontSize(fontSize); } { originalView = (WebView) view.findViewById(R.id.OriginalContent); originalView.setFocusable(false); originalView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); final WebSettings settings = originalView.getSettings(); settings.setJavaScriptEnabled(true); settings.setSupportZoom(true); settings.setBuiltInZoomControls(true); originalView.setWebViewClient(new WebViewClient() { @Override public void onPageFinished(final WebView webView, final String url) { view.findViewById(R.id.OriginalProgress).setVisibility(View.GONE); } @Override public void onPageStarted(final WebView webView, final String url, final Bitmap favicon) { if (!showMobilized) { view.findViewById(R.id.OriginalProgress).setVisibility(View.VISIBLE); } } @Override public boolean shouldOverrideUrlLoading(final WebView webView, final String url) { webView.loadUrl(url); return false; } }); } if (isMobilized) { showMobilizedPage(); } else { showOriginalPage(); } view.findViewById(R.id.BtnMobilzedPage).setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { showMobilizedPage(); } }); view.findViewById(R.id.BtnOriginalPage).setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { showOriginalPage(); } }); view.findViewById(R.id.BtnClose).setOnClickListener(new OnClickListener() { @Override public void onClick(final View view) { if (listener != null) { listener.onBackNeeded(); } } }); }
From source file:com.androzic.waypoint.WaypointDetails.java
@SuppressLint("NewApi") private void updateWaypointDetails(double lat, double lon) { Androzic application = Androzic.getApplication(); AppCompatActivity activity = (AppCompatActivity) getActivity(); activity.getSupportActionBar().setTitle(waypoint.name); View view = getView();/*from ww w .j a v a2s . co m*/ final TextView coordsView = (TextView) view.findViewById(R.id.coordinates); coordsView.requestFocus(); coordsView.setTag(Integer.valueOf(StringFormatter.coordinateFormat)); coordsView.setText(StringFormatter.coordinates(" ", waypoint.latitude, waypoint.longitude)); coordsView.setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { int format = ((Integer) coordsView.getTag()).intValue() + 1; if (format == 5) format = 0; coordsView.setText(StringFormatter.coordinates(format, " ", waypoint.latitude, waypoint.longitude)); coordsView.setTag(Integer.valueOf(format)); } }); if (waypoint.altitude != Integer.MIN_VALUE) { ((TextView) view.findViewById(R.id.altitude)) .setText("\u2336 " + StringFormatter.elevationH(waypoint.altitude)); view.findViewById(R.id.altitude).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.altitude).setVisibility(View.GONE); } if (waypoint.proximity > 0) { ((TextView) view.findViewById(R.id.proximity)) .setText("~ " + StringFormatter.distanceH(waypoint.proximity)); view.findViewById(R.id.proximity).setVisibility(View.VISIBLE); } else { view.findViewById(R.id.proximity).setVisibility(View.GONE); } double dist = Geo.distance(lat, lon, waypoint.latitude, waypoint.longitude); double bearing = Geo.bearing(lat, lon, waypoint.latitude, waypoint.longitude); bearing = application.fixDeclination(bearing); String distance = StringFormatter.distanceH(dist) + " " + StringFormatter.angleH(bearing); ((TextView) view.findViewById(R.id.distance)).setText(distance); ((TextView) view.findViewById(R.id.waypointset)).setText(waypoint.set.name); if (waypoint.date != null) { view.findViewById(R.id.date_row).setVisibility(View.VISIBLE); ((TextView) view.findViewById(R.id.date)) .setText(DateFormat.getDateFormat(activity).format(waypoint.date) + " " + DateFormat.getTimeFormat(activity).format(waypoint.date)); } else { view.findViewById(R.id.date_row).setVisibility(View.GONE); } if ("".equals(waypoint.description)) { view.findViewById(R.id.description_row).setVisibility(View.GONE); } else { WebView description = (WebView) view.findViewById(R.id.description); String descriptionHtml; try { TypedValue tv = new TypedValue(); Theme theme = activity.getTheme(); Resources resources = getResources(); theme.resolveAttribute(android.R.attr.textColorPrimary, tv, true); int secondaryColor = resources.getColor(tv.resourceId); String css = String.format( "<style type=\"text/css\">html,body{margin:0;background:transparent} *{color:#%06X}</style>\n", (secondaryColor & 0x00FFFFFF)); descriptionHtml = css + waypoint.description; description.setWebViewClient(new WebViewClient() { @SuppressLint("NewApi") @Override public void onPageFinished(WebView view, String url) { view.setBackgroundColor(Color.TRANSPARENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) view.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); } }); description.setBackgroundColor(Color.TRANSPARENT); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) description.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); } catch (Resources.NotFoundException e) { description.setBackgroundColor(Color.LTGRAY); descriptionHtml = waypoint.description; } WebSettings settings = description.getSettings(); settings.setDefaultTextEncodingName("utf-8"); settings.setAllowFileAccess(true); Uri baseUrl = Uri.fromFile(new File(application.dataPath)); description.loadDataWithBaseURL(baseUrl.toString() + "/", descriptionHtml, "text/html", "utf-8", null); view.findViewById(R.id.description_row).setVisibility(View.VISIBLE); } }
From source file:com.pursuer.reader.easyrss.VerticalSingleItemView.java
@SuppressLint("SetJavaScriptEnabled") public void loadContent() { final WebSettings settings = webView.getSettings(); settings.setDefaultTextEncodingName(HTTP.UTF_8); settings.setJavaScriptEnabled(true); settings.setDefaultFontSize(fontSize); settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); settings.setRenderPriority(RenderPriority.LOW); final StringBuffer content = new StringBuffer(); if (item.getState().isCached()) { settings.setBlockNetworkImage(true); content.append(DataUtils.readFromFile(new File(item.getFullContentStoragePath()))); } else {// w ww .ja v a2s .c o m final SettingImageFetching sImgFetch = new SettingImageFetching(dataMgr); if (NetworkUtils.checkImageFetchingNetworkStatus(context, sImgFetch.getData())) { settings.setBlockNetworkImage(false); content.append(DataUtils.readFromFile(new File(item.getOriginalContentStoragePath()))); } else { settings.setBlockNetworkImage(true); content.append(DataUtils.readFromFile(new File(item.getStrippedContentStoragePath()))); } } content.append(DataUtils.DEFAULT_JS); content.append( theme == SettingTheme.THEME_NORMAL ? DataUtils.DEFAULT_NORMAL_CSS : DataUtils.DEFAULT_DARK_CSS); webView.loadDataWithBaseURL("file://" + item.getStoragePath() + "/", content.toString(), null, "utf-8", null); }
From source file:org.freshrss.easyrss.VerticalSingleItemView.java
@SuppressLint({ "SetJavaScriptEnabled", "NewApi" }) public void loadContent() { final WebSettings settings = webView.getSettings(); settings.setDefaultTextEncodingName(HTTP.UTF_8); settings.setJavaScriptEnabled(true); settings.setDefaultFontSize(fontSize); settings.setCacheMode(WebSettings.LOAD_CACHE_ELSE_NETWORK); //settings.setRenderPriority(RenderPriority.LOW); final StringBuffer content = new StringBuffer(); if (item.getState().isCached()) { content.append(DataUtils.readFromFile(new File(item.getFullContentStoragePath()))); } else {//from ww w . ja va 2 s . c o m final SettingImageFetching sImgFetch = new SettingImageFetching(dataMgr); if (NetworkUtils.checkImageFetchingNetworkStatus(context, sImgFetch.getData())) { content.append(DataUtils.readFromFile(new File(item.getOriginalContentStoragePath()))); } else { content.append(DataUtils.readFromFile(new File(item.getStrippedContentStoragePath()))); } } content.append(DataUtils.DEFAULT_JS); content.append( theme == SettingTheme.THEME_NORMAL ? DataUtils.DEFAULT_NORMAL_CSS : DataUtils.DEFAULT_DARK_CSS); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) { WebView.setWebContentsDebuggingEnabled(true); } webView.loadDataWithBaseURL("file://" + item.getStoragePath() + "/", content.toString(), null, "utf-8", null); }
From source file:com.free.searcher.MainFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup viewContainer, Bundle savedInstanceState) { super.onCreateView(inflater, viewContainer, savedInstanceState); this.activity = getActivity(); actionBar = activity.getActionBar(); View v = inflater.inflate(R.layout.main, viewContainer, false); v.setOnSystemUiVisibilityChangeListener(this); webView = (WebView) v.findViewById(R.id.webView1); statusView = (TextView) v.findViewById(R.id.statusView); if (webViewBundle != null) { webView.restoreState(webViewBundle); Log.d("onCreateView.webView.restoreState", webViewBundle + ""); } else if (currentUrl.length() > 0) { Log.d("onCreateView.locX, locY", locX + ", " + locY + ", " + currentUrl); webView.loadUrl(currentUrl);//from w w w. j a v a 2 s . c om webView.setScrollX(locX); webView.setScrollY(locY); Log.d("currentUrl 8", currentUrl); } statusView.setText(status); Log.d("onCreateView.savedInstanceState", savedInstanceState + "vvv"); mNotificationManager = (NotificationManager) activity.getSystemService(activity.NOTIFICATION_SERVICE); webView.setFocusable(true); webView.setFocusableInTouchMode(true); webView.requestFocus(); webView.requestFocusFromTouch(); webView.getSettings().setAllowContentAccess(false); webView.getSettings().setPluginState(WebSettings.PluginState.OFF); // webView.setBackgroundColor(LIGHT_BLUE); webView.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); webView.setBackgroundColor(getResources().getColor(R.color.lightyellow)); webView.setOnLongClickListener(this); statusView.setOnLongClickListener(this); webView.setWebViewClient(new WebViewClient() { private void jumpTo(final int xLocation, final int yLocation) { webView.postDelayed(new Runnable() { @Override public void run() { Log.d("jumpTo1.locX, locY", xLocation + ", " + yLocation + ", " + currentUrl); try { webView.scrollTo(xLocation, yLocation); webView.setScrollX(xLocation); webView.setScrollY(yLocation); // locX = 0; // locY = 0; } catch (RuntimeException e) { Log.e("error jumpTo2.locX, locY", locX + ", " + locY + ", " + currentUrl); } } }, 100); } @Override public boolean shouldOverrideUrlLoading(WebView view, final String url) { if (currentZipFileName.length() > 0 && (extractFile == null || extractFile.isClosed())) { try { extractFile = new ExtractFile(currentZipFileName, MainFragment.PRIVATE_PATH + currentZipFileName); } catch (RarException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } int ind = url.indexOf("?deleteFile="); if (ind >= 0) { if (dupTask == null) { showToast("Please do duplicate finding again."); return true; } String urlStatus = Util.getUrlStatus(url); final String selectedFile = urlStatus.substring(urlStatus.indexOf("?deleteFile=") + 12, urlStatus.length()); Log.d("deleteFile", "url=" + url + ", urlStatus=" + urlStatus); AlertDialog.Builder alert = new AlertDialog.Builder(activity); alert.setTitle("Delete File?"); alert.setMessage("Do you really want to delete file \"" + selectedFile + "\"?"); alert.setCancelable(true); alert.setNegativeButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { try { locX = webView.getScrollX(); locY = webView.getScrollY(); webView.loadUrl( new File(dupTask.deleteFile(selectedFile)).toURI().toURL().toString()); } catch (IOException e) { statusView.setText(e.getMessage()); Log.d("deleteFile", e.getMessage(), e); } } }); alert.setPositiveButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog alertDialog = alert.create(); alertDialog.show(); return true; } ind = url.indexOf("?deleteGroup="); if (ind >= 0) { if (dupTask == null) { showToast("Please do duplicate finding again."); return true; } String urlStatus = Util.getUrlStatus(url); final String groupFile = urlStatus.substring(urlStatus.indexOf("?deleteGroup=") + 13, urlStatus.length()); int indexOf = groupFile.indexOf(","); final int group = Integer.parseInt(groupFile.substring(0, indexOf)); final String selectedFile = groupFile.substring(indexOf + 1); Log.d("groupFile", ",groupFile=" + groupFile + ", url=" + url + ", urlStatus=" + urlStatus); AlertDialog.Builder alert = new AlertDialog.Builder(activity); alert.setTitle("Delete Group of Files?"); alert.setMessage( "Do you really want to delete this group, except file \"" + selectedFile + "\"?"); alert.setCancelable(true); alert.setNegativeButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { locX = webView.getScrollX(); locY = webView.getScrollY(); webView.postDelayed(new Runnable() { @Override public void run() { try { webView.loadUrl(new File(dupTask.deleteGroup(group, selectedFile)).toURI() .toURL().toString()); } catch (Throwable e) { statusView.setText(e.getMessage()); Log.e("Delete Group", e.getMessage(), e); Log.e("Delete Group", locX + ", " + locY + ", " + currentUrl); } } }, 0); } }); alert.setPositiveButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog alertDialog = alert.create(); alertDialog.show(); return true; } ind = url.indexOf("?deleteFolder="); if (ind >= 0) { if (dupTask == null) { showToast("Please do duplicate finding again."); return true; } String urlStatus = Util.getUrlStatus(url); final String selectedFile = urlStatus.substring(urlStatus.indexOf("?deleteFolder=") + 14, urlStatus.length()); Log.d("deleteFolder", ",deleteFolder=" + selectedFile + ", url=" + url + ", urlStatus=" + urlStatus); AlertDialog.Builder alert = new AlertDialog.Builder(activity); alert.setTitle("Delete folder?"); alert.setMessage("Do you really want to delete duplicate in folder \"" + selectedFile.substring(0, selectedFile.lastIndexOf("/")) + "\"?"); alert.setCancelable(true); alert.setNegativeButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { locX = webView.getScrollX(); locY = webView.getScrollY(); webView.postDelayed(new Runnable() { @Override public void run() { try { webView.loadUrl(new File(dupTask.deleteFolder(selectedFile)).toURI().toURL() .toString()); } catch (Throwable e) { statusView.setText(e.getMessage()); Log.e("Delete folder", e.getMessage(), e); Log.e("Delete folder", locX + ", " + locY + ", " + currentUrl); } } }, 0); } }); alert.setPositiveButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog alertDialog = alert.create(); alertDialog.show(); return true; } ind = url.indexOf("?deleteSub="); if (ind >= 0) { if (dupTask == null) { showToast("Please do duplicate finding again."); return true; } String urlStatus = Util.getUrlStatus(url); final String selectedFile = urlStatus.substring(urlStatus.indexOf("?deleteSub=") + 11, urlStatus.length()); Log.d("deleteSub", ",deleteSub=" + selectedFile + ", url=" + url + ", urlStatus=" + urlStatus); AlertDialog.Builder alert = new AlertDialog.Builder(activity); alert.setTitle("Delete sub folder?"); alert.setMessage("Do you really want to delete duplicate files in sub folder of \"" + selectedFile.substring(0, selectedFile.lastIndexOf("/")) + "\"?"); alert.setCancelable(true); alert.setNegativeButton("Yes", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { locX = webView.getScrollX(); locY = webView.getScrollY(); webView.postDelayed(new Runnable() { @Override public void run() { try { webView.loadUrl(new File(dupTask.deleteSubFolder(selectedFile)).toURI() .toURL().toString()); } catch (Throwable e) { statusView.setText(e.getMessage()); Log.e("Delete sub folder", e.getMessage(), e); Log.e("Delete sub folder", locX + ", " + locY + ", " + currentUrl); } } }, 0); } }); alert.setPositiveButton("No", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.cancel(); } }); AlertDialog alertDialog = alert.create(); alertDialog.show(); return true; } ind = url.indexOf("?viewName"); if (ind >= 0) { if (dupTask == null) { showToast("Please do duplicate finding again."); return true; } nameOrder = !nameOrder; locX = 0; locY = 0; Log.d("url=", url + ", viewName"); try { webView.loadUrl(new File(dupTask.genFile(dupTask.groupList, dupTask.NAME_VIEW)).toURI() .toURL().toString()); } catch (IOException e) { Log.e("viewName", e.getMessage(), e); } return true; } ind = url.indexOf("?viewGroup"); if (ind >= 0) { if (dupTask == null) { showToast("Please do duplicate finding again."); return true; } groupViewChanged = true; locX = 0; locY = 0; Log.d("url=", url + ", viewGroup"); try { webView.loadUrl(new File(dupTask.genFile(dupTask.groupList, dupTask.GROUP_VIEW)).toURI() .toURL().toString()); } catch (IOException e) { Log.e("viewGroup", e.getMessage(), e); } return true; } if (zextr == null) { locX = 0; locY = 0; } else { zextr = null; } if (MainActivity.popup) { final MainFragment frag = ((MainActivity) activity).addFragmentToStack(); frag.status = Util.getUrlStatus(url); frag.load = load; frag.currentSearching = currentSearching; frag.selectedFiles = selectedFiles; frag.files = files; frag.currentZipFileName = currentZipFileName; if (extractFile != null) { try { frag.extractFile = new ExtractFile(); extractFile.copyTo(frag.extractFile); } catch (RarException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } } frag.home = home; // if (mSearchView != null && mSearchView.getQuery().length() > 0) { // frag.mSearchView.setQuery(mSearchView.getQuery(), false); // } view.getHandler().postDelayed(new Runnable() { @Override public void run() { frag.webTask = new WebTask(MainFragment.this); frag.webTask.init(frag.webView, url); frag.webTask.execute(); frag.statusView.setText(frag.status); } }, 100); } else { currentUrl = url; Log.d("currentUrl 19", currentUrl); status = Util.getUrlStatus(url); statusView.setText("Opening " + url + "..."); webTask = new WebTask(MainFragment.this, webView, url, status.toString()); webTask.execute(); } // setNavVisibility(false); return true; } // @Override // public WebResourceResponse shouldInterceptRequest(WebView view, String url) { // } @Override public void onPageFinished(WebView view, String url) { if (container != null) { if (showFind) { container.setVisibility(View.VISIBLE); webView.findAllAsync(findBox.getText().toString()); } else { container.setVisibility(View.INVISIBLE); } } Log.d("onPageFinished", locX + ", " + locY + ", currentUrl=" + currentUrl + ", url=" + url); setNavVisibility(false); if (!backForward) { //if (zextr != null) { // zextr = null; jumpTo(locX, locY); } else { backForward = false; } // locX = 0; // locY = 0; Log.d("onPageFinished", url); /* This call inject JavaScript into the page which just finished loading. */ // webView.loadUrl("javascript:window.HTMLOUT.processHTML(" + // "'<head>'+document.getElementsByTagName('html')[0].innerHTML+'</head>');"); } }); WebSettings settings = webView.getSettings(); // webView.setWebViewClient(new WebViewClient()); // webView.setWebChromeClient(new WebChromeClient()); // webView.addJavascriptInterface(new HtmlSourceViewJavaScriptInterface(), "HTMLOUT"); settings.setMinimumFontSize(13); settings.setJavaScriptEnabled(true); settings.setDefaultTextEncodingName("UTF-8"); settings.setBuiltInZoomControls(true); // settings.setSansSerifFontFamily("Tahoma"); settings.setEnableSmoothTransition(true); return v; }