use of android.webkit.WebView in project android_frameworks_base by ResurrectionRemix.
the class WebViewFragment method onCreateView.
/**
* Called to instantiate the view. Creates and returns the WebView.
*/
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
if (mWebView != null) {
mWebView.destroy();
}
mWebView = new WebView(getContext());
mIsWebViewAvailable = true;
return mWebView;
}
use of android.webkit.WebView in project android_frameworks_base by ResurrectionRemix.
the class CaptivePortalLoginActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
mCm = ConnectivityManager.from(this);
mNetwork = getIntent().getParcelableExtra(ConnectivityManager.EXTRA_NETWORK);
mCaptivePortal = getIntent().getParcelableExtra(ConnectivityManager.EXTRA_CAPTIVE_PORTAL);
mUserAgent = getIntent().getParcelableExtra(ConnectivityManager.EXTRA_CAPTIVE_PORTAL_USER_AGENT);
mUrl = getUrl();
if (mUrl == null) {
// getUrl() failed to parse the url provided in the intent: bail out in a way that
// at least provides network access.
done(Result.WANTED_AS_IS);
return;
}
if (DBG) {
Log.d(TAG, String.format("onCreate for %s", mUrl.toString()));
}
// Also initializes proxy system properties.
mCm.bindProcessToNetwork(mNetwork);
// Proxy system properties must be initialized before setContentView is called because
// setContentView initializes the WebView logic which in turn reads the system properties.
setContentView(R.layout.activity_captive_portal_login);
getActionBar().setDisplayShowHomeEnabled(false);
// Exit app if Network disappears.
final NetworkCapabilities networkCapabilities = mCm.getNetworkCapabilities(mNetwork);
if (networkCapabilities == null) {
finishAndRemoveTask();
return;
}
mNetworkCallback = new NetworkCallback() {
@Override
public void onLost(Network lostNetwork) {
if (mNetwork.equals(lostNetwork))
done(Result.UNWANTED);
}
};
final NetworkRequest.Builder builder = new NetworkRequest.Builder();
for (int transportType : networkCapabilities.getTransportTypes()) {
builder.addTransportType(transportType);
}
mCm.registerNetworkCallback(builder.build(), mNetworkCallback);
final WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.clearCache(true);
WebSettings webSettings = myWebView.getSettings();
webSettings.setJavaScriptEnabled(true);
webSettings.setMixedContentMode(WebSettings.MIXED_CONTENT_COMPATIBILITY_MODE);
webSettings.setUseWideViewPort(true);
webSettings.setLoadWithOverviewMode(true);
webSettings.setSupportZoom(true);
webSettings.setBuiltInZoomControls(true);
webSettings.setDisplayZoomControls(false);
mWebViewClient = new MyWebViewClient();
myWebView.setWebViewClient(mWebViewClient);
myWebView.setWebChromeClient(new MyWebChromeClient());
// Start initial page load so WebView finishes loading proxy settings.
// Actual load of mUrl is initiated by MyWebViewClient.
myWebView.loadData("", "text/html", null);
}
use of android.webkit.WebView in project android_frameworks_base by ResurrectionRemix.
the class LooperAcceleration method makeView.
private View makeView() {
LinearLayout layout = new LinearLayout(this);
layout.addView(new IsAcceleratedView(this), LayoutParams.MATCH_PARENT, 60);
if (INCLUDE_WEBVIEW) {
WebView wv = new WebView(this);
wv.setWebViewClient(new WebViewClient());
wv.setWebChromeClient(new WebChromeClient());
wv.loadUrl("http://www.webkit.org/blog-files/3d-transforms/poster-circle.html");
layout.addView(wv, LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT);
}
return layout;
}
use of android.webkit.WebView in project android_frameworks_base by ResurrectionRemix.
the class ScrollableWebViewActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
WebView webView = new WebView(this);
webView.loadData(sHtml, "text/html", null);
webView.setVerticalScrollBarEnabled(true);
setContentView(webView);
}
use of android.webkit.WebView in project Rocket.Chat.Android by RocketChat.
the class AbstractOAuthFragment method showWebView.
private void showWebView() {
if (TextUtils.isEmpty(url)) {
finish();
return;
}
final WebView webView = getWebview();
if (webView == null) {
finish();
return;
}
resultOK = false;
webView.getSettings().setUserAgentString("Chrome/56.0.0.0 Mobile");
webView.loadUrl(url);
webView.addJavascriptInterface(new JSInterface(result -> {
if (resultOK) {
return;
}
presenter.login(result);
}), "_rocketchet_hook");
}
Aggregations