use of android.webkit.WebView in project android_frameworks_base by ResurrectionRemix.
the class NetworkActivity method showErrorPage.
// Displays an error if the app is unable to load content.
private void showErrorPage() {
setContentView(R.layout.main);
// The specified network connection is not available. Displays error message.
WebView myWebView = (WebView) findViewById(R.id.webview);
myWebView.loadData(getResources().getString(R.string.connection_error), "text/html", null);
}
use of android.webkit.WebView in project android_frameworks_base by ResurrectionRemix.
the class ActivityThread method handleDestroyActivity.
private void handleDestroyActivity(IBinder token, boolean finishing, int configChanges, boolean getNonConfigInstance) {
ActivityClientRecord r = performDestroyActivity(token, finishing, configChanges, getNonConfigInstance);
if (r != null) {
cleanUpPendingRemoveWindows(r, finishing);
WindowManager wm = r.activity.getWindowManager();
View v = r.activity.mDecor;
if (v != null) {
if (r.activity.mVisibleFromServer) {
mNumVisibleActivities--;
}
IBinder wtoken = v.getWindowToken();
if (r.activity.mWindowAdded) {
if (r.mPreserveWindow) {
// Hold off on removing this until the new activity's
// window is being added.
r.mPendingRemoveWindow = r.window;
r.mPendingRemoveWindowManager = wm;
// We can only keep the part of the view hierarchy that we control,
// everything else must be removed, because it might not be able to
// behave properly when activity is relaunching.
r.window.clearContentView();
} else {
wm.removeViewImmediate(v);
}
}
if (wtoken != null && r.mPendingRemoveWindow == null) {
WindowManagerGlobal.getInstance().closeAll(wtoken, r.activity.getClass().getName(), "Activity");
} else if (r.mPendingRemoveWindow != null) {
// We're preserving only one window, others should be closed so app views
// will be detached before the final tear down. It should be done now because
// some components (e.g. WebView) rely on detach callbacks to perform receiver
// unregister and other cleanup.
WindowManagerGlobal.getInstance().closeAllExceptView(token, v, r.activity.getClass().getName(), "Activity");
}
r.activity.mDecor = null;
}
if (r.mPendingRemoveWindow == null) {
// If we are delaying the removal of the activity window, then
// we can't clean up all windows here. Note that we can't do
// so later either, which means any windows that aren't closed
// by the app will leak. Well we try to warning them a lot
// about leaking windows, because that is a bug, so if they are
// using this recreate facility then they get to live with leaks.
WindowManagerGlobal.getInstance().closeAll(token, r.activity.getClass().getName(), "Activity");
}
// Mocked out contexts won't be participating in the normal
// process lifecycle, but if we're running with a proper
// ApplicationContext we need to have it tear down things
// cleanly.
Context c = r.activity.getBaseContext();
if (c instanceof ContextImpl) {
((ContextImpl) c).scheduleFinalCleanup(r.activity.getClass().getName(), "Activity");
}
}
if (finishing) {
try {
ActivityManagerNative.getDefault().activityDestroyed(token);
} catch (RemoteException ex) {
throw ex.rethrowFromSystemServer();
}
}
mSomeActivitiesChanged = true;
}
use of android.webkit.WebView in project android_frameworks_base by ResurrectionRemix.
the class PowerTestActivity method onCreate.
@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
Log.v(LOGTAG, "onCreate, inst=" + Integer.toHexString(hashCode()));
LinearLayout contentView = new LinearLayout(this);
contentView.setOrientation(LinearLayout.VERTICAL);
setContentView(contentView);
setTitle("Idle");
webView = new WebView(this);
webView.getSettings().setJavaScriptEnabled(true);
webView.getSettings().setJavaScriptCanOpenWindowsAutomatically(false);
webView.getSettings().setLayoutAlgorithm(LayoutAlgorithm.NORMAL);
webViewClient = new SimpleWebViewClient();
chromeClient = new SimpleChromeClient();
webView.setWebViewClient(webViewClient);
webView.setWebChromeClient(chromeClient);
contentView.addView(webView, new LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.MATCH_PARENT, 0.0f));
handler = new Handler() {
@Override
public void handleMessage(Message msg) {
switch(msg.what) {
case MSG_TIMEOUT:
handleTimeout();
return;
case MSG_NAVIGATE:
manualDelay = msg.arg2;
navigate(msg.getData().getString(MSG_NAV_URL), msg.arg1);
logTime = msg.getData().getBoolean(MSG_NAV_LOGTIME);
return;
}
}
};
pageDoneLock = new Object();
}
use of android.webkit.WebView in project ETSMobile-Android2 by ApplETS.
the class MonETSFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup v = (ViewGroup) inflater.inflate(R.layout.fragment_web_view, container, false);
super.onCreateView(inflater, v, savedInstanceState);
webView = (WebView) v.findViewById(R.id.webView);
final WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
loadingView.showLoadingView();
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
view.loadUrl(url);
return false;
}
@Override
public void onPageFinished(WebView view, String url) {
// super.onPageFinished(view, url);
LoadingView.hideLoadingView(loadingView);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
}
});
webView.loadUrl("https://portail.etsmtl.ca/");
AnalyticsHelper.getInstance(getActivity()).sendScreenEvent(getClass().getSimpleName());
return v;
}
use of android.webkit.WebView in project ETSMobile-Android2 by ApplETS.
the class BiblioFragment method onCreateView.
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
ViewGroup v = (ViewGroup) inflater.inflate(R.layout.fragment_web_view, container, false);
super.onCreateView(inflater, v, savedInstanceState);
webView = (WebView) v.findViewById(R.id.webView);
final WebSettings webSettings = webView.getSettings();
webSettings.setJavaScriptEnabled(true);
loadingView.showLoadingView();
webView.setWebViewClient(new WebViewClient() {
@Override
public boolean shouldOverrideUrlLoading(final WebView view, final String url) {
view.loadUrl(url);
return false;
}
@Override
public void onPageFinished(WebView view, String url) {
// super.onPageFinished(view, url);
LoadingView.hideLoadingView(loadingView);
}
@Override
public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
view.loadUrl("file:///android_asset/webview_error_page.html");
}
});
webView.loadUrl(getActivity().getString(R.string.url_biblio));
AnalyticsHelper.getInstance(getActivity()).sendScreenEvent(getClass().getSimpleName());
return v;
}
Aggregations