Retain webview history when viewing Safety notices. Fixes #2160518

Save and restore webview history when changing orientation.
This commit is contained in:
Amith Yamasani
2009-10-06 13:10:14 -07:00
parent 059c3f5d1e
commit 3c9f79ba35

View File

@@ -58,7 +58,11 @@ public class SettingsSafetyLegalActivity extends AlertActivity
// Begin accessing // Begin accessing
mWebView.getSettings().setJavaScriptEnabled(true); mWebView.getSettings().setJavaScriptEnabled(true);
mWebView.loadUrl(userSafetylegalUrl); if (savedInstanceState == null) {
mWebView.loadUrl(userSafetylegalUrl);
} else {
mWebView.restoreState(savedInstanceState);
}
mWebView.setWebViewClient(new WebViewClient() { mWebView.setWebViewClient(new WebViewClient() {
@Override @Override
public void onPageFinished(WebView view, String url) { public void onPageFinished(WebView view, String url) {
@@ -110,4 +114,10 @@ public class SettingsSafetyLegalActivity extends AlertActivity
public void onCancel(DialogInterface dialog) { public void onCancel(DialogInterface dialog) {
finish(); finish();
} }
@Override
public void onSaveInstanceState(Bundle icicle) {
mWebView.saveState(icicle);
super.onSaveInstanceState(icicle);
}
} }