Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/android/InAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ Licensed to the Apache Software Foundation (ASF) under one
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.ProgressBar;
import android.widget.RelativeLayout;
import android.widget.TextView;

Expand Down Expand Up @@ -116,6 +117,7 @@ public class InAppBrowser extends CordovaPlugin {
private InAppBrowserDialog dialog;
private WebView inAppWebView;
private EditText edittext;
private ProgressBar progressBar;
private CallbackContext callbackContext;
private boolean showLocationBar = true;
private boolean showZoomControls = true;
Expand Down Expand Up @@ -988,6 +990,13 @@ public void openFileChooser(ValueCallback<Uri> uploadMsg, String acceptType)
main.addView(toolbar);
}

// Progress Bar
progressBar = new ProgressBar(webView.getContext(), null, android.R.attr.progressBarStyleHorizontal);
progressBar.setIndeterminate(true);
progressBar.setVisibility(View.GONE);

main.addView(progressBar);

// Add our webview to our main view/layout
RelativeLayout webViewLayout = new RelativeLayout(cordova.getActivity());
webViewLayout.addView(inAppWebView);
Expand Down Expand Up @@ -1221,6 +1230,7 @@ public void onPageStarted(WebView view, String url, Bitmap favicon) {
} catch (JSONException ex) {
LOG.e(LOG_TAG, "URI passed in has caused a JSON error.");
}
progressBar.setVisibility(View.VISIBLE);
}


Expand Down Expand Up @@ -1248,6 +1258,7 @@ public void onPageFinished(WebView view, String url) {
} catch (JSONException ex) {
LOG.d(LOG_TAG, "Should never happen");
}
progressBar.setVisibility(View.GONE);
}

public void onReceivedError(WebView view, int errorCode, String description, String failingUrl) {
Expand All @@ -1264,6 +1275,7 @@ public void onReceivedError(WebView view, int errorCode, String description, Str
} catch (JSONException ex) {
LOG.d(LOG_TAG, "Should never happen");
}
progressBar.setVisibility(View.GONE);
}

/**
Expand Down