Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 8f333f19 authored by Paul Jensen's avatar Paul Jensen
Browse files

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
parent 9b5bd967
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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"/>
+10 −3
Original line number Diff line number Diff line
@@ -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>
+3 −1
Original line number Diff line number Diff line
@@ -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>
+5 −2
Original line number Diff line number Diff line
@@ -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);
        }
    }
}