Skip to content

Commit

Permalink
Add Progress of loading a page
Browse files Browse the repository at this point in the history
  • Loading branch information
MaximBelov committed Sep 22, 2024
1 parent e2d8429 commit e153b99
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions src/android/InAppBrowser.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,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 @@ -916,12 +917,23 @@ public boolean onKey(View v, int keyCode, KeyEvent event) {
View footerClose = createCloseButton(7);
footer.addView(footerClose);

// Progress of loading a page
ProgressBar progressBarLoadingPage = new ProgressBar(webView.getContext(), null, android.R.attr.progressBarStyleHorizontal);
progressBarLoadingPage.setLayoutParams((new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.WRAP_CONTENT)));

// WebView
inAppWebView = new WebView(cordova.getActivity());
inAppWebView.setBackgroundColor(Color.WHITE);
inAppWebView.addView(progressBarLoadingPage);
inAppWebView.setLayoutParams(new LinearLayout.LayoutParams(LayoutParams.MATCH_PARENT, LayoutParams.MATCH_PARENT));
inAppWebView.setId(Integer.valueOf(6));
// File Chooser Implemented ChromeClient
inAppWebView.setWebChromeClient(new InAppChromeClient(thatWebView) {
public void onProgressChanged(WebView view, int progress)
{
progressBarLoadingPage.setProgress(progress);
progressBarLoadingPage.setVisibility(progress == 100 ? ProgressBar.GONE : ProgressBar.VISIBLE);
}
public boolean onShowFileChooser (WebView webView, ValueCallback<Uri[]> filePathCallback, WebChromeClient.FileChooserParams fileChooserParams)
{
LOG.d(LOG_TAG, "File Chooser 5.0+");
Expand Down

0 comments on commit e153b99

Please sign in to comment.