Revise layout for Wifi Setup in XLarge screen

- revise xml for new layout
- introduce padding View objects for resizing screen when
  software keyboard is shown.
- We now don't show the detailed status of Wi-Fi module anymore
  in SetupWizard flow (like "disconnected", "connecting", etc.)
- remove Forget button and relevant code.

Bug: 3347865
Change-Id: Ieab3246f06ee73af59e247b3f9f31c7570efc71f
This commit is contained in:
Daisuke Miyakawa
2011-01-12 21:19:24 -08:00
parent 3b9b6533a5
commit 14cbcb7fe8
7 changed files with 308 additions and 272 deletions

View File

@@ -19,46 +19,43 @@
android:orientation="horizontal" android:orientation="horizontal"
android:layout_width="fill_parent" android:layout_width="fill_parent"
android:layout_height="fill_parent" android:layout_height="fill_parent"
android:paddingTop="120dip" android:paddingTop="60dip"
android:paddingLeft="128dip" android:paddingLeft="128dip"
android:paddingRight="128dip" android:paddingRight="128dip"
android:paddingBottom="0dip" > android:paddingBottom="0dip" >
<RelativeLayout <FrameLayout
android:id="@+id/title_bar" android:id="@+id/top_padding_layout"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="48dip"
android:layout_alignParentTop="true"> android:layout_alignParentTop="true">
<!-- Set to gone when software keyboard appears -->
<View
android:id="@+id/top_padding"
android:layout_width="match_parent"
android:layout_height="94dip" />
</FrameLayout>
<TextView <TextView
android:id="@+id/wifi_setup_title" android:id="@+id/wifi_setup_title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="48dip"
android:layout_alignParentLeft="true" android:layout_alignParentLeft="true"
android:layout_centerVertical="true" android:layout_centerVertical="true"
android:layout_marginLeft="16dip" android:layout_marginLeft="16dip"
android:layout_below="@id/top_padding_layout"
android:textSize="30dip" android:textSize="30dip"
android:textColor="#FF99cc00" android:textColor="#ff99cc00"
android:text="@string/wifi_setup_title"/> android:text="@string/wifi_setup_title"
android:gravity="bottom"/>
<TextView
android:id="@+id/scanning_progress_text"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentRight="true"
android:layout_centerVertical="true"
android:layout_marginRight="16dip"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="#6699cc00" />
</RelativeLayout>
<!-- Divider --> <!-- Divider -->
<RelativeLayout <RelativeLayout
android:id="@+id/top_divider" android:id="@+id/top_divider"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_below="@id/title_bar"> android:layout_below="@id/wifi_setup_title">
<ProgressBar <ProgressBar
android:id="@+id/scanning_progress_bar" android:id="@+id/scanning_progress_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
@@ -66,35 +63,19 @@
style="?android:attr/progressBarStyleHorizontal" /> style="?android:attr/progressBarStyleHorizontal" />
</RelativeLayout> </RelativeLayout>
<TextView <RelativeLayout
android:id="@+id/wifi_setup_status"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@+id/top_divider"
android:layout_alignParentLeft="true"
android:layout_marginLeft="16dip"
android:layout_marginTop="16dip"
android:layout_marginBottom="0dip"
android:text="@string/wifi_setup_status_select_network"
android:textAppearance="?android:attr/textAppearanceMedium" />
<FrameLayout
android:id="@+id/content" android:id="@+id/content"
android:layout_width="wrap_content" android:layout_width="716dip"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:minHeight="138dip" android:layout_below="@id/top_divider"
android:layout_below="@+id/wifi_setup_status" android:layout_centerHorizontal="true"
android:layout_alignParentLeft="true" android:layout_marginTop="10dip"
android:layout_marginTop="0dip"
android:layout_marginLeft="16dip"
android:layout_marginRight="16dip"
android:layout_marginBottom="0dip"> android:layout_marginBottom="0dip">
<FrameLayout <FrameLayout
android:id="@+id/wifi_setup" android:id="@+id/wifi_setup"
android:layout_width="416dip" android:layout_width="match_parent"
android:layout_height="383dip" android:layout_height="360dip">
android:paddingTop="16dip">
<fragment <fragment
class="com.android.settings.wifi.WifiSettings" class="com.android.settings.wifi.WifiSettings"
android:id="@+id/wifi_setup_fragment" android:id="@+id/wifi_setup_fragment"
@@ -103,42 +84,65 @@
</FrameLayout> </FrameLayout>
<FrameLayout <FrameLayout
android:id="@+id/wifi_config_ui" android:id="@+id/wifi_config_ui"
android:layout_width="416dip" android:layout_width="wrap_content"
android:minWidth="406dip"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:paddingTop="16dip" android:minHeight="176dip"
android:layout_alignParentLeft="true"
android:visibility="gone" /> android:visibility="gone" />
</FrameLayout> <View
android:id="@+id/wifi_config_padding"
android:layout_width="match_parent"
android:layout_height="360dip"
android:visibility="gone" />
</RelativeLayout>
<!-- Divider -->
<View
android:id="@+id/bottom_divider"
android:layout_width="match_parent"
android:layout_height="3dip"
android:layout_marginBottom="16dip"
android:layout_below="@id/content"
android:layout_alignLeft="@id/content"
android:background="@color/divider_color" /> <!-- TODO: fix this -->
<RelativeLayout
android:id="@+id/bottom_buttons"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_below="@id/bottom_divider"
android:layout_alignLeft="@id/bottom_divider"
android:layout_alignParentRight="true"
android:layout_alignParentBottom="true">
<Button
android:id="@+id/wifi_setup_add_network"
style="@style/setup_wizard_button"
android:layout_alignParentLeft="true"
android:text="@string/wifi_setup_add_network"
android:enabled="false" />
<LinearLayout <LinearLayout
android:id="@+id/right_buttons"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"
android:layout_alignParentRight="true" android:layout_alignParentRight="true"
android:layout_marginRight="16dip" android:orientation="horizontal">
android:layout_alignBottom="@+id/content"
android:layout_marginBottom="16dip">
<Button android:id="@+id/wifi_setup_forget" <!-- This misleading name is for keeping consistency between non-XL
layouts -->
<Button android:id="@+id/wifi_setup_cancel"
style="@style/setup_wizard_button" style="@style/setup_wizard_button"
android:layout_marginLeft="16dip" android:text="@string/wifi_setup_back"
android:text="@string/wifi_setup_forget"
android:visibility="gone" /> android:visibility="gone" />
<Button android:id="@+id/wifi_setup_connect" <Button android:id="@+id/wifi_setup_connect"
style="@style/setup_wizard_button" style="@style/setup_wizard_button"
android:layout_marginTop="96dip"
android:layout_marginLeft="16dip" android:layout_marginLeft="16dip"
android:text="@string/wifi_setup_connect" android:text="@string/wifi_setup_connect"
android:enabled="false" android:enabled="false"
android:visibility="gone" /> android:visibility="gone" />
<Button android:id="@+id/wifi_setup_add_network"
style="@style/setup_wizard_button"
android:layout_marginLeft="16dip"
android:text="@string/wifi_setup_add_network"
android:enabled="false" />
<Button android:id="@+id/wifi_setup_refresh_list" <Button android:id="@+id/wifi_setup_refresh_list"
style="@style/setup_wizard_button" style="@style/setup_wizard_button"
android:layout_marginLeft="16dip" android:layout_marginLeft="16dip"
@@ -147,18 +151,9 @@
<Button android:id="@+id/wifi_setup_skip_or_next" <Button android:id="@+id/wifi_setup_skip_or_next"
style="@style/setup_wizard_button" style="@style/setup_wizard_button"
android:layout_marginTop="96dip"
android:layout_marginLeft="16dip" android:layout_marginLeft="16dip"
android:text="@string/wifi_setup_skip" android:text="@string/wifi_setup_skip"
android:enabled="false" /> android:enabled="false" />
</LinearLayout> </LinearLayout>
</RelativeLayout>
<!-- This misleading name is for keeping consistency between non-XL layouts -->
<Button android:id="@+id/wifi_setup_cancel"
style="@style/setup_wizard_button"
android:layout_marginBottom="16dip"
android:layout_alignBottom="@+id/content"
android:layout_toLeftOf="@id/right_buttons"
android:text="@string/wifi_setup_back"
android:visibility="gone" />
</RelativeLayout> </RelativeLayout>

View File

@@ -16,13 +16,15 @@
<!-- All ids in this layout must be in wifi_dialog.xml --> <!-- All ids in this layout must be in wifi_dialog.xml -->
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical" android:orientation="vertical"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="fill_parent"> android:layout_height="match_parent">
<!-- TODO: remove this once we confirm it is needless -->
<LinearLayout <LinearLayout
android:id="@+id/wifi_general_info" android:id="@+id/wifi_general_info"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"> android:orientation="vertical"
android:visibility="gone">
<TextView android:id="@+id/title" <TextView android:id="@+id/title"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
@@ -43,72 +45,76 @@
<!-- UI components that should be shown appropriately --> <!-- UI components that should be shown appropriately -->
<LinearLayout android:id="@+id/wps_fields" <LinearLayout android:id="@+id/wps_fields"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_wps_pin" /> android:text="@string/wifi_wps_pin" />
<EditText android:id="@+id/wps_pin" <EditText android:id="@+id/wps_pin"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textPassword" /> android:inputType="textPassword" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/security_fields" <LinearLayout android:id="@+id/security_fields"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView android:layout_width="fill_parent" <LinearLayout android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<TextView android:layout_width="wrap_content"
android:minWidth="88dip"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_password" /> android:text="@string/wifi_password" />
<EditText android:id="@+id/password" <EditText android:id="@+id/password"
android:layout_width="fill_parent" android:layout_width="320dip"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:password="true" /> android:password="true" />
</LinearLayout>
<CheckBox android:id="@+id/show_password" <CheckBox android:id="@+id/show_password"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_show_password" /> android:text="@string/wifi_show_password" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/type" <LinearLayout android:id="@+id/type"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView android:layout_width="fill_parent" <TextView android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_ssid" /> android:text="@string/wifi_ssid" />
<EditText android:id="@+id/ssid" <EditText android:id="@+id/ssid"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<TextView android:layout_width="fill_parent" <TextView android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_security" /> android:text="@string/wifi_security" />
<Spinner android:id="@+id/security" <Spinner android:id="@+id/security"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:prompt="@string/wifi_security" android:prompt="@string/wifi_security"
android:entries="@array/wifi_security" /> android:entries="@array/wifi_security" />
</LinearLayout> <!-- android:id="@+id/type" --> </LinearLayout> <!-- android:id="@+id/type" -->
<LinearLayout android:id="@+id/eap_not_supported" <LinearLayout android:id="@+id/eap_not_supported"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginTop="32dip" android:minHeight="360dip"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView android:layout_width="match_parent" <TextView android:layout_width="match_parent"
@@ -127,23 +133,23 @@
android:visibility="gone"> android:visibility="gone">
<LinearLayout android:id="@+id/info" <LinearLayout android:id="@+id/info"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical"/> android:orientation="vertical"/>
<LinearLayout android:id="@+id/setup_fields" <LinearLayout android:id="@+id/setup_fields"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_network_setup" /> android:text="@string/wifi_network_setup" />
<Spinner android:id="@+id/network_setup" <Spinner android:id="@+id/network_setup"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:prompt="@string/wifi_network_setup" android:prompt="@string/wifi_network_setup"
android:entries="@array/wifi_network_setup" /> android:entries="@array/wifi_network_setup" />
@@ -152,18 +158,18 @@
<!-- <!--
<LinearLayout android:id="@+id/wps_fields" <LinearLayout android:id="@+id/wps_fields"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_wps_pin" /> android:text="@string/wifi_wps_pin" />
<EditText android:id="@+id/wps_pin" <EditText android:id="@+id/wps_pin"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textPassword" /> android:inputType="textPassword" />
@@ -171,225 +177,225 @@
<!-- android:id="@+id/security_fields" --> <!-- android:id="@+id/security_fields" -->
<LinearLayout <LinearLayout
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<LinearLayout android:id="@+id/eap" <LinearLayout android:id="@+id/eap"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_eap_method" /> android:text="@string/wifi_eap_method" />
<Spinner android:id="@+id/method" <Spinner android:id="@+id/method"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:prompt="@string/wifi_eap_method" android:prompt="@string/wifi_eap_method"
android:entries="@array/wifi_eap_method" /> android:entries="@array/wifi_eap_method" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/please_select_phase2" /> android:text="@string/please_select_phase2" />
<Spinner android:id="@+id/phase2" <Spinner android:id="@+id/phase2"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:prompt="@string/please_select_phase2" android:prompt="@string/please_select_phase2"
android:entries="@array/wifi_phase2_entries" /> android:entries="@array/wifi_phase2_entries" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_eap_ca_cert" /> android:text="@string/wifi_eap_ca_cert" />
<Spinner android:id="@+id/ca_cert" <Spinner android:id="@+id/ca_cert"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:prompt="@string/wifi_eap_ca_cert" /> android:prompt="@string/wifi_eap_ca_cert" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_eap_user_cert" /> android:text="@string/wifi_eap_user_cert" />
<Spinner android:id="@+id/user_cert" <Spinner android:id="@+id/user_cert"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:prompt="@string/wifi_eap_user_cert" /> android:prompt="@string/wifi_eap_user_cert" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_eap_identity" /> android:text="@string/wifi_eap_identity" />
<EditText android:id="@+id/identity" <EditText android:id="@+id/identity"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_eap_anonymous" /> android:text="@string/wifi_eap_anonymous" />
<EditText android:id="@+id/anonymous" <EditText android:id="@+id/anonymous"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
</LinearLayout> <!-- android:id="@+id/eap" --> </LinearLayout> <!-- android:id="@+id/eap" -->
<!-- <TextView android:layout_width="fill_parent" <!-- <TextView android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_password" /> android:text="@string/wifi_password" />
<EditText android:id="@+id/password" <EditText android:id="@+id/password"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:password="true" /> android:password="true" />
<CheckBox android:id="@+id/show_password" <CheckBox android:id="@+id/show_password"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_show_password" /> --> android:text="@string/wifi_show_password" /> -->
</LinearLayout> <!-- android:id="@+id/security_fields" --> </LinearLayout> <!-- android:id="@+id/security_fields" -->
<LinearLayout android:id="@+id/ip_fields" <LinearLayout android:id="@+id/ip_fields"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_ip_settings" /> android:text="@string/wifi_ip_settings" />
<Spinner android:id="@+id/ip_settings" <Spinner android:id="@+id/ip_settings"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:prompt="@string/wifi_ip_settings" android:prompt="@string/wifi_ip_settings"
android:entries="@array/wifi_ip_settings" /> android:entries="@array/wifi_ip_settings" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/staticip" <LinearLayout android:id="@+id/staticip"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_ip_address" /> android:text="@string/wifi_ip_address" />
<EditText android:id="@+id/ipaddress" <EditText android:id="@+id/ipaddress"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_gateway" /> android:text="@string/wifi_gateway" />
<EditText android:id="@+id/gateway" <EditText android:id="@+id/gateway"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_network_prefix_length" /> android:text="@string/wifi_network_prefix_length" />
<EditText android:id="@+id/network_prefix_length" <EditText android:id="@+id/network_prefix_length"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_dns1" /> android:text="@string/wifi_dns1" />
<EditText android:id="@+id/dns1" <EditText android:id="@+id/dns1"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<TextView <TextView
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/wifi_dns2" /> android:text="@string/wifi_dns2" />
<EditText android:id="@+id/dns2" <EditText android:id="@+id/dns2"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<LinearLayout android:id="@+id/proxy_settings_fields" <LinearLayout android:id="@+id/proxy_settings_fields"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView android:id="@+id/proxy_settings_title" <TextView android:id="@+id/proxy_settings_title"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/proxy_settings_title" /> android:text="@string/proxy_settings_title" />
<Spinner android:id="@+id/proxy_settings" <Spinner android:id="@+id/proxy_settings"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:prompt="@string/proxy_settings_title" android:prompt="@string/proxy_settings_title"
android:entries="@array/wifi_proxy_settings" /> android:entries="@array/wifi_proxy_settings" />
</LinearLayout> </LinearLayout>
<LinearLayout android:id="@+id/proxy_fields" <LinearLayout android:id="@+id/proxy_fields"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:orientation="vertical" android:orientation="vertical"
android:visibility="gone"> android:visibility="gone">
<TextView android:layout_width="fill_parent" <TextView android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/proxy_hostname_label" /> android:text="@string/proxy_hostname_label" />
<EditText android:id="@+id/proxy_hostname" <EditText android:id="@+id/proxy_hostname"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<TextView android:layout_width="fill_parent" <TextView android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/proxy_port_label" /> android:text="@string/proxy_port_label" />
<EditText android:id="@+id/proxy_port" <EditText android:id="@+id/proxy_port"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />
<TextView android:layout_width="fill_parent" <TextView android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:text="@string/proxy_exclusionlist_label" /> android:text="@string/proxy_exclusionlist_label" />
<EditText android:id="@+id/proxy_exclusionlist" <EditText android:id="@+id/proxy_exclusionlist"
android:layout_width="fill_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:singleLine="true" android:singleLine="true"
android:inputType="textNoSuggestions" /> android:inputType="textNoSuggestions" />

View File

@@ -2962,8 +2962,22 @@ found in the list of installed applications.</string>
<string name="sound_category_feedback_title">Feedback</string> <string name="sound_category_feedback_title">Feedback</string>
<!-- Wifi Setup For Setup Wizard with XL screen --> <!-- Wifi Setup For Setup Wizard with XL screen -->
<!-- Title shown in Wifi Setup For Setup Wizard with XL screen --> <!-- Title shown in Wifi Setup Wizard with XL screen -->
<string name="wifi_setup_title">Wi-Fi setup</string> <string name="wifi_setup_title">Wi-Fi setup</string>
<!-- Title shown in Wifi Setup Wizard with XL screen when
a user is configuring password for a network.
The argument should be the name of the network.
[CHAR LIMIT=50] -->
<string name="wifi_setup_title_editing_network">Connect to Wi-Fi network <xliff:g id="network_name" example="Happy Mobile">%s</xliff:g></string>
<!-- Title shown in Wifi Setup For Setup Wizard with XL screen when
the device is connecting a network the user specified.
The argument should be the name of the network.
[CHAR LIMIT=50] -->
<string name="wifi_setup_title_connecting_network">Connecting to Wi-Fi network <xliff:g id="network_name" example="Happy Mobile">%s</xliff:g>...</string>
<!-- Title shown in Wifi Setup For Setup Wizard with XL screen when
a user is adding a network.
[CHAR LIMIT=50] -->
<string name="wifi_setup_title_add_network">Add a network</string>
<!-- Text message shown when Wifi is not connected. <!-- Text message shown when Wifi is not connected.
Used in Wifi Setup For Setup Wizard with XL screen. --> Used in Wifi Setup For Setup Wizard with XL screen. -->
<string name="wifi_setup_not_connected">Not connected</string> <string name="wifi_setup_not_connected">Not connected</string>

View File

@@ -22,7 +22,7 @@ import android.widget.Button;
/** /**
* Foundation interface glues between Activities and UIs like * Foundation interface glues between Activities and UIs like
* {@link WifiDialog} or {@link WifiConfigPreference}. * {@link WifiDialog} or {@link WifiConfigUiForSetupWizardXL}.
*/ */
public interface WifiConfigUiBase { public interface WifiConfigUiBase {
public Context getContext(); public Context getContext();

View File

@@ -18,7 +18,6 @@ package com.android.settings.wifi;
import com.android.settings.R; import com.android.settings.R;
import android.app.Activity;
import android.content.Context; import android.content.Context;
import android.os.Handler; import android.os.Handler;
import android.util.Log; import android.util.Log;
@@ -38,16 +37,17 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
private static final String TAG = "SetupWizard"; private static final String TAG = "SetupWizard";
private Button mConnectButton; private Button mConnectButton;
private Button mForgetButton;
private Button mCancelButton; private Button mCancelButton;
private final Activity mActivity; private final WifiSettingsForSetupWizardXL mActivity;
private View mView; private View mView;
private WifiConfigController mController; private WifiConfigController mController;
private AccessPoint mAccessPoint; private AccessPoint mAccessPoint;
private boolean mEdit; private boolean mEdit;
private Handler mHandler = new Handler(); private Handler mHandler = new Handler();
private final InputMethodManager mInputMethodManager;
private LayoutInflater mInflater; private LayoutInflater mInflater;
/** /**
@@ -58,10 +58,10 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
* @param edit * @param edit
*/ */
public WifiConfigUiForSetupWizardXL( public WifiConfigUiForSetupWizardXL(
Activity activity, ViewGroup parent, AccessPoint accessPoint, boolean edit) { WifiSettingsForSetupWizardXL activity, ViewGroup parent,
AccessPoint accessPoint, boolean edit) {
mActivity = activity; mActivity = activity;
mConnectButton = (Button)activity.findViewById(R.id.wifi_setup_connect); mConnectButton = (Button)activity.findViewById(R.id.wifi_setup_connect);
mForgetButton = (Button)activity.findViewById(R.id.wifi_setup_forget);
mCancelButton = (Button)activity.findViewById(R.id.wifi_setup_cancel); mCancelButton = (Button)activity.findViewById(R.id.wifi_setup_cancel);
mAccessPoint = accessPoint; mAccessPoint = accessPoint;
mEdit = edit; mEdit = edit;
@@ -70,12 +70,14 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
mView = mInflater.inflate(R.layout.wifi_config_ui_for_setup_wizard, parent, true); mView = mInflater.inflate(R.layout.wifi_config_ui_for_setup_wizard, parent, true);
mController = new WifiConfigController(this, mView, mAccessPoint, edit); mController = new WifiConfigController(this, mView, mAccessPoint, edit);
// Assumes R.id.password is inside security_fields. mInputMethodManager = (InputMethodManager)
// TODO: confirm it is ok to assume R.id.password is the only EditText to be focused, and activity.getSystemService(Context.INPUT_METHOD_SERVICE);
// R.id.security_fields is the only parent for possible EditTexts. Possibly we need to
// check parentand detect visibility manually.
if (mView.findViewById(R.id.security_fields).getVisibility() == View.VISIBLE) { if (mView.findViewById(R.id.security_fields).getVisibility() == View.VISIBLE) {
requestFocusAndShowKeyboard(R.id.password); requestFocusAndShowKeyboard(R.id.password);
} else if (mView.findViewById(R.id.type).getVisibility() == View.VISIBLE) {
// Add Network flow.
requestFocusAndShowKeyboard(R.id.ssid);
} }
} }
@@ -89,6 +91,9 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
Log.w(TAG, "password field to be focused not found."); Log.w(TAG, "password field to be focused not found.");
} else if (!(viewToBeFocused instanceof EditText)) { } else if (!(viewToBeFocused instanceof EditText)) {
Log.w(TAG, "password field is not EditText"); Log.w(TAG, "password field is not EditText");
} else {
if (viewToBeFocused.isFocused()) {
mInputMethodManager.showSoftInput(viewToBeFocused, 0);
} else { } else {
// After acquiring the focus, we show software keyboard. // After acquiring the focus, we show software keyboard.
viewToBeFocused.setOnFocusChangeListener(this); viewToBeFocused.setOnFocusChangeListener(this);
@@ -100,6 +105,7 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
} }
} }
} }
}
public View getView() { public View getView() {
return mView; return mView;
@@ -131,7 +137,7 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
@Override @Override
public Button getForgetButton() { public Button getForgetButton() {
return mForgetButton; return null;
} }
@Override @Override
@@ -143,16 +149,11 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
public void setSubmitButton(CharSequence text) { public void setSubmitButton(CharSequence text) {
mConnectButton.setVisibility(View.VISIBLE); mConnectButton.setVisibility(View.VISIBLE);
mConnectButton.setText(text); mConnectButton.setText(text);
// test
mForgetButton.setVisibility(View.GONE);
} }
@Override @Override
public void setForgetButton(CharSequence text) { public void setForgetButton(CharSequence text) {
// In XL setup screen, we won't show Forget button for simplifying the UI. // In XL setup screen, we won't show Forget button for simplifying the UI.
// mForgetButton.setVisibility(View.VISIBLE);
// mForgetButton.setText(text);
} }
@Override @Override
@@ -177,12 +178,9 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
Log.d(TAG, "Ignoring setTitle"); Log.d(TAG, "Ignoring setTitle");
} }
private static class FocusRunnable implements Runnable { private class FocusRunnable implements Runnable {
final InputMethodManager mInputMethodManager;
final View mViewToBeFocused; final View mViewToBeFocused;
public FocusRunnable(Context context, View viewToBeFocused) { public FocusRunnable(View viewToBeFocused) {
mInputMethodManager = (InputMethodManager)
context.getSystemService(Context.INPUT_METHOD_SERVICE);
mViewToBeFocused = viewToBeFocused; mViewToBeFocused = viewToBeFocused;
} }
@@ -191,7 +189,9 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
// mInputMethodManager.focusIn(mViewToBeFocused); // mInputMethodManager.focusIn(mViewToBeFocused);
final boolean showSoftInputResult = final boolean showSoftInputResult =
mInputMethodManager.showSoftInput(mViewToBeFocused, 0); mInputMethodManager.showSoftInput(mViewToBeFocused, 0);
if (!showSoftInputResult) { if (showSoftInputResult) {
mActivity.setPaddingVisibility(View.GONE);
} else {
Log.w(TAG, "Failed to show software keyboard "); Log.w(TAG, "Failed to show software keyboard ");
} }
} }
@@ -201,7 +201,7 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
public void onFocusChange(View view, boolean hasFocus) { public void onFocusChange(View view, boolean hasFocus) {
view.setOnFocusChangeListener(null); view.setOnFocusChangeListener(null);
if (hasFocus) { if (hasFocus) {
mHandler.post(new FocusRunnable(mActivity, view)); mHandler.post(new FocusRunnable(view));
} }
} }
} }

View File

@@ -567,7 +567,7 @@ public class WifiSettings extends SettingsPreferenceFragment
public void onClick(DialogInterface dialogInterface, int button) { public void onClick(DialogInterface dialogInterface, int button) {
if (mInXlSetupWizard) { if (mInXlSetupWizard) {
if (button == WifiDialog.BUTTON_FORGET && mSelectedAccessPoint != null) { if (button == WifiDialog.BUTTON_FORGET && mSelectedAccessPoint != null) {
((WifiSettingsForSetupWizardXL)getActivity()).onForgetButtonPressed(); forget();
} else if (button == WifiDialog.BUTTON_SUBMIT) { } else if (button == WifiDialog.BUTTON_SUBMIT) {
((WifiSettingsForSetupWizardXL)getActivity()).onConnectButtonPressed(); ((WifiSettingsForSetupWizardXL)getActivity()).onConnectButtonPressed();
} }

View File

@@ -29,10 +29,10 @@ import android.os.Handler;
import android.preference.PreferenceCategory; import android.preference.PreferenceCategory;
import android.text.TextUtils; import android.text.TextUtils;
import android.util.Log; import android.util.Log;
import android.view.View;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View.OnClickListener;
import android.view.ContextMenu; import android.view.ContextMenu;
import android.view.ContextMenu.ContextMenuInfo;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup; import android.view.ViewGroup;
import android.view.Window; import android.view.Window;
import android.view.WindowManager; import android.view.WindowManager;
@@ -69,16 +69,31 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
private WifiManager mWifiManager; private WifiManager mWifiManager;
private TextView mProgressText; /**
* Used for resizing a padding above title. Hiden when software keyboard is shown.
*/
private View mTopPadding;
/**
* Used for resizing a padding inside Config UI. Hiden when software keyboard is shown.
*/
private View mWifiConfigPadding;
private TextView mTitleView;
/**
* The name of a network currently connecting, or trying to connect.
* This may be empty ("") at first, and updated when configuration is changed.
*/
private CharSequence mNetworkName = "";
private CharSequence mEditingTitle;
private ProgressBar mProgressBar; private ProgressBar mProgressBar;
private WifiSettings mWifiSettings; private WifiSettings mWifiSettings;
private TextView mStatusText;
private Button mAddNetworkButton; private Button mAddNetworkButton;
private Button mRefreshButton; private Button mRefreshButton;
private Button mSkipOrNextButton; private Button mSkipOrNextButton;
private Button mConnectButton; private Button mConnectButton;
private Button mForgetButton;
private Button mBackButton; private Button mBackButton;
// true when a user already pressed "Connect" button and waiting for connection. // true when a user already pressed "Connect" button and waiting for connection.
@@ -130,14 +145,11 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
} }
public void setup() { public void setup() {
mProgressText = (TextView)findViewById(R.id.scanning_progress_text); mTitleView = (TextView)findViewById(R.id.wifi_setup_title);
mProgressBar = (ProgressBar)findViewById(R.id.scanning_progress_bar); mProgressBar = (ProgressBar)findViewById(R.id.scanning_progress_bar);
mProgressBar.setMax(2); mProgressBar.setMax(2);
mStatusText = (TextView)findViewById(R.id.wifi_setup_status);
mProgressText.setText(Summary.get(this, DetailedState.SCANNING));
mProgressBar.setIndeterminate(true); mProgressBar.setIndeterminate(true);
mStatusText.setText(R.string.wifi_setup_status_scanning);
mAddNetworkButton = (Button)findViewById(R.id.wifi_setup_add_network); mAddNetworkButton = (Button)findViewById(R.id.wifi_setup_add_network);
mAddNetworkButton.setOnClickListener(this); mAddNetworkButton.setOnClickListener(this);
@@ -147,11 +159,12 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
mSkipOrNextButton.setOnClickListener(this); mSkipOrNextButton.setOnClickListener(this);
mConnectButton = (Button)findViewById(R.id.wifi_setup_connect); mConnectButton = (Button)findViewById(R.id.wifi_setup_connect);
mConnectButton.setOnClickListener(this); mConnectButton.setOnClickListener(this);
mForgetButton = (Button)findViewById(R.id.wifi_setup_forget);
mForgetButton.setOnClickListener(this);
mBackButton = (Button)findViewById(R.id.wifi_setup_cancel); mBackButton = (Button)findViewById(R.id.wifi_setup_cancel);
mBackButton.setOnClickListener(this); mBackButton.setOnClickListener(this);
mTopPadding = findViewById(R.id.top_padding);
mWifiConfigPadding = findViewById(R.id.wifi_config_padding);
// At first, Wifi module doesn't return SCANNING state (it's too early), so we manually // At first, Wifi module doesn't return SCANNING state (it's too early), so we manually
// show it. // show it.
showScanningStatus(); showScanningStatus();
@@ -163,8 +176,8 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
mRefreshButton.setVisibility(View.VISIBLE); mRefreshButton.setVisibility(View.VISIBLE);
mSkipOrNextButton.setVisibility(View.VISIBLE); mSkipOrNextButton.setVisibility(View.VISIBLE);
mConnectButton.setVisibility(View.GONE); mConnectButton.setVisibility(View.GONE);
mForgetButton.setVisibility(View.GONE);
mBackButton.setVisibility(View.GONE); mBackButton.setVisibility(View.GONE);
setPaddingVisibility(View.VISIBLE, View.GONE);
} }
@Override @Override
@@ -188,9 +201,6 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
} else if (view == mConnectButton) { } else if (view == mConnectButton) {
if (DEBUG) Log.d(TAG, "Connect button pressed"); if (DEBUG) Log.d(TAG, "Connect button pressed");
onConnectButtonPressed(); onConnectButtonPressed();
} else if (view == mForgetButton) {
if (DEBUG) Log.d(TAG, "Forget button pressed");
onForgetButtonPressed();
} else if (view == mBackButton) { } else if (view == mBackButton) {
if (DEBUG) Log.d(TAG, "Back button pressed"); if (DEBUG) Log.d(TAG, "Back button pressed");
onBackButtonPressed(); onBackButtonPressed();
@@ -222,7 +232,6 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
// no visible network on the list. // no visible network on the list.
if (mWifiSettings.getAccessPointsCount() == 0) { if (mWifiSettings.getAccessPointsCount() == 0) {
mProgressBar.setIndeterminate(true); mProgressBar.setIndeterminate(true);
mProgressText.setText(Summary.get(this, DetailedState.SCANNING));
} else { } else {
// Users already connected to a network, or see available networks. // Users already connected to a network, or see available networks.
mProgressBar.setIndeterminate(false); mProgressBar.setIndeterminate(false);
@@ -234,14 +243,14 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
break; break;
} }
case CONNECTED: { case CONNECTED: {
hideSoftwareKeyboard();
// If the device is already connected to a wifi without users' "Connect" request, // If the device is already connected to a wifi without users' "Connect" request,
// this can be false here. We want to treat it as "after connect action". // this can be false here. We want to treat it as "after connect action".
mAfterConnectAction = true; mAfterConnectAction = true;
mProgressBar.setIndeterminate(false); mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(2); mProgressBar.setProgress(2);
mProgressText.setText(Summary.get(this, state));
mStatusText.setText(R.string.wifi_setup_status_proceed_to_next);
mConnectButton.setVisibility(View.GONE); mConnectButton.setVisibility(View.GONE);
mAddNetworkButton.setVisibility(View.GONE); mAddNetworkButton.setVisibility(View.GONE);
@@ -250,8 +259,6 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
mSkipOrNextButton.setVisibility(View.VISIBLE); mSkipOrNextButton.setVisibility(View.VISIBLE);
mSkipOrNextButton.setEnabled(true); mSkipOrNextButton.setEnabled(true);
mHandler.removeCallbacks(mSkipButtonEnabler); mHandler.removeCallbacks(mSkipButtonEnabler);
mProgressText.setText(Summary.get(this, state));
break; break;
} }
default: // DISCONNECTED, FAILED default: // DISCONNECTED, FAILED
@@ -264,31 +271,34 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
mProgressBar.setIndeterminate(false); mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(0); mProgressBar.setProgress(0);
mProgressText.setText(stateString);
mAddNetworkButton.setEnabled(true); mAddNetworkButton.setEnabled(true);
mRefreshButton.setEnabled(true); mRefreshButton.setEnabled(true);
} }
private void showConnectingStatus() { private void showConnectingStatus() {
// We save this title and show it when authentication failed.
mEditingTitle = mTitleView.getText();
showTitleForNetworkEditing();
mProgressBar.setIndeterminate(false); mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(1); mProgressBar.setProgress(1);
mStatusText.setText(R.string.wifi_setup_status_connecting); setPaddingVisibility(View.VISIBLE);
mProgressText.setText(Summary.get(this, DetailedState.CONNECTING)); }
private void showTitleForNetworkEditing() {
if (TextUtils.isEmpty(mNetworkName) && mWifiConfig != null) {
mNetworkName = mWifiConfig.getController().getConfig().SSID;
}
mTitleView.setText(getString(R.string.wifi_setup_title_editing_network, mNetworkName));
} }
private void showScanningStatus() { private void showScanningStatus() {
mProgressBar.setIndeterminate(true); mProgressBar.setIndeterminate(true);
((Button)findViewById(R.id.wifi_setup_add_network)).setEnabled(false); ((Button)findViewById(R.id.wifi_setup_add_network)).setEnabled(false);
((Button)findViewById(R.id.wifi_setup_refresh_list)).setEnabled(false); ((Button)findViewById(R.id.wifi_setup_refresh_list)).setEnabled(false);
mProgressText.setText(Summary.get(this, DetailedState.SCANNING));
mStatusText.setText(R.string.wifi_setup_status_scanning);
} }
private void onAddNetworkButtonPressed() { private void onAddNetworkButtonPressed() {
// onConfigUiShown() will be called.
mWifiSettings.onAddNetworkPressed(); mWifiSettings.onAddNetworkPressed();
} }
/** /**
@@ -318,35 +328,40 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
mWifiConfig = new WifiConfigUiForSetupWizardXL(this, parent, selectedAccessPoint, edit); mWifiConfig = new WifiConfigUiForSetupWizardXL(this, parent, selectedAccessPoint, edit);
final View view = mWifiConfig.getView(); final View view = mWifiConfig.getView();
if (selectedAccessPoint != null) { if (selectedAccessPoint != null) {
view.findViewById(R.id.wifi_general_info).setVisibility(View.VISIBLE); mNetworkName = selectedAccessPoint.getTitle().toString();
((TextView)view.findViewById(R.id.title)).setText(selectedAccessPoint.getTitle()); mTitleView.setText(getString(R.string.wifi_setup_title_editing_network, mNetworkName));
((TextView)view.findViewById(R.id.summary)).setText(selectedAccessPoint.getSummary());
} else { } else {
mNetworkName = "";
mTitleView.setText(R.string.wifi_setup_title_add_network);
view.findViewById(R.id.wifi_general_info).setVisibility(View.GONE); view.findViewById(R.id.wifi_general_info).setVisibility(View.GONE);
} }
if (selectedAccessPoint != null && if (selectedAccessPoint != null &&
selectedAccessPoint.security == AccessPoint.SECURITY_NONE) { selectedAccessPoint.security == AccessPoint.SECURITY_NONE) {
mStatusText.setText(R.string.wifi_setup_status_unsecured_network); // onConnectButtonPressed() will change visibility status.
mConnectButton.performClick();
} else if (selectedAccessPoint != null && } else if (selectedAccessPoint != null &&
selectedAccessPoint.security == AccessPoint.SECURITY_EAP) { selectedAccessPoint.security == AccessPoint.SECURITY_EAP) {
mStatusText.setText(R.string.wifi_setup_status_eap_not_supported);
mConnectButton.setVisibility(View.GONE); mConnectButton.setVisibility(View.GONE);
mSkipOrNextButton.setVisibility(View.GONE);
mAddNetworkButton.setVisibility(View.GONE);
mRefreshButton.setVisibility(View.GONE);
mBackButton.setVisibility(View.VISIBLE);
} else { } else {
mStatusText.setText(R.string.wifi_setup_status_edit_network);
mConnectButton.setVisibility(View.VISIBLE); mConnectButton.setVisibility(View.VISIBLE);
}
// WifiConfigController shows Connect button as "Save" when edit==true and a user // WifiConfigController shows Connect button as "Save" when edit==true and a user
// tried to connect the network. // tried to connect the network.
// In SetupWizard, we just show the button as "Connect" instead. // In SetupWizard, we just show the button as "Connect" instead.
mConnectButton.setText(R.string.wifi_connect); mConnectButton.setText(R.string.wifi_connect);
mSkipOrNextButton.setVisibility(View.GONE);
mAddNetworkButton.setVisibility(View.GONE); mAddNetworkButton.setVisibility(View.GONE);
mRefreshButton.setVisibility(View.GONE); mRefreshButton.setVisibility(View.GONE);
mSkipOrNextButton.setVisibility(View.GONE);
mBackButton.setVisibility(View.VISIBLE); mBackButton.setVisibility(View.VISIBLE);
} }
}
// May be called when user press "connect" button in WifiDialog // May be called when user press "connect" button in WifiDialog
/* package */ void onConnectButtonPressed() { /* package */ void onConnectButtonPressed() {
@@ -388,21 +403,6 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
mRefreshButton.setVisibility(View.GONE); mRefreshButton.setVisibility(View.GONE);
} }
// May be called when user press "forget" button in WifiDialog
/* package */ void onForgetButtonPressed() {
mWifiSettings.forget();
refreshAccessPoints(false);
restoreFirstButtonVisibilityState();
mAddNetworkButton.setEnabled(true);
mRefreshButton.setEnabled(true);
mSkipOrNextButton.setEnabled(true);
mProgressBar.setIndeterminate(false);
mProgressBar.setProgress(0);
mProgressText.setText(getString(R.string.wifi_setup_not_connected));
}
private void onBackButtonPressed() { private void onBackButtonPressed() {
if (mAfterConnectAction) { if (mAfterConnectAction) {
if (DEBUG) Log.d(TAG, "Back button pressed after connect action."); if (DEBUG) Log.d(TAG, "Back button pressed after connect action.");
@@ -421,7 +421,6 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
} else { // During user's Wifi configuration. } else { // During user's Wifi configuration.
mWifiSettings.resumeWifiScan(); mWifiSettings.resumeWifiScan();
mStatusText.setText(R.string.wifi_setup_status_select_network);
restoreFirstButtonVisibilityState(); restoreFirstButtonVisibilityState();
mAddNetworkButton.setEnabled(true); mAddNetworkButton.setEnabled(true);
@@ -470,7 +469,8 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
} }
/** /**
* Called when {@link WifiSettings} received {@link WifiManager#SUPPLICANT_CHANGED_ACTION}. * Called when {@link WifiSettings} received
* {@link WifiManager#SUPPLICANT_STATE_CHANGED_ACTION}.
*/ */
/* package */ void onSupplicantStateChanged(Intent intent) { /* package */ void onSupplicantStateChanged(Intent intent) {
final int errorCode = intent.getIntExtra(WifiManager.EXTRA_SUPPLICANT_ERROR, -1); final int errorCode = intent.getIntExtra(WifiManager.EXTRA_SUPPLICANT_ERROR, -1);
@@ -485,11 +485,17 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
*/ */
private void onAuthenticationFailure() { private void onAuthenticationFailure() {
mAfterConnectAction = false; mAfterConnectAction = false;
mStatusText.setText(R.string.wifi_setup_status_edit_network);
mSkipOrNextButton.setVisibility(View.GONE); mSkipOrNextButton.setVisibility(View.GONE);
mConnectButton.setVisibility(View.VISIBLE); mConnectButton.setVisibility(View.VISIBLE);
mConnectButton.setEnabled(true); mConnectButton.setEnabled(true);
if (!TextUtils.isEmpty(mEditingTitle)) {
mTitleView.setText(mEditingTitle);
} else {
Log.w(TAG, "Title during editing/adding a network was empty.");
showTitleForNetworkEditing();
}
// Restore View status which was tweaked on connection. // Restore View status which was tweaked on connection.
final View wpsFieldView = findViewById(R.id.wps_fields); final View wpsFieldView = findViewById(R.id.wps_fields);
if (wpsFieldView != null) { if (wpsFieldView != null) {
@@ -502,19 +508,34 @@ public class WifiSettingsForSetupWizardXL extends Activity implements OnClickLis
final View passwordView = findViewById(R.id.password); final View passwordView = findViewById(R.id.password);
if (passwordView != null) { if (passwordView != null) {
if (passwordView.isFocused()) { if (passwordView.isFocused()) {
final InputMethodManager inputMethodManager = (InputMethodManager) setPaddingVisibility(View.GONE);
getSystemService(Context.INPUT_METHOD_SERVICE);
inputMethodManager.showSoftInput(passwordView, 0);
} else {
mWifiConfig.requestFocusAndShowKeyboard(R.id.password);
} }
mWifiConfig.requestFocusAndShowKeyboard(R.id.password);
} }
} }
} }
final View typeView = findViewById(R.id.type); final View typeView = findViewById(R.id.type);
if (typeView != null) { if (typeView != null) {
typeView.setVisibility(mPreviousTypeVisibility); typeView.setVisibility(mPreviousTypeVisibility);
if (mPreviousTypeVisibility == View.VISIBLE && mWifiConfig != null) {
final View ssidView = findViewById(R.id.ssid);
if (ssidView != null) {
if (ssidView.isFocused()) {
setPaddingVisibility(View.GONE);
} }
mWifiConfig.requestFocusAndShowKeyboard(R.id.ssid);
}
}
}
}
public void setPaddingVisibility(int visibility) {
setPaddingVisibility(visibility, visibility);
}
private void setPaddingVisibility(int topPaddingVisibility, int configVisibility) {
mTopPadding.setVisibility(topPaddingVisibility);
mWifiConfigPadding.setVisibility(configVisibility);
} }
/** /**