Loading packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml +7 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,13 @@ android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/url_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20sp" android:singleLine="true" /> <ProgressBar android:id="@+id/progress_bar" android:layout_width="match_parent" Loading packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java +10 −5 Original line number Diff line number Diff line Loading @@ -35,13 +35,13 @@ import android.util.ArrayMap; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.webkit.SslErrorHandler; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; import android.widget.TextView; import java.io.IOException; import java.net.HttpURLConnection; Loading Loading @@ -221,6 +221,7 @@ public class CaptivePortalLoginActivity extends Activity { } private class MyWebViewClient extends WebViewClient { private static final String INTERNAL_ASSETS = "file:///android_asset/"; private boolean firstPageLoad = true; @Override Loading @@ -240,6 +241,12 @@ public class CaptivePortalLoginActivity extends Activity { view.loadUrl(mURL.toString()); return; } // For internally generated pages, leave URL bar listing prior URL as this is the URL // the page refers to. if (!url.startsWith(INTERNAL_ASSETS)) { final TextView myUrlBar = (TextView) findViewById(R.id.url_bar); myUrlBar.setText(url); } testForCaptivePortal(); } Loading @@ -252,17 +259,15 @@ public class CaptivePortalLoginActivity extends Activity { @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { Log.w(TAG, "SSL error; displaying broken lock icon."); view.loadDataWithBaseURL("file:///android_asset/", SSL_ERROR_HTML, "text/HTML", "UTF-8", null); view.loadDataWithBaseURL(INTERNAL_ASSETS, SSL_ERROR_HTML, "text/HTML", "UTF-8", null); } } private class MyWebChromeClient extends WebChromeClient { @Override public void onProgressChanged(WebView view, int newProgress) { ProgressBar myProgressBar = (ProgressBar) findViewById(R.id.progress_bar); final ProgressBar myProgressBar = (ProgressBar) findViewById(R.id.progress_bar); myProgressBar.setProgress(newProgress); myProgressBar.setVisibility(newProgress == 100 ? View.GONE : View.VISIBLE); } } } Loading
packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml +7 −0 Original line number Diff line number Diff line Loading @@ -10,6 +10,13 @@ android:layout_height="match_parent" android:orientation="vertical" > <TextView android:id="@+id/url_bar" android:layout_width="match_parent" android:layout_height="wrap_content" android:textSize="20sp" android:singleLine="true" /> <ProgressBar android:id="@+id/progress_bar" android:layout_width="match_parent" Loading
packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java +10 −5 Original line number Diff line number Diff line Loading @@ -35,13 +35,13 @@ import android.util.ArrayMap; import android.util.Log; import android.view.Menu; import android.view.MenuItem; import android.view.View; import android.webkit.SslErrorHandler; import android.webkit.WebChromeClient; import android.webkit.WebSettings; import android.webkit.WebView; import android.webkit.WebViewClient; import android.widget.ProgressBar; import android.widget.TextView; import java.io.IOException; import java.net.HttpURLConnection; Loading Loading @@ -221,6 +221,7 @@ public class CaptivePortalLoginActivity extends Activity { } private class MyWebViewClient extends WebViewClient { private static final String INTERNAL_ASSETS = "file:///android_asset/"; private boolean firstPageLoad = true; @Override Loading @@ -240,6 +241,12 @@ public class CaptivePortalLoginActivity extends Activity { view.loadUrl(mURL.toString()); return; } // For internally generated pages, leave URL bar listing prior URL as this is the URL // the page refers to. if (!url.startsWith(INTERNAL_ASSETS)) { final TextView myUrlBar = (TextView) findViewById(R.id.url_bar); myUrlBar.setText(url); } testForCaptivePortal(); } Loading @@ -252,17 +259,15 @@ public class CaptivePortalLoginActivity extends Activity { @Override public void onReceivedSslError(WebView view, SslErrorHandler handler, SslError error) { Log.w(TAG, "SSL error; displaying broken lock icon."); view.loadDataWithBaseURL("file:///android_asset/", SSL_ERROR_HTML, "text/HTML", "UTF-8", null); view.loadDataWithBaseURL(INTERNAL_ASSETS, SSL_ERROR_HTML, "text/HTML", "UTF-8", null); } } private class MyWebChromeClient extends WebChromeClient { @Override public void onProgressChanged(WebView view, int newProgress) { ProgressBar myProgressBar = (ProgressBar) findViewById(R.id.progress_bar); final ProgressBar myProgressBar = (ProgressBar) findViewById(R.id.progress_bar); myProgressBar.setProgress(newProgress); myProgressBar.setVisibility(newProgress == 100 ? View.GONE : View.VISIBLE); } } }