Wifi details page: sign-in uses primary color

Test: tested with nearby captive portals
Bug: 36203355
Bug: 36656914
Change-Id: I726f1226862150ba6875c20f919df91ca8043335
This commit is contained in:
Hugo Benichi
2017-05-26 15:45:03 +09:00
parent 0a6d61883c
commit 484140ba6e
4 changed files with 55 additions and 5 deletions

View File

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

View File

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

View File

@@ -224,7 +224,7 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
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 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
(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();

View File

@@ -195,9 +195,9 @@ public class WifiDetailPreferenceControllerTest {
.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);