List of usage examples for android.webkit WebView setWebViewClient
public void setWebViewClient(WebViewClient client)
From source file:com.hhs.hfnavigator.slidingtabs.harbinger.LiveStreamFragment.java
@Override public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { ViewGroup root = (ViewGroup) inflater.inflate(R.layout.fragment_webview, null); progressWheel = (ProgressWheel) root.findViewById(R.id.webViewProgress); swipeRefreshLayout = (SwipeRefreshLayout) root.findViewById(R.id.swipe); swipeRefreshLayout.setEnabled(false); progressWheel.spin();// w ww . j av a 2 s.c o m final WebView webView = (WebView) root.findViewById(R.id.webView); if (webView != null) { webView.setWebViewClient(new WebViewClient() { public void onPageFinished(WebView view, String url) { progressWheel.stopSpinning(); webView.setVisibility(View.VISIBLE); } }); webView.loadUrl("http://www.harbingernews.net/livestreams"); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setCacheMode(WebSettings.LOAD_NO_CACHE); webView.getSettings().setBuiltInZoomControls(true); webView.getSettings().setDisplayZoomControls(false); } webView.setVisibility(View.INVISIBLE); return root; }
From source file:com.prasanna.android.stacknetwork.FullscreenTextActivity.java
@SuppressLint("SetJavaScriptEnabled") @Override/*ww w.j av a2s . c o m*/ public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.code_full_screen); getActionBar().hide(); CharSequence text = getIntent().getCharSequenceExtra(StringConstants.TEXT); WebView webView = (WebView) findViewById(R.id.fullScreenText); webView.setWebChromeClient(new WebChromeClient()); webView.setWebViewClient(new WebViewClient()); webView.getSettings().setJavaScriptEnabled(true); webView.loadDataWithBaseURL(BASE_URL, CODE_HTML_PREFIX + MarkdownFormatter.escapeHtml(text) + CODE_HTML_SUFFIX, HttpContentTypes.TEXT_HTML, HTTP.UTF_8, null); }
From source file:com.commonsware.android.print.MainActivity.java
private WebView prepPrintWebView(final String name) { WebView result = getWebView(); result.setWebViewClient(new WebViewClient() { @Override//from w w w. j av a2 s . c o m public void onPageFinished(WebView view, String url) { print(name, view.createPrintDocumentAdapter(), new PrintAttributes.Builder().build()); } }); return (result); }
From source file:com.abcvoipsip.ui.help.Faq.java
public View getCustomView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.faq, container, false); WebView webView = (WebView) v.findViewById(R.id.webview); webView.getSettings().setJavaScriptEnabled(true); webView.setWebViewClient(new FaqWebViewClient(v)); webView.loadUrl(FAQ_URL);/*from ww w . ja va 2 s .c o m*/ return v; }
From source file:com.yoavst.quickapps.news.LoginActivity.java
@SuppressLint("SetJavaScriptEnabled") private WebView createWebView(final Context context) { WebView webView = new WebView(context); webView.setWebViewClient(createWebViewClient()); webView.setScrollBarStyle(WebView.SCROLLBARS_OUTSIDE_OVERLAY); webView.setVisibility(View.VISIBLE); webView.getSettings().setJavaScriptEnabled(true); webView.getSettings().setLoadWithOverviewMode(true); webView.getSettings().setSupportZoom(true); webView.getSettings().setBuiltInZoomControls(false); return webView; }
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 ww. j a va 2s.c o m return true; } }); webView.getSettings().setJavaScriptEnabled(true); webView.loadUrl("http://m.xincheping.com"); return v; }
From source file:net.kourlas.voipms_sms.activities.HelpActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.help);//from w w w. j a v a2 s . c o m Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); ViewCompat.setElevation(toolbar, getResources().getDimension(R.dimen.toolbar_elevation)); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } WebView browser = (WebView) findViewById(R.id.web_view); browser.loadUrl(getString(R.string.help_url)); browser.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url != null && (url.startsWith("http://") || url.startsWith("https://"))) { view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); return true; } else { return false; } } }); }
From source file:net.kourlas.voipms_sms.activities.CreditsActivity.java
@Override public void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); setContentView(R.layout.credits);// w w w . j a v a 2 s .c o m Toolbar toolbar = (Toolbar) findViewById(R.id.toolbar); ViewCompat.setElevation(toolbar, getResources().getDimension(R.dimen.toolbar_elevation)); setSupportActionBar(toolbar); ActionBar actionBar = getSupportActionBar(); if (actionBar != null) { actionBar.setHomeButtonEnabled(true); actionBar.setDisplayHomeAsUpEnabled(true); } WebView browser = (WebView) findViewById(R.id.web_view); browser.loadUrl(getString(R.string.credits_url)); browser.setWebViewClient(new WebViewClient() { public boolean shouldOverrideUrlLoading(WebView view, String url) { if (url != null && (url.startsWith("http://") || url.startsWith("https://"))) { view.getContext().startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url))); return true; } else { return false; } } }); }
From source file:de.nico.asura.activities.AuthWebView1.java
private void openWebView() { setContentView(R.layout.webview);//from w ww .j av a 2 s. c o m WebView webView = (WebView) findViewById(R.id.webView_main); webView.setWebViewClient(new MyWebViewClient()); webView.loadUrl(getString(R.string.menu_AuthWeb_1_url)); webView.getSettings().setBuiltInZoomControls(true); }
From source file:com.chatwing.whitelabel.fragments.ProfileInfoFragment.java
private void configWebView(WebView webView) { WebSettings webSettings = webView.getSettings(); webSettings.setAppCacheEnabled(false); webSettings.setJavaScriptEnabled(true); webView.setWebViewClient(new WebViewClient()); }