public class InnerWebViewClient extends WebViewClient {
private SwipeRefreshLayout mSwipeRefreshLayout;
private Measurement mMeasurement;
public InnerWebViewClient(SwipeRefreshLayout swipeRefreshLayout, @Nullable Measurement measurement) {
mSwipeRefreshLayout = swipeRefreshLayout;
mMeasurement = measurement;
}
@Override
public boolean shouldOverrideUrlLoading(WebView view, String url) {
InterceptionIntent interceptionIntent = mInterceptionService.getInterceptionIntent(getActivity(), url);
if (interceptionIntent.isRoutingPossible()) {
Intent intent = interceptionIntent.getIntent();
if (intent.hasExtra(InterceptionService.INTERCEPTION_LINE_APP)) {
launchLineApp(getActivity());
} else if (intent.hasExtra(InterceptionService.INTERCEPTION_PLAY_STORE)) {
launchPlayStore(url);
} else if (intent.hasExtra(InterceptionService.INTERCEPTION_ONLY_STORE_ID)) {
Store store = new Store();
store.setStoreId(intent.getStringExtra((InterceptionService.INTERCEPTION_ONLY_STORE_ID)));
gotoShopList(store, R.id.web_view_container, TAG);
} else {
startActivity(intent);
}
return true;
}
if (mMeasurement != null) {
mMeasurement.sendSelectedUrlAction(url);
}
return false;
}
@Override
public void onPageStarted(WebView view, String url, Bitmap favicon) {
mURL = url;
mSwipeRefreshLayout.setRefreshing(true);
mWebView.clearCache(true);
}
@Override
public void onPageFinished(WebView view, String url) {
mSwipeRefreshLayout.setRefreshing(false);
}
@Override
public void onPageCommitVisible(WebView view, String url) {
super.onPageCommitVisible(view, url);
Log.d("Check","onPageCommitVisible");
}
@Override
public void onReceivedError(WebView view, WebResourceRequest request, WebResourceError error){
Log.d("Check","onReceivedError");
Log.d("Check",error.toString());
}
@Override
public void onLoadResource(WebView view, String url){
Log.d("Check","onLoadResource");
}
}
我有一个从URL加载的项目页面。每次都能完美运行。问题是,当我单击该网页上的某个项目时,某些时间项目不会进入详细页面。此后,我无法单击该页面的任何项目。我为一些方法放置了一些日志,当我每次遇到该事件时,都可以看到未调用 onPageCommitVisible 方法。这将是什么问题?我为此无所适从。