use of android.webkit.WebViewClient in project mintube by imshyam.
the class WebPlayer method setupPlayer.
public void setupPlayer() {
player.getSettings().setJavaScriptEnabled(true);
// For debugging using chrome on PC
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.KITKAT) {
player.setWebContentsDebuggingEnabled(true);
}
player.setWebChromeClient(new WebChromeClient());
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {
player.getSettings().setMediaPlaybackRequiresUserGesture(false);
}
player.getSettings().setUserAgentString("Mozilla/5.0 (Windows NT 6.2; Win64; x64; rv:21.0.0) Gecko/20121011 Firefox/21.0.0");
// ----------------------------To get Player Id-------------------------------------------
player.addJavascriptInterface(new JavaScriptInterface((PlayerService) context), "Interface");
player.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
return true;
}
@Override
public void onPageFinished(WebView view, String url) {
PlayerService.addStateChangeListener();
}
});
}
use of android.webkit.WebViewClient in project Stringlate by LonamiWebs.
the class BrowserActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_online_help);
webview = findViewById(R.id.webview);
WebSettings webSettings = webview.getSettings();
webSettings.setAllowFileAccess(false);
webSettings.setUserAgentString("Mozilla/5.0 (Linux; U; Android 4.4.4; Nexus 5 Build/KTU84P) AppleWebkit/534.30 (KHTML, like Gecko) Version/4.0 Mobile Safari/534.30");
webview.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
view.loadUrl(url);
return true;
}
});
Intent intent = getIntent();
if (isShowingStringlateHelp = intent.getBooleanExtra(EXTRA_DO_SHOW_STRINGLATE_HELP, false)) {
webSettings.setAllowFileAccess(true);
String locale = Locale.getDefault().getLanguage();
if (!helpAvailableForLocale(locale))
locale = ONLINE_HELP_DEFAULT_LOCALE;
webview.loadUrl(String.format("file:///android_res/raw/%s.html", locale));
}
if (!TextUtils.isEmpty(intent.getStringExtra(EXTRA_LOAD_URL))) {
webview.loadUrl(intent.getStringExtra(EXTRA_LOAD_URL));
}
}
use of android.webkit.WebViewClient in project guanggoo-android by mzlogin.
the class TopicDetailFragment method initWebView.
private void initWebView() {
mContentWebView.getSettings().setUseWideViewPort(false);
mContentWebView.getSettings().setLoadWithOverviewMode(true);
mContentWebView.getSettings().setPluginState(WebSettings.PluginState.ON);
mContentWebView.setWebChromeClient(new WebChromeClient());
mContentWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
FragmentFactory.PageType pageType = FragmentFactory.getPageTypeByUrl(url);
if (mListener != null && pageType == FragmentFactory.PageType.VIEW_IMAGE) {
mListener.openPage(url, getString(R.string.view_image));
return true;
}
startActivity(new Intent(Intent.ACTION_VIEW, Uri.parse(url)));
return true;
}
});
mContentWebView.getSettings().setJavaScriptEnabled(true);
}
use of android.webkit.WebViewClient in project vialer-android by VoIPGRID.
the class WebActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_web);
// Set the Toolbar to use as ActionBar
setSupportActionBar((Toolbar) findViewById(R.id.action_bar));
// Set the Toolbar title
getSupportActionBar().setTitle(getIntent().getStringExtra(TITLE));
// Enabled home as up for the Toolbar
getSupportActionBar().setDisplayHomeAsUpEnabled(true);
// Enabled home button for the Toolbar
getSupportActionBar().setHomeButtonEnabled(true);
// Get the ProgressBar
mProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
// Get the WebView.
mWebView = (WebView) findViewById(R.id.web_view);
// Enable javascript.
mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.getSettings().setDomStorageEnabled(true);
// Set webview client.
mWebView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(WebView webView, String url) {
webView.loadUrl(url);
return true;
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
super.onPageStarted(view, url, favicon);
mProgressBar.setVisibility(View.VISIBLE);
}
@Override
public void onPageFinished(WebView view, String url) {
super.onPageFinished(view, url);
mProgressBar.setVisibility(View.INVISIBLE);
if (getIntent().getStringExtra(PAGE).equals(getString(R.string.web_password_change))) {
final String js = "javascript:document.getElementById('id_username').value='" + getIntent().getStringExtra(USERNAME) + "';" + "document.getElementById('id_password').value='" + getIntent().getStringExtra(PASSWORD) + "';" + "document.forms[0].submit();";
if (Build.VERSION.SDK_INT >= 19) {
view.evaluateJavascript(js, new ValueCallback<String>() {
@Override
public void onReceiveValue(String s) {
}
});
} else {
view.loadUrl(js);
}
}
}
});
String uri = getIntent().getStringExtra(PAGE);
if (uri.startsWith("http")) {
loadPage(uri);
} else {
// request an autologin token and load the requested page.
autoLoginToken();
}
// Track the web view.
AnalyticsHelper analyticsHelper = new AnalyticsHelper(((AnalyticsApplication) getApplication()).getDefaultTracker());
analyticsHelper.sendScreenViewTrack(getIntent().getStringExtra(GA_TITLE));
}
use of android.webkit.WebViewClient in project Tools-For-Android-Development by hatanvir.
the class MainActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_main);
webView = findViewById(R.id.WebViewIdXml);
webView.loadUrl("http://www.primeasia.edu.bd/");
// javascript enable
WebSettings webSettings = webView.getSettings();
webSettings.getJavaScriptEnabled();
// for visiting more page
webView.setWebViewClient(new WebViewClient());
}
Aggregations