[WifiSettings] Refactor Wi-Fi required info

Instead of using an invisible TextView in the layout itself, make the
required info a list header. This paves way for using the Setup
Wizard library by including all the required contents in the ListView
itself.

The required info is not shown since Lollipop, but can be tested with
    adb shell am start -a "com.android.net.wifi.SETUP_WIFI_NETWORK" \
            --es theme material_light \
            --ez useImmersiveMode true \
            --ez wifi_show_wifi_required_info true

Bug: 19698532
Change-Id: I5a7da726b2f49af7dd755b41c73e1a1b4349699c
This commit is contained in:
Maurice Lam
2015-03-05 11:20:47 -08:00
parent bc614dfcb5
commit b484340e3d
6 changed files with 30 additions and 37 deletions

View File

@@ -37,15 +37,6 @@
</FrameLayout> </FrameLayout>
<TextView
android:id="@+id/wifi_required_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/wifi_required_info_text"
android:visibility="gone" />
<ListView <ListView
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -53,15 +53,6 @@
android:elevation="@dimen/setup_wizard_card_elevation" android:elevation="@dimen/setup_wizard_card_elevation"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:id="@+id/wifi_required_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:text="@string/wifi_required_info_text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="gone" />
<ListView <ListView
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -51,15 +51,6 @@
android:elevation="@dimen/setup_wizard_card_elevation" android:elevation="@dimen/setup_wizard_card_elevation"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:id="@+id/wifi_required_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dp"
android:text="@string/wifi_required_info_text"
android:textAppearance="?android:attr/textAppearanceMedium"
android:visibility="gone" />
<ListView <ListView
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -22,15 +22,6 @@
android:layout_height="match_parent" android:layout_height="match_parent"
android:orientation="vertical"> android:orientation="vertical">
<TextView
android:id="@+id/wifi_required_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="6dip"
android:textAppearance="?android:attr/textAppearanceMedium"
android:text="@string/wifi_required_info_text"
android:visibility="gone" />
<com.android.settings.widget.StickyHeaderListView <com.android.settings.widget.StickyHeaderListView
android:id="@android:id/list" android:id="@android:id/list"
android:layout_width="match_parent" android:layout_width="match_parent"

View File

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<!--
Copyright (C) 2015 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.
-->
<TextView xmlns:android="http://schemas.android.com/apk/res/android"
android:id="@+id/wifi_required_info"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingTop="@dimen/setup_wizard_margin_top"
android:paddingBottom="6dip"
android:paddingStart="@dimen/setup_wizard_margin_sides"
android:paddingEnd="@dimen/setup_wizard_margin_sides"
android:text="@string/wifi_required_info_text"
android:textAppearance="@style/TextAppearance.SetupWizardDescription" />

View File

@@ -73,7 +73,9 @@ public class WifiSettingsForSetupWizard extends WifiSettings {
final Intent intent = getActivity().getIntent(); final Intent intent = getActivity().getIntent();
if (intent.getBooleanExtra(EXTRA_SHOW_WIFI_REQUIRED_INFO, false)) { if (intent.getBooleanExtra(EXTRA_SHOW_WIFI_REQUIRED_INFO, false)) {
view.findViewById(R.id.wifi_required_info).setVisibility(View.VISIBLE); final View requiredInfo =
inflater.inflate(R.layout.setup_wifi_required_info, list, false);
list.addHeaderView(requiredInfo, null, false);
} }
return view; return view;