Switch CaptivePortalLogin app to use theme like Settings UI.
The theme is switched to Theme.Material.Settings. The progress bar
window feature is not supported in Material (b/16652978) so I added
a progress bar to the layout. The Theme.Material.Setting's accent
color is set such that ProgressBars are indistinguishable, so accent
color is reset back to the parent's setting.
bug:15409354
Change-Id: Ic2862b8439be8591ec426f3d4dffad72179b2539
diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
index 09525b2..ae52a1e 100644
--- a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
+++ b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java
@@ -26,11 +26,13 @@
import android.provider.Settings.Global;
import android.view.Menu;
import android.view.MenuItem;
+import android.view.View;
import android.view.Window;
import android.webkit.WebChromeClient;
import android.webkit.WebSettings;
import android.webkit.WebView;
import android.webkit.WebViewClient;
+import android.widget.ProgressBar;
import java.io.IOException;
import java.net.HttpURLConnection;
@@ -66,7 +68,6 @@
done(true);
}
- requestWindowFeature(Window.FEATURE_PROGRESS);
setContentView(R.layout.activity_captive_portal_login);
getActionBar().setDisplayShowHomeEnabled(false);
@@ -164,7 +165,9 @@
private class MyWebChromeClient extends WebChromeClient {
@Override
public void onProgressChanged(WebView view, int newProgress) {
- setProgress(newProgress*100);
+ ProgressBar myProgressBar = (ProgressBar) findViewById(R.id.progress_bar);
+ myProgressBar.setProgress(newProgress);
+ myProgressBar.setVisibility(newProgress == 100 ? View.GONE : View.VISIBLE);
}
}
}