diff options
author | Paul Jensen <pauljensen@google.com> | 2014-08-05 22:52:16 -0400 |
---|---|---|
committer | Paul Jensen <pauljensen@google.com> | 2014-08-07 02:49:24 +0000 |
commit | 8f333f19222ac9415152e31f10e0df2b571b0b77 (patch) | |
tree | 96c7ace26f6c1251be4a4ddb68939ee7c426c36b /packages/CaptivePortalLogin | |
parent | 9b5bd967e4c90e424eba36feccdbde71fdee1743 (diff) | |
download | frameworks_base-8f333f19222ac9415152e31f10e0df2b571b0b77.zip frameworks_base-8f333f19222ac9415152e31f10e0df2b571b0b77.tar.gz frameworks_base-8f333f19222ac9415152e31f10e0df2b571b0b77.tar.bz2 |
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
Diffstat (limited to 'packages/CaptivePortalLogin')
4 files changed, 19 insertions, 7 deletions
diff --git a/packages/CaptivePortalLogin/AndroidManifest.xml b/packages/CaptivePortalLogin/AndroidManifest.xml index 5f78afe..c5fb167 100644 --- a/packages/CaptivePortalLogin/AndroidManifest.xml +++ b/packages/CaptivePortalLogin/AndroidManifest.xml @@ -25,7 +25,7 @@ <activity android:name="com.android.captiveportallogin.CaptivePortalLoginActivity" android:label="@string/action_bar_label" - android:theme="@android:style/Theme.Holo" > + android:theme="@style/AppTheme" > <intent-filter> <action android:name="android.intent.action.ACTION_SEND"/> <category android:name="android.intent.category.DEFAULT"/> diff --git a/packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml b/packages/CaptivePortalLogin/res/layout/activity_captive_portal_login.xml index d8f2928..a11bed0 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"> - <RelativeLayout + <LinearLayout android:layout_width="match_parent" - android:layout_height="match_parent" > + android:layout_height="match_parent" + android:orientation="vertical" > + + <ProgressBar + android:id="@+id/progress_bar" + android:layout_width="match_parent" + android:layout_height="wrap_content" + style="?android:attr/progressBarStyleHorizontal" /> <WebView android:id="@+id/webview" @@ -16,5 +23,5 @@ android:layout_alignParentBottom="false" android:layout_alignParentRight="false" /> -</RelativeLayout> +</LinearLayout> </FrameLayout> diff --git a/packages/CaptivePortalLogin/res/values/styles.xml b/packages/CaptivePortalLogin/res/values/styles.xml index 6ce89c7..7ccd3d3 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. --> - <style name="AppBaseTheme" parent="android:Theme.Light"> + <style name="AppBaseTheme" parent="@android:style/Theme.Material.Settings"> <!-- Theme customizations available in newer API levels can go in res/values-vXX/styles.xml, while customizations related to @@ -15,6 +15,8 @@ <!-- Application theme. --> <style name="AppTheme" parent="AppBaseTheme"> <!-- All customizations that are NOT specific to a particular API-level can go here. --> + <!-- Setting's theme's accent color makes ProgressBar useless, reset back. --> + <item name="android:colorAccent">@*android:color/material_light_blue_A200</item> </style> </resources> 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; 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); } } } |