@Override public void onPageFinished(WebView view, String url) { Log.d(TAG, "onPageFinished : " + "Uri Parsed : " + Uri.parse(url).getPath()); if (TOKEN_PATH.equals(Uri.parse(url).getPath())) { // Save the tokens captureTokens(url); getProfileInfo(); } else { // Hide spinner // We don't hide spinner if this page has a token, as we want to leave it loading // for subsequent api calls. The page will self destruct when those calls hang up. // So in that case we never need to hide the spinner. setRefreshing(false); } super.onPageFinished(view, url); }
@Override public void onPageStarted(WebView view, String url, Bitmap favicon) { Log.d(TAG, "onPageStarted : " + "Uri Parse : " + Uri.parse(url).getPath()); // Display Spinner activity.setRefreshing(true); // Check for token if (TOKEN_PATH.equals(Uri.parse(url).getPath())) { // The login page redirects to a POST that returns a JSON block. // We don't want the JSON to show to the user so hide the view Log.d(TAG, "onPageStarted : URL : " + url); waitText.setVisibility(View.VISIBLE); webView.setVisibility(View.GONE); } super.onPageStarted(view, url, favicon); }