register for context menu again after orientation change (fix #898)

Signed-off-by: David Luhmer <david-dev@live.de>
This commit is contained in:
David Luhmer 2020-11-19 17:41:41 +01:00
parent 9b74fe121a
commit 4d177f9d31

View file

@ -102,13 +102,14 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
// Retain this fragment across configuration changes.
setRetainInstance(true);
}
@Override
public void onResume() {
super.onResume();
resumeCurrentPage();
registerForContextMenu(mWebView);
}
@Override
@ -310,8 +311,6 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
syncIncognitoState();
registerForContextMenu(mWebView);
mWebView.setWebChromeClient(new ProgressBarWebChromeClient(mProgressbarWebView));
mWebView.setWebViewClient(new WebViewClient() {
@ -417,12 +416,16 @@ public class NewsDetailFragment extends Fragment implements RssItemToHtmlTask.Li
public void onCreateContextMenu(ContextMenu menu, View view, ContextMenu.ContextMenuInfo menuInfo) {
if (!(view instanceof WebView))
if (!(view instanceof WebView)) {
Log.w(TAG, "onCreateContextMenu - no webview reference found");
return;
}
WebView.HitTestResult result = ((WebView) view).getHitTestResult();
if (result == null)
if (result == null) {
Log.d(TAG, "onCreateContextMenu - no webview hit result");
return;
}
int type = result.getType();
Document htmlDoc = Jsoup.parse(html);