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