From 8f333f19222ac9415152e31f10e0df2b571b0b77 Mon Sep 17 00:00:00 2001 From: Paul Jensen Date: Tue, 5 Aug 2014 22:52:16 -0400 Subject: [PATCH] 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 --- packages/CaptivePortalLogin/AndroidManifest.xml | 2 +- .../res/layout/activity_captive_portal_login.xml | 13 ++++++++++--- packages/CaptivePortalLogin/res/values/styles.xml | 4 +++- .../CaptivePortalLoginActivity.java | 7 +++++-- 4 files changed, 19 insertions(+), 7 deletions(-) diff --git a/packages/CaptivePortalLogin/AndroidManifest.xml b/packages/CaptivePortalLogin/AndroidManifest.xml index 5f78afe5601b5..c5fb16786041e 100644 --- a/packages/CaptivePortalLogin/AndroidManifest.xml +++ b/packages/CaptivePortalLogin/AndroidManifest.xml @@ -25,7 +25,7 @@ + android:theme="@style/AppTheme" > diff --git a/packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml b/packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml index d8f2928daec97..a11bed053ea48 100644 --- a/packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml +++ b/packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml @@ -5,9 +5,16 @@ android:layout_height="match_parent" tools:context="com.android.captiveportallogin.CaptivePortalLoginActivity" tools:ignore="MergeRootFrame"> - + android:layout_height="match_parent" + android:orientation="vertical" > + + - + diff --git a/packages/CaptivePortalLogin/res/values/styles.xml b/packages/CaptivePortalLogin/res/values/styles.xml index 6ce89c7ba4394..7ccd3d3b345f2 100644 --- a/packages/CaptivePortalLogin/res/values/styles.xml +++ b/packages/CaptivePortalLogin/res/values/styles.xml @@ -4,7 +4,7 @@ Base application theme, dependent on API level. This theme is replaced by AppBaseTheme from res/values-vXX/styles.xml on newer devices. --> - diff --git a/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java b/packages/CaptivePortalLogin/src/com/android/captiveportallogin/CaptivePortalLoginActivity.java index 09525b2572c09..ae52a1e65cf75 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; 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 @@ public class CaptivePortalLoginActivity extends Activity { done(true); } - requestWindowFeature(Window.FEATURE_PROGRESS); setContentView(R.layout.activity_captive_portal_login); getActionBar().setDisplayShowHomeEnabled(false); @@ -164,7 +165,9 @@ public class CaptivePortalLoginActivity extends Activity { 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); } } }