Merge "Wifi details page: sign-in uses primary color" into oc-dev am: 0c5573a0e3

am: 5716f6cc7e

Change-Id: Ifb6f4a26fbbcd356f7fc0ff25c552cdd9da5c73d
This commit is contained in:
Hugo Benichi
2017-05-31 00:47:54 +00:00
committed by android-build-merger
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 --> <!-- Buttons -->
<com.android.settings.applications.LayoutPreference <com.android.settings.applications.LayoutPreference
android:key="buttons" android:key="buttons"
android:layout="@layout/two_buttons_panel" android:layout="@layout/wifi_network_details_two_buttons_panel"
android:selectable="false" /> android:selectable="false" />
<com.android.settings.wifi.WifiDetailPreference <com.android.settings.wifi.WifiDetailPreference

View File

@@ -224,7 +224,7 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
mConnectionDetailPref = screen.findPreference(KEY_CONNECTION_DETAIL_PREF); mConnectionDetailPref = screen.findPreference(KEY_CONNECTION_DETAIL_PREF);
mButtonsPref = (LayoutPreference) screen.findPreference(KEY_BUTTONS_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.setText(R.string.support_sign_in_button_text);
mSignInButton.setOnClickListener( mSignInButton.setOnClickListener(
view -> mConnectivityManagerWrapper.startCaptivePortalApp(mNetwork)); view -> mConnectivityManagerWrapper.startCaptivePortalApp(mNetwork));
@@ -245,7 +245,7 @@ public class WifiDetailPreferenceController extends PreferenceController impleme
(PreferenceCategory) screen.findPreference(KEY_IPV6_ADDRESS_CATEGORY); (PreferenceCategory) screen.findPreference(KEY_IPV6_ADDRESS_CATEGORY);
mSecurityPref.setDetailText(mAccessPoint.getSecurityString(false /* concise */)); 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.setText(R.string.forget);
mForgetButton.setOnClickListener(view -> forgetNetwork()); mForgetButton.setOnClickListener(view -> forgetNetwork());
updateInfo(); updateInfo();

View File

@@ -196,9 +196,9 @@ public class WifiDetailPreferenceControllerTest {
.thenReturn(mockConnectionDetailPref); .thenReturn(mockConnectionDetailPref);
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_BUTTONS_PREF)) when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_BUTTONS_PREF))
.thenReturn(mockButtonsPref); .thenReturn(mockButtonsPref);
when(mockButtonsPref.findViewById(R.id.left_button)) when(mockButtonsPref.findViewById(R.id.forget_button))
.thenReturn(mockForgetButton); .thenReturn(mockForgetButton);
when(mockButtonsPref.findViewById(R.id.right_button)) when(mockButtonsPref.findViewById(R.id.signin_button))
.thenReturn(mockSignInButton); .thenReturn(mockSignInButton);
when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_SIGNAL_STRENGTH_PREF)) when(mockScreen.findPreference(WifiDetailPreferenceController.KEY_SIGNAL_STRENGTH_PREF))
.thenReturn(mockSignalStrengthPref); .thenReturn(mockSignalStrengthPref);