Update
This commit is contained in:
parent
0c44a32df6
commit
b46a4c5e91
1 changed files with 8 additions and 17 deletions
|
@ -71,26 +71,22 @@ public class HelpArticleDialogFragment extends DialogFragment {
|
|||
webView = (WebView) view.findViewById(R.id.webView);
|
||||
webView.getSettings().setJavaScriptEnabled(true);
|
||||
if (assetName != null) {
|
||||
if (savedInstanceState != null) {
|
||||
webView.restoreState(savedInstanceState);
|
||||
} else {
|
||||
String fileContents = getAssetAsString(assetName, getActivity());
|
||||
String fileContents = getAssetAsString(assetName, getActivity());
|
||||
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(HEADER_INNER);
|
||||
sb.append(fileContents);
|
||||
sb.append(FOOTER_INNER);
|
||||
StringBuilder sb = new StringBuilder();
|
||||
sb.append(HEADER_INNER);
|
||||
sb.append(fileContents);
|
||||
sb.append(FOOTER_INNER);
|
||||
|
||||
webView.loadDataWithBaseURL("http://osmand.net", sb.toString(), null, "utf-8", null);
|
||||
}
|
||||
webView.loadDataWithBaseURL("http://osmand.net", sb.toString(), null, "utf-8", null);
|
||||
webView.setWebViewClient(new WebViewClient() {
|
||||
@Override
|
||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||
if (url.startsWith("http://osmand.net/features?id=")) {
|
||||
String id = url.substring("http://osmand.net/features?id=".length());
|
||||
dismiss();
|
||||
instantiateWithAsset("feature_articles/"+id+".html", getString(R.string.shared_string_help)).show(
|
||||
getActivity().getSupportFragmentManager(), "DIALOG_HELP_ARTICLE");
|
||||
instantiateWithAsset("feature_articles/" + id + ".html", getString(R.string.shared_string_help))
|
||||
.show(getActivity().getSupportFragmentManager(), "DIALOG_HELP_ARTICLE");
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
@ -117,11 +113,6 @@ public class HelpArticleDialogFragment extends DialogFragment {
|
|||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
webView.saveState(outState);
|
||||
}
|
||||
|
||||
private OsmandApplication getOsmandApplication() {
|
||||
return (OsmandApplication) getActivity().getApplication();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue