am c9926974: Switch CaptivePortalLogin app to use theme like Settings UI.

* commit 'c99269745257bc6b6a20420280e6b12085365803':
  Switch CaptivePortalLogin app to use theme like Settings UI.
This commit is contained in:
Paul Jensen
2014-08-07 02:58:33 +00:00
committed by Android Git Automerger
4 changed files with 19 additions and 7 deletions

View File

@@ -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"/>

View File

@@ -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>

View File

@@ -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>

View File

@@ -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);
}
}
}