List of usage examples for android.webkit WebViewClient WebViewClient
WebViewClient
From source file:org.ciasaboark.tacere.activity.AboutLicenseActivity.java
@Override protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.activity_about_activity_license); // Show the Up button in the action bar. setupActionBar();/*w w w . ja v a 2 s . c om*/ WebView wv = (WebView) findViewById(R.id.webView1); String htmlData = ""; try { BufferedReader br = new BufferedReader(new InputStreamReader(getAssets().open("license.html"))); String line; while ((line = br.readLine()) != null) { htmlData += line; } } catch (FileNotFoundException e) { Log.e(TAG, e.getMessage()); } catch (IOException e) { Log.e(TAG, e.getMessage()); } int colorInt = getResources().getColor(R.color.link_color); String hexColor = String.format("#%06X", (0xFFFFFF & colorInt)); while (htmlData.contains("LINKCOLOR")) { htmlData = htmlData.replace("LINKCOLOR", hexColor); } wv.loadData(htmlData, "text/html", "UTF8"); // All links should open in the default browser, not this WebView wv.setWebViewClient(new WebViewClient() { @Override public boolean shouldOverrideUrlLoading(WebView view, String url) { view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); return true; } }); wv.setBackgroundColor(0x00000000); wv.setLayerType(WebView.LAYER_TYPE_SOFTWARE, null); }
From source file:com.ezac.gliderlogs.FlightRaspActivity.java
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.view_list);/* w ww . j a v a 2 s . c o m*/ // hide soft keyboard setMode(); WebView browser = (WebView) findViewById(R.id.webview_1); browser.setWebViewClient(new WebViewClient()); browser.getSettings().setLoadsImagesAutomatically(true); browser.getSettings().setJavaScriptEnabled(true); browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); browser.loadUrl("http://blipmaps.nl/showblipmap.php?Param=sfctemp&Day=0&Time=1130&Lang=En&Stage=1"); }
From source file:com.ezac.gliderlogs.FlightNotamBLXActivity.java
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.view_list);/*from ww w .jav a2 s . com*/ // hide soft keyboard setMode(); WebView browser = (WebView) findViewById(R.id.webview_1); browser.setWebViewClient(new WebViewClient()); browser.getSettings().setLoadsImagesAutomatically(true); browser.getSettings().setJavaScriptEnabled(true); browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); browser.loadUrl("http://www.notaminfo.com/belgiummap"); }
From source file:com.ezac.gliderlogs.FlightNotamNLDActivity.java
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.view_list);/* w ww .j a v a 2 s . c o m*/ // hide soft keyboard setMode(); WebView browser = (WebView) findViewById(R.id.webview_1); browser.setWebViewClient(new WebViewClient()); browser.getSettings().setLoadsImagesAutomatically(true); browser.getSettings().setJavaScriptEnabled(true); browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); browser.loadUrl("http://www.zweefvlieg.net/notam2014/"); }
From source file:com.memetro.android.web.WebViewer.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View inflated = inflater.inflate(R.layout.fragment_webview, container, false); final Bundle arguments = getArguments(); if (arguments != null) { loadUrl = arguments.getString("url"); }/* w ww . ja v a 2 s . co m*/ mainWebView = (WebView) inflated.findViewById(R.id.main_web_view); mainWebView.getSettings().setJavaScriptEnabled(true); mainWebView.setWebViewClient(new WebViewClient() { @Override public void onPageStarted(WebView view, String url, Bitmap favicon) { pdialog.show(); } @Override public void onPageFinished(WebView view, String url) { pdialog.dismiss(); } }); mainWebView.loadUrl(loadUrl); return inflated; }
From source file:com.ezac.gliderlogs.FlightOGNActivity.java
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.view_list);/* www .j a va2 s . com*/ // hide soft keyboard setMode(); WebView browser = (WebView) findViewById(R.id.webview_1); browser.setWebViewClient(new WebViewClient()); browser.getSettings().setSupportZoom(true); browser.getSettings().setBuiltInZoomControls(true); browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); browser.setScrollbarFadingEnabled(true); browser.getSettings().setLoadsImagesAutomatically(true); browser.getSettings().setDomStorageEnabled(true); browser.getSettings().setAppCacheEnabled(true); browser.getSettings().setAppCacheMaxSize(1024 * 1024 * 32); String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath(); browser.getSettings().setAppCachePath(appCachePath); browser.getSettings().setAllowFileAccess(true); browser.getSettings().setJavaScriptEnabled(true); browser.loadUrl("http://live.glidernet.org/#c=51.27405,3.93909&z=11"); }
From source file:com.ezac.gliderlogs.FlightADSBActivity.java
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.view_list);// www . ja v a 2 s. co m // hide soft keyboard setMode(); WebView browser = (WebView) findViewById(R.id.webview_1); browser.setWebViewClient(new WebViewClient()); browser.getSettings().setSupportZoom(true); browser.getSettings().setBuiltInZoomControls(true); browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); browser.setScrollbarFadingEnabled(true); browser.getSettings().setLoadsImagesAutomatically(true); browser.getSettings().setDomStorageEnabled(true); browser.getSettings().setAppCacheEnabled(true); browser.getSettings().setAppCacheMaxSize(1024 * 1024 * 32); String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath(); browser.getSettings().setAppCachePath(appCachePath); browser.getSettings().setAllowFileAccess(true); browser.getSettings().setJavaScriptEnabled(true); browser.loadUrl("http://86.83.189.66:8099//gmap.php"); }
From source file:com.ezac.gliderlogs.FlightGliderActivity.java
@Override protected void onCreate(Bundle bundle) { super.onCreate(bundle); setContentView(R.layout.view_list);/*from w w w .j av a 2s.co m*/ // hide soft keyboard setMode(); WebView browser = (WebView) findViewById(R.id.webview_1); browser.setWebViewClient(new WebViewClient()); browser.getSettings().setSupportZoom(true); browser.getSettings().setBuiltInZoomControls(true); browser.setScrollBarStyle(View.SCROLLBARS_INSIDE_OVERLAY); browser.setScrollbarFadingEnabled(true); browser.getSettings().setLoadsImagesAutomatically(true); browser.getSettings().setDomStorageEnabled(true); browser.getSettings().setAppCacheEnabled(true); browser.getSettings().setAppCacheMaxSize(1024 * 1024 * 32); String appCachePath = getApplicationContext().getCacheDir().getAbsolutePath(); browser.getSettings().setAppCachePath(appCachePath); browser.getSettings().setAllowFileAccess(true); browser.getSettings().setJavaScriptEnabled(true); browser.loadUrl("http://live.glidertracking.com/index.php"); }
From source file:com.bluekai.sdk.BlueKaiViewDialog.java
@Override public Dialog onCreateDialog(Bundle savedInstanceState) { AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(getActivity()); if (blueKaiView == null) { blueKaiView = new WebView(getActivity()); WebViewClient client = new WebViewClient() { @Override//from w ww .j a v a2 s .c o m public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) { super.onReceivedError(view, errorCode, description, failingUrl); Logger.debug("BlueKaiView", "Error loading BK URL in webview -- " + errorCode + " -- " + description); errorOccured = true; if (listener != null) { listener.onViewLoaded(false, isExistingData(), getParamsList()); } } @Override public void onPageFinished(WebView view, String url) { super.onPageFinished(view, url); if (!errorOccured && listener != null) { errorOccured = false; listener.onViewLoaded(true, isExistingData(), getParamsList()); } } }; blueKaiView.setWebViewClient(client); WebSettings webSettings = blueKaiView.getSettings(); webSettings.setJavaScriptEnabled(true); int height = 1, width = 1; // if (devMode) { height = width = 300; // } RelativeLayout.LayoutParams params = new RelativeLayout.LayoutParams(width, height); params.addRule(RelativeLayout.ALIGN_PARENT_LEFT, RelativeLayout.TRUE); params.addRule(RelativeLayout.ALIGN_PARENT_TOP, RelativeLayout.TRUE); params.setMargins(10, 10, 10, 10); blueKaiView.setLayoutParams(params); blueKaiView.setBackgroundColor(Color.LTGRAY); alertDialogBuilder.setNegativeButton("Close", new OnClickListener() { @Override public void onClick(DialogInterface dialog, int which) { dialog.dismiss(); } }); } blueKaiView.loadUrl(url); alertDialogBuilder.setView(blueKaiView); return alertDialogBuilder.create(); }
From source file:com.sinelead.car.club.XinchepingFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { // TODO Auto-generated method stub View v = inflater.inflate(R.layout.activity_content_xincheping, null); WebView webView = (WebView) v.findViewById(R.id.webView_xincheping); webView.setWebChromeClient(new WebChromeClient()); webView.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { view.loadUrl(url);/*from w w w . j a v a 2s .c o m*/ return true; } }); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("http://m.xincheping.com"); return v; }