Wifi details page: sign-in uses primary color
Test: tested with nearby captive portals
Bug: 36203355
Bug: 36656914
Change-Id: I726f1226862150ba6875c20f919df91ca8043335
diff --git a/res/layout/wifi_network_details_two_buttons_panel.xml b/res/layout/wifi_network_details_two_buttons_panel.xml
new file mode 100644
index 0000000..6abfac3
--- /dev/null
+++ b/res/layout/wifi_network_details_two_buttons_panel.xml
@@ -0,0 +1,50 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright (C) 2017 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!--
+ Defines a panel with two buttons and a spacer in between.
+ The right button uses the Material.Button.Colored style.
+-->
+
+<LinearLayout
+ xmlns:android="http://schemas.android.com/apk/res/android"
+ android:layout_width="match_parent"
+ android:layout_height="wrap_content"
+ android:gravity="bottom"
+ android:paddingTop="4dip"
+ android:orientation="horizontal">
+ <Button
+ android:id="@+id/forget_button"
+ android:layout_width="120dip"
+ android:layout_weight="0.4"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"/>
+ <!-- Spacer -->
+ <View
+ android:id="@+id/buttons_spacer_left"
+ android:layout_width="0dip"
+ android:layout_height="wrap_content"
+ android:visibility="invisible"
+ android:layout_weight="0.2" />
+ <Button
+ style="@android:style/Widget.Material.Button.Colored"
+ android:id="@+id/signin_button"
+ android:layout_width="120dip"
+ android:text="@string/cancel"
+ android:layout_weight="0.4"
+ android:layout_height="wrap_content"
+ android:layout_gravity="center_vertical"/>
+</LinearLayout>
diff --git a/res/xml/wifi_network_details_fragment.xml b/res/xml/wifi_network_details_fragment.xml
index 5d5958d..fafbbb0 100644
--- a/res/xml/wifi_network_details_fragment.xml
+++ b/res/xml/wifi_network_details_fragment.xml
@@ -29,7 +29,7 @@
<!-- Buttons -->
<com.android.settings.applications.LayoutPreference
android:key="buttons"
- android:layout="@layout/two_buttons_panel"
+ android:layout="@layout/wifi_network_details_two_buttons_panel"
android:selectable="false" />
<com.android.settings.wifi.WifiDetailPreference
diff --git a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
index a5d922d..b3f83b3 100644
--- a/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
+++ b/src/com/android/settings/wifi/details/WifiDetailPreferenceController.java
@@ -224,7 +224,7 @@
mConnectionDetailPref = screen.findPreference(KEY_CONNECTION_DETAIL_PREF);
mButtonsPref = (LayoutPreference) screen.findPreference(KEY_BUTTONS_PREF);
- mSignInButton = (Button) mButtonsPref.findViewById(R.id.right_button);
+ mSignInButton = (Button) mButtonsPref.findViewById(R.id.signin_button);
mSignInButton.setText(R.string.support_sign_in_button_text);
mSignInButton.setOnClickListener(
view -> mConnectivityManagerWrapper.startCaptivePortalApp(mNetwork));
@@ -245,7 +245,7 @@
(PreferenceCategory) screen.findPreference(KEY_IPV6_ADDRESS_CATEGORY);
mSecurityPref.setDetailText(mAccessPoint.getSecurityString(false /* concise */));
- mForgetButton = (Button) mButtonsPref.findViewById(R.id.left_button);
+ mForgetButton = (Button) mButtonsPref.findViewById(R.id.forget_button);
mForgetButton.setText(R.string.forget);
mForgetButton.setOnClickListener(view -> forgetNetwork());
updateInfo();
diff --git a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
index 208c157..0298195 100644
--- a/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
+++ b/tests/robotests/src/com/android/settings/wifi/details/WifiDetailPreferenceControllerTest.java
@@ -195,9 +195,9 @@
.thenReturn(mockConnectionDetailPref);
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_BUTTONS_PREF))
.thenReturn(mockButtonsPref);
- when(mockButtonsPref.findViewById(R.id.left_button))
+ when(mockButtonsPref.findViewById(R.id.forget_button))
.thenReturn(mockForgetButton);
- when(mockButtonsPref.findViewById(R.id.right_button))
+ when(mockButtonsPref.findViewById(R.id.signin_button))
.thenReturn(mockSignInButton);
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_SIGNAL_STRENGTH_PREF))
.thenReturn(mockSignalStrengthPref);